VMware Cloud Community
zomb66
Contributor
Contributor

Failed Import-vapp to dvswitch

Hello all!

I'm trying to automate the import of virtual machines to inventory. But the error is issued when starting Import-Vapp command.

Import-VApp -Source $ova -VMHost $vmhost -Datastore $ds -DiskStorageFormat thin -Conirm:$false -Force -OvfConfiguration $ovfconfig

WARNING: "Network 'V25' is not accessible from host with id 'HostSystem-host-30319'."

Import-VApp : 20.06.2016 12:01:37    Import-VApp        Host did not have any virtual network defined.

At line:1 char:1

+ Import-VApp -Source $ova -VMHost $vmhost -Datastore $ds -Di ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (:) [Import-VApp], OvfNoHostNic

    + FullyQualifiedErrorId : Client20_VappServiceImpl_ImportVApp_CreateImportSpecError,VMware.VimAutomation.ViCore.Cm

   dlets.Commands.ImportVApp

The problem is that I only used dvswitch

Once I create vswitch - the problem disappears and everything is imported properly.

Mapping the network does not help.

Tell me, is there any way to import without creating vswitch?

Or is there some other method of automatic import the VMs?

Thank you!

0 Kudos
5 Replies
LucD
Leadership
Leadership

Not as far as I know.

If you create the OVF yourself, you could consider making the switch to which to connect a property of the OVF package.

That way you can specify the value at the moment of the import.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
christophermaho
Contributor
Contributor

I know this an old thread, but I encountered the same issue. Hopefully you have resolved it since then. I'm posting this here for others that come across this as well.

Here's my scenario:

Import-vapp using a portgroup on a vDS.

$vmAdapter = "vxw-dvs-37-universalwire-13-sid-20002-ULS_192.5.10.0/24"

$ovfConfiguration.NetworkMapping.Network_1.Value = $vmAdapter

This would fail with the following:

Import-VApp : 8/8/2017 11:47:11 AM      Import-VApp             "Network 'vxw-dvs-37-universalwire-13-sid-20002-ULS_192.5.10.0/24' is

not accessible from host with id 'HostSystem-host-27'."

At C:\users\chris\Documents\PowerCLI\deploy-vra.ps1:29 char:1

+ Import-VApp -Source $path -OvfConfiguration $ovfConfiguration -Name $ ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidArgument: (:) [Import-VApp], InvalidArgument

    + FullyQualifiedErrorId : ViCore_VappServiceImpl_ApplyNetworkMappings_NetworkNotAccessible,VMware.VimAutomation.Vi

   Core.Cmdlets.Commands.ImportVApp

This would work like OP mentioned if this was a standard vSwitch. Instead you have to do the following:

$ovfConfiguration.NetworkMapping.Network_1.Value = Get-vDSwitch "dvSwitch" | Get-vDPortGroup $vmAdapter

0 Kudos
LucD
Leadership
Leadership

Out of curiosity, did you compare the 2 values?

Is there a difference, in type, in value?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
christophermaho
Contributor
Contributor

It seemed to be looking for a standard switch only when OP and I wanted to pass through a vDS to it. I did test and confirm.

Here's a caveat to my situation. My vDS is named like so: "vxw-dvs-37-universalwire-13-sid-20002-ULS_192.5.10.0/24" It didn't seem to like the "/" in the name, so I did this instead:

$vmAdapter = "vxw-dvs-37-universalwire-13-sid-20002-ULS_192.5.10.0*"

$ovfConfiguration.NetworkMapping.Network_1.Value = Get-vDSwitch "dvSwitch" | Get-VDPortGroup $vmAdapter

I used a * in place of the / and allowed it find the full switch name. Alternatively, I can substitute any "/" for "%2f" since I did notice a vapp options file it noted it like so:

-<ve:EthernetAdapterSection>
<ve:Adapter ve:mac="00:50:56:a4:b5:4d" ve:network="vxw-dvs-43-universalwire-13-sid-20002-ULS_192.5.10.0%2f24" ve:unitNumber="7"/>

Thanks,

Chris

0 Kudos
LucD
Leadership
Leadership

Got it, thanks for the info.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos