# Construt CloneSpec and RelocateSpec for Clone Task
clone_spec = vim.vm.CloneSpec()
# print(clone_spec)
network = self.get_obj([vim.Network], 'VM Network 357-110')
deviceToChange = None
for device in base_vm.config():
if isinstance(device, vim.vm.device.VirtualEthernetCard):
deviceToChange = device
# print(device)
nic = vim.vm.device.VirtualDeviceSpec()
nic.operation = vim.vm.device.VirtualDeviceSpec.Operation.edit # or add to make a new one
nic.device = deviceToChange
nic.device.wakeOnLanEnabled = True
nic.device.addressType = 'assigned' #mac address assigned by virtual center
nic.device.key = 4000 # 4000 seems to be the value to use for a
nic.device.deviceInfo = vim.Description()
nic.device.deviceInfo.label = 'Network adapter 1'
nic.device.deviceInfo.summary = "VM Network 357-110"
nic.device.backing = vim.vm.device.VirtualEthernetCard.NetworkBackingInfo()
nic.device.backing.deviceName = "VM Network 357-110"
nic.device.backing.network = network
nic.device.backing.useAutoDetect = False
nic.device.connectable = vim.vm.device.VirtualDevice.ConnectInfo()
nic.device.connectable.startConnected = True
nic.device.connectable.allowGuestControl = True
vmconf = vim.vm.ConfigSpec()
vmconf.deviceChange = [nic]
clone_spec.template = False
clone_spec.memory = False
clone_spec.powerOn = poweron
clone_spec.config = vmconf