0

I'm using the Pysphere API written in python in order to manage VM operations.

My question is, how do I change the machine name after it was already cloned.

The API is here and here.

jkdev
  • 11,360
  • 15
  • 54
  • 77
JavaSa
  • 5,813
  • 16
  • 71
  • 121

1 Answers1

0

As i understood, vm is already created/cloned. So basically you want to change the vm configuration.You need to create a configuration spec(vm name in your case).

context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
context.verify_mode = ssl.CERT_NONE
print opArg
sI = connect.SmartConnect(host='',
             user='',
             pwd='',
             port=443,
             sslContext=context)
content = sI.content
objView = content.viewManager.CreateContainerView(content.rootFolder,[vim.VirtualMachine],True)
vmList = objView.view
for vm in vmList:
    vm_obj = vm

And then you pass your spec as-

vm_obj.ReconfigVM_Task(spec=your_spec)

I worked on VMWare a long time ago. I hope this is still helpful.

Rishabh Soni
  • 159
  • 1
  • 10