I am trying to create a VMFS datastore using the devicepath on my ESX host. Based on suggestions from the internet, I tried to use the 'QueryVmfsDatastoreCreateOptions' with devicePath as a parameter and then use the output of the above call (spec) to create a datastore using CreateVmfsDatastore.
I get an error when I try to invoke QueryVmfsDatastoreCreateOptions API
[root@localhost bin]# python dd_esx_disk.py -s 10.25.190.100 -u root -p Abcd123! --uuid eui.3221784b198087db8ccb707400000001
Device path: /vmfs/devices/disks/eui.3221784b198087db8ccb707400000001
Unexpected error: _InvokeMethod() takes at least 2 arguments (1 given)
Code:
def createDatastore(si, uuid):
devicepath="/vmfs/devices/disks/"+ uuid
print "Device path: %s" %devicepath
try:
vmfs_ds_options = vim.host.DatastoreSystem.QueryVmfsDatastoreCreateOptions(devicePath=devicepath, vmfsMajorVersion=5)
except vim.fault.NotFound:
print "Not found"
except vim.fault.HostConfigFault:
print "host config fault"
except vmodl.fault.NotSupported:
print "Not supported"
except Exception as e:
print "Unexpected error: %s" %e
else:
print "Query success"