Implement second change from #30826

This commit is contained in:
James Tanner 2017-09-30 14:16:15 -04:00 committed by jctanner
parent 1c1c89927d
commit 8c368b25cd

View file

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