Skip to content
Discussion options

You must be logged in to vote

With tenant:

>>> for cluster in nb.virtualization.clusters.filter("Cluster"):
...     print(cluster.name, cluster.type, cluster.tenant)
...
Cluster1 Type1 None
Cluster1-Tenant1 Type1 Tenant1
Cluster2 Type2 None
>>> nb_clu_type = nb.virtualization.cluster_types.get(name="Type1")
>>> tenant = nb.tenancy.tenants.get(name="Tenant1")
>>> clusters = nb.virtualization.clusters.filter(type_id=nb_clu_type.id, tenant_id=tenant.id)
>>> for cluster in clusters:
...     print("Cluster:", cluster)
...     print("VMs:", list(nb.virtualization.virtual_machines.filter(cluster_id=cluster.id)))
...
Cluster: Cluster1-Tenant1
VMs: [VM3]

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
5 replies
@nomad-cyanide
Comment options

@candlerb
Comment options

@nomad-cyanide
Comment options

@candlerb
Comment options

@candlerb
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@nomad-cyanide
Comment options

Answer selected by nomad-cyanide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants