only list vms for nodes that are online; prevents KeyError crashes
This commit is contained in:
parent
7148fc85ed
commit
9942361877
@ -172,7 +172,14 @@ def setmainlayout():
|
|||||||
def getvms(listonly = False):
|
def getvms(listonly = False):
|
||||||
vms = []
|
vms = []
|
||||||
try:
|
try:
|
||||||
|
nodes = []
|
||||||
|
for node in G.proxmox.cluster.resources.get(type='node'):
|
||||||
|
if node['status'] == 'online':
|
||||||
|
nodes.append(node['node'])
|
||||||
|
|
||||||
for vm in G.proxmox.cluster.resources.get(type='vm'):
|
for vm in G.proxmox.cluster.resources.get(type='vm'):
|
||||||
|
if vm['node'] not in nodes:
|
||||||
|
continue
|
||||||
if 'template' in vm and vm['template']:
|
if 'template' in vm and vm['template']:
|
||||||
continue
|
continue
|
||||||
if G.guest_type == 'both' or G.guest_type == vm['type']:
|
if G.guest_type == 'both' or G.guest_type == vm['type']:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user