Quantcast
Channel: VMware Communities : All Content - vSphere Management SDK
Viewing all articles
Browse latest Browse all 1860

pyvmomi - example of DatastoreSystem.QueryVmfsDatastoreCreateOptions

$
0
0

I have been unable to make calls to the API's in the vim.host.DatastoreSystem. I am passing the right number of arguments but i still get an error 'Unexpected error: _InvokeMethod() takes at least 2 arguments (1 given)'. I posted the question on a couple of forums but have not gotten any response. Below is my code snippet.

 

def createDatastore(si, uuid):

    dp="/vmfs/devices/disks/"+ str(uuid)

    print "Device path: %s" %dp

    try:

        vmfs_ds_options = vim.host.DatastoreSystem.QueryVmfsDatastoreCreateOptions(devicePath=dp, 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"

 

 

 

When i run my script, i get the below error (and traceback)

 

Traceback (most recent call last):

  File "test_datastore.py", line 74, in createDatastore

    vmfs_ds_options = vim.host.DatastoreSystem.QueryVmfsDatastoreCreateOptions(devicePath=dp, vmfsMajorVersion=5)

  File "/usr/lib/python2.7/site-packages/pyVmomi/VmomiSupport.py", line 560, in __call__

    return self.f(*args, **kwargs)

TypeError: _InvokeMethod() takes at least 2 arguments (1 given)

Unexpected error: _InvokeMethod() takes at least 2 arguments (1 given)


Viewing all articles
Browse latest Browse all 1860

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>