pyvmomi
pyvmomi copied to clipboard
Can not retrieve portgroups from ClusterComputeResource container?
container = vim.ManagedEntity('datacenter-3') # it's a datacenter
view_ref =conn.content.viewManager.CreateContainerView(container=container,type=[vim.DistributedVirtualPortgroup],recursive=True)
print(view_ref.view) # it will show all portgroups in datacenter
container = vim.ManagedEntity('domain-c9') # it's a cluster compute resource
view_ref =conn.content.viewManager.CreateContainerView(container=container,type=[vim.DistributedVirtualPortgroup],recursive=True)
print(view_ref.view) # show nothing
Why can not retrieve portgroups from ClusterComputeResource
container?
But I found there is a property named network
under ClusterComputeResource
which to get all portgroups in current cluster.