VMware {code} Community
shwu745
Contributor
Contributor

Linked clone VM with vDS does not have Network label set to port group

My environment is vSphere 4 with virtual distributed switch enabled. The parent VM is connected to a vDS port group with Ephemeral - no binding. After a new VM is cloned by linked-clone, its network adapter setting's "Network label" is empty. If the parent VM's is connected to a regular network, the new VM's "Network label" is set well after it is cloned by linked-clone. Does anyone know how to set the Network label for vDS after a VM is cloned?

Thanks for any comment.

Tags (2)
Reply
0 Kudos
6 Replies
lamw
Community Manager
Community Manager

It's set the same way you would normally with a vss portgroup, but you probably need to pass in additional information when working vDS portgroup. Are you creating this Linked Clone using the vSphere API and not using products like View or Lab Manager? I would say, as part of the Linked Clone operation which is just using the standard CloneVM_Task that you specify that you're connecting to a vDS portgroup and that should get you going

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

Reply
0 Kudos
shwu745
Contributor
Contributor

Thanks lamw for the reply. How can I specify for CloneVM_Task to connect to a vDS portgroup? The strange thing is that I can view the parent VM's config.hardware.device[4000].backing property as VirtualEthernetCardDistributedVirtualPortBackingInfo by MOB and its port type is DistributedVirtualSwitchPortConnection. But my web service client built with vim25 cannot retrieve that property. It always returns the backing type as VirtualEthernetCardBackingInfo with null dynamic properties. Also the MOB shows that the cloned VM has same network related properties as its parent VM such as "network" property points to a dvportgroup and the device backing points to the same dvport. If my client app retrieves the VM's network property, it only gets "Network" managed object instead of "DistributedVirtualPortgroup" managed object. What am I missing for the client to talk with vSphere 4 server?

Thanks for any advice.

Reply
0 Kudos
lamw
Community Manager
Community Manager

Both VirtualEthernetCardBackingInfo and VirtualEthernetCardDistributedVirtualPortBackingInfo extend from VirtualDeviceBackingInfo. You may need to do some type of casting or re-create the backing to be a vDS and then specify the port that you're interested in.

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

Reply
0 Kudos
shwu745
Contributor
Contributor

Thanks lawm for quick response again. The cast from VirtualEthernetCardBackingInfo to VirtualEthernetCardDistributedVirtualPortBackingInfo causes an exeception. My app tries to retrieve the parent VM's vDS port info first and then creates the same to the child VM. But it fails to retrieve the parent VM's backing info. somehow it always returns nulls for the backing properties. It works well for VMs with non-vDS ports.

Reply
0 Kudos
lamw
Community Manager
Community Manager

So before trying to perform the cast/etc. I would do a simple test, retrieve the parent's vNIC information and the portgroup which in this case, is connected to vDS portgroup. After you've successfully queried for that information, you need to get it's backing info ... if you're not successful in retrieving that info, then you will not be successful in the clone. Are you using vSphere SDK for Java (VMware's Tech Preview) version or VI Java (Steve Jin's) version. Wondering if this might be a bug in the SDK client stubs, of if something is just being overlooked.

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware scripts and resources at:

Twitter: @lamw

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

Reply
0 Kudos
shwu745
Contributor
Contributor

I found the problem failing to retrieve vDS related properties. My app was created based on vi 2.5 SDK. The operations' soapAction part is empty. But the vSphere SDK's soapAction is set as "urn:vim25/4.0". If I link my code to vSphere SDK, it can retrieve VM's vDS properties.

Reply
0 Kudos