Editing a vmx file using python API

496 views
Skip to first unread message

sasikiran v

unread,
Oct 26, 2012, 12:36:13 AM10/26/12
to pysp...@googlegroups.com
We want to change the value of flag scsi0.VirtualDev in vmx file through python script.

Can anyone plz help me regarding this.


Seba

unread,
Nov 19, 2012, 2:34:41 PM11/19/12
to pysp...@googlegroups.com
Hi!

Try the following:

from pysphere import VIServer
s = VIServer()
s.connect(HOST, USER, PASSWORD)
vm = s.get_vm_by_path("[datastore] path/to/vm/config.vmx")

settings = {'scsi0.VirtualDev': 'DESIRED VALUE'}

vm.set_extra_config(settings)
s.disconnect()



Regards,

Seba.

Sirisha

unread,
Nov 27, 2012, 5:08:26 AM11/27/12
to pysp...@googlegroups.com
I have tried with this code, but it did not effect the vmx file. 
The vmx file has not changed with this.

Seba

unread,
Nov 28, 2012, 6:56:43 AM11/28/12
to pysp...@googlegroups.com
Hi,

  The ESX/vCenter server performs validations on the settings being set. If it doesn't like something it just silently ignores the property without showing any kind of error messages.

  There are a few things that might be happening on the particular property you're trying to set:

  1) Is only supported by VMWare Fusion or VMWare Workstations environments. Which makes sense as hardware device configuration is not performed via vmx file tweaking, you must use the API instead (see related topics on this group adding/editing virtual hardware)
  2) The property or value you're trying to set is either invalid or not supported
  3) I don't know

I wasn't able to change that property either.

Regards,

Seba.
Reply all
Reply to author
Forward
0 new messages