我正在尝试使用我的 ESX 主机上的设备路径创建 VMFS 数据存储。根据来自互联网的建议,我尝试使用带有 devicePath 的“QueryVmfsDatastoreCreateOptions”作为参数,然后使用上述调用(规范)的输出使用 CreateVmfsDatastore 创建数据存储。
尝试调用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)
代码:
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"