Skip to content

Commit

Permalink
Add methods for getting all datacenters, clusters, hosts, vms,
Browse files Browse the repository at this point in the history
datastores and resource pools
  • Loading branch information
dnaeon committed Mar 27, 2014
1 parent 67da45a commit b9b58b3
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/vpoller/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,48 @@ def get_capability(self):
"""
return self.capability

def get_all_datacenters(self):
"""
Get a list of all pyVmomi.vim.Datacenter managed objects
"""
return self._get_all_objects(obj_type=[pyVmomi.vim.Datacenter])

def get_all_clusters(self):
"""
Get a list of all pyVmomi.vim.ClusterComputeResource managed objects
"""
return self._get_all_objects(obj_type=[pyVmomi.vim.ClusterComputeResource])

def get_all_hosts(self):
"""
Get a list of a ll pyVmomi.vim.HostSystem managed objects
"""
return self._get_all_objects(obj_type=[pyVmomi.vim.HostSystem])

def get_all_vms(self):
"""
Get a list of all pyVmomi.vim.VirtualMachine managed objects
"""
return self._get_all_objects(obj_type=[pyVmomi.vim.VirtualMachine])

def get_all_datastores(self):
"""
Get a list of all pyVmomi.vim.Datastore managed objects
"""
return self._get_all_objects(obj_type=[pyVmomi.vim.Datastore])

def get_all_resource_pools(self):
"""
Get a list of all pyVmomi.vim.ResourcePool managed objects
"""
return self._get_all_objects(obj_type=[pyVmomi.vim.ResourcePool])

def _get_all_objects(self, obj_type):
"""
Get all managed objects of type 'obj_type'
Expand Down

0 comments on commit b9b58b3

Please sign in to comment.