|
|
@ -214,10 +214,12 @@ class PyVmomiCache(object):
|
|
|
|
if confine_to_datacenter:
|
|
|
|
if confine_to_datacenter:
|
|
|
|
if hasattr(objects, 'items'):
|
|
|
|
if hasattr(objects, 'items'):
|
|
|
|
# resource pools come back as a dictionary
|
|
|
|
# resource pools come back as a dictionary
|
|
|
|
|
|
|
|
tmpobjs = objects.copy()
|
|
|
|
for k, v in objects.items():
|
|
|
|
for k, v in objects.items():
|
|
|
|
parent_dc = get_parent_datacenter(k)
|
|
|
|
parent_dc = get_parent_datacenter(k)
|
|
|
|
if parent_dc.name != self.dc_name:
|
|
|
|
if parent_dc.name != self.dc_name:
|
|
|
|
objects.pop(k, None)
|
|
|
|
tmpobjs.pop(k, None)
|
|
|
|
|
|
|
|
objects = tmpobjs
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
# everything else should be a list
|
|
|
|
# everything else should be a list
|
|
|
|
objects = [x for x in objects if get_parent_datacenter(x).name == self.dc_name]
|
|
|
|
objects = [x for x in objects if get_parent_datacenter(x).name == self.dc_name]
|
|
|
|