VMware {code} Community
shar_234
Contributor
Contributor

Regarding reconfigure VM task - Modifying a disk

Hi all

I'd been trying for a long time to change the property of an existing disk in a VM ,say I wanted to change the disk mode..

But I could never get the reconfigureVmTask run successfully..It always gave some exception for the config spec I sent. I use a VirtualDiskFlatVer2BackingInfo object for the disk's VirtualDeviceConfigSpec. Pls let me know what exactly should be set as the 'operation' (add, edit, remove) and the 'fileOperation' (create, replace,destroy) for the VirtualDeviceConfigSpec coz most often I got the error messages,

"Incompatible device backing specified for device '0'." or "Invalid operation for device '0' " ..The other non nillable elements(such as key, filename) were all set properly. Couldnt find what was the exact way to edit an existing disk's property..

Can someone pls help me on this...

Thanks

Sharada

0 Kudos
2 Replies
tos2k
Expert
Expert

0 Kudos
admin
Immortal
Immortal

Since you are trying to change the disk mode of an existing vm, the operation specified in the virtualdeviceconfigspec will need to be 'edit'. 'add' operation basically is meant to be used, if you were creating a new disk.

The fileOperation property would also need to be set to 'replace', when dealing with an exisitng disk. Ideally you would already have a virtual disk backing for this pre-exisitng disk being modified. Setting the fileOperation value to 'replace' will delete the exisitng virtual disk backing and create a new one.

0 Kudos