Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editing VM Specs issue with InstantClone() #731

Open
sYera21 opened this issue Oct 11, 2023 · 0 comments
Open

Editing VM Specs issue with InstantClone() #731

sYera21 opened this issue Oct 11, 2023 · 0 comments
Labels

Comments

@sYera21
Copy link

sYera21 commented Oct 11, 2023

Describe the bug

Need help with understanding if it is possible to have 2 Vms in esxi to be exact clones with the same IP address and Mac addr.

I used InstantClone() to create a clone and then tried to edit the clones VirtualEthernetCard.

Though once the method below is run, Vsphere UI shows no change to the clones MacAddr field and or the AddrType field though I set it to 'manual'. It still seems persistent with having it be automatic. Is there anything else that needs to be done, or is it even possible to have exact clones with same hardware configurations?

Reproduction steps

...

Expected behavior

`

def edit_resources(self,si,vm_name=str):

content=si.RetrieveContent()
vm_obj=self.get_obj(content,[vim.VirtualMachine],vm_name)

virtual_nic_spec = vim.vm.device.VirtualDeviceSpec()

for dev in vm_obj.config.hardware.device:
    if isinstance(dev, vim.vm.device.VirtualEthernetCard):	
	    dev.macAddress="00:0c:29:aa:16:2f"
	    virtual_nic_spec.device = dev
	    virtual_nic_spec.device.key = dev.key
	    virtual_nic_spec.device.macAddress = dev.macAddress
	    virtual_nic_spec.device.addressType = vim.vm.device.VirtualEthernetCardOption.MacTypes.manual
	    virtual_nic_spec.device.backing = dev.backing
	    virtual_nic_spec.device.wakeOnLanEnabled = dev.wakeOnLanEnabled
	    print(virtual_nic_spec)
	    dev_changes = []
	    dev_changes.append(virtual_nic_spec)
	    reconfig_spec = vim.vm.ConfigSpec()
	    reconfig_spec.deviceChange = dev_changes
	    #update the task manager (i.e. Make the update)
	    task = vm_obj.ReconfigVM_Task(spec=reconfig_spec)
	    tasks.wait_for_tasks(si, [task])

`

Additional context

No response

@sYera21 sYera21 added the bug label Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant