5 Replies Latest reply on Aug 8, 2017 11:07 AM by LucD

    Failed Import-vapp to dvswitch

    zomb66 Lurker

      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!

        • 1. Re: Failed Import-vapp to dvswitch
          LucD Guru

          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.

          • 2. Re: Failed Import-vapp to dvswitch
            dogwooddell Novice

            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

            • 3. Re: Failed Import-vapp to dvswitch
              LucD Guru

              Out of curiosity, did you compare the 2 values?

              Is there a difference, in type, in value?

              • 4. Re: Failed Import-vapp to dvswitch
                dogwooddell Novice

                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

                • 5. Re: Failed Import-vapp to dvswitch
                  LucD Guru

                  Got it, thanks for the info.