Quantcast
Channel: VMware Communities : All Content - vSphere Management SDK
Viewing all articles
Browse latest Browse all 1860

C# CloneVM_Task Network Not Connected

$
0
0

Ok, so I would like to be able to clone a vm and have it's network come up already connected, and I feel I'm missing something incredibly simple.

 

https://github.com/jeffpatton1971/mod-vmware/blob/master/VMware/functions.cs#L402

 

That is where my clone code starts up, at line 539 I create my virtual network card. I loop through the devices in the source vm (one i'm cloning from) until I get to the network card that is attached to it. Yes, I know there could be multiple, in our environment we clone from specific machines and they only ever have one nic. I assign that device to my newly created network card. I create my devicespec and set it to edit and assing my network card to the device (I've recently updated this code a little, I now instantiate a virtualvmxnet3 object instead of virtualdevice object). I continue on my merry way assigning a new ip address, connecting it up to the proper vlan on the proper switch.

 

At line 600 I create a new connectinfo object, and set the device to be connected at startup, guest controlled and connected.

 

the clone happens just fine, I browse over to the vm and the network interface shows as not connected.

 

How can I programmatically connect this device to the network?

 

Thanks for checking this out!


Viewing all articles
Browse latest Browse all 1860

Trending Articles