tofu
tofu

Reputation: 25

vsphere python extend vmfs datastore

I would like to extend a vmfs datastore thanks the vsphere python api pyvmomi. A methode exist for this purpose extendvmfsdatastore (https://vdc-download.vmware.com/vmwb-repository/dcr-public/9542ddfe-a363-4bd2-81ab-f1b71be3f330/63de5870-0644-4a0b-a7c7-f31298d54623/doc/vim.host.DatastoreSystem.html#extendVmfsDatastore) How to use it? how to build the "VcDatastore object" requiered by the QueryVmfsDatastoreExpandOptions methode? could you give me an example?

esxi = self.find_hostsystem_by_name(self.esxi_hostname)
host_ds_system = esxi.configManager.datastoreSystem
ds_system = vim.host.DatastoreSystem

vmfs_ds_extendspec = ds_system.QueryVmfsDatastoreExpandOptions([VcDatastore type])
ds = ExtendVmfsDatastore(ds_system,vmfs_ds_extendspec)

thanks a lot

Upvotes: 1

Views: 425

Answers (1)

clarkus978
clarkus978

Reputation: 634

I hope this helps you. This is what I use to expand VMFS datastores:

host_ds_system = esxi_obj.configManager.datastoreSystem
ds_system = vim.host.DatastoreSystem
vmfs_ds_options = ds_system.QueryVmfsDatastoreExpandOptions(host_ds_system, datastore_obj)
ds_system.ExpandVmfsDatastore(host_ds_system, datastore_obj, vmfs_ds_options[0].spec)

Upvotes: 1

Related Questions