def get_datastore_ref(si, datastore_name):
 inventory = get_inventory(si)
 container = inventory.viewManager.CreateContainerView(inventory.rootFolder, [vim.Datastore], True)
 for item in container.view:
  if (item.name == datastore_name):
   return item
 return None

def get_datastore_ref ( si , datastore_name ) : inventory = get_inventory ( si ) container = inventory . viewManager . CreateContainerView ( inventory . rootFolder , [ vim . Datastore ] , True ) for item in container . view : if ( item . name == datastore_name ) : return item return None
get a reference to a vmware datastore for the purposes of adding/removing disks si serviceinstance for the vsphere or esxi server datastore_name name of the datastore .