|
|
@ -55,7 +55,7 @@ from suds.sudsobject import Object as SudsObject
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class VMwareInventory(object):
|
|
|
|
class VMwareInventory(object):
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, guests_only=None):
|
|
|
|
def __init__(self, guests_only=None):
|
|
|
|
self.config = ConfigParser.SafeConfigParser()
|
|
|
|
self.config = ConfigParser.SafeConfigParser()
|
|
|
|
if os.environ.get('VMWARE_INI', ''):
|
|
|
|
if os.environ.get('VMWARE_INI', ''):
|
|
|
@ -305,6 +305,11 @@ class VMwareInventory(object):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
vm_group = default_group + '_vm'
|
|
|
|
vm_group = default_group + '_vm'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if self.config.has_option('defaults', 'prefix_filter'):
|
|
|
|
|
|
|
|
prefix_filter = self.config.get('defaults', 'prefix_filter')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
prefix_filter = None
|
|
|
|
|
|
|
|
|
|
|
|
# Loop through physical hosts:
|
|
|
|
# Loop through physical hosts:
|
|
|
|
for host in HostSystem.all(self.client):
|
|
|
|
for host in HostSystem.all(self.client):
|
|
|
|
|
|
|
|
|
|
|
@ -318,6 +323,9 @@ class VMwareInventory(object):
|
|
|
|
|
|
|
|
|
|
|
|
# Loop through all VMs on physical host.
|
|
|
|
# Loop through all VMs on physical host.
|
|
|
|
for vm in host.vm:
|
|
|
|
for vm in host.vm:
|
|
|
|
|
|
|
|
if prefix_filter:
|
|
|
|
|
|
|
|
if vm.name.startswith( prefix_filter ):
|
|
|
|
|
|
|
|
continue
|
|
|
|
self._add_host(inv, 'all', vm.name)
|
|
|
|
self._add_host(inv, 'all', vm.name)
|
|
|
|
self._add_host(inv, vm_group, vm.name)
|
|
|
|
self._add_host(inv, vm_group, vm.name)
|
|
|
|
vm_info = self._get_vm_info(vm)
|
|
|
|
vm_info = self._get_vm_info(vm)
|
|
|
|