qvm-tools: make qvm-ls code more defensive
Do not assume only predefined VMs types, do not assume only one type of template etc.
This commit is contained in:
parent
4090fdf758
commit
1756ab33e9
@ -40,16 +40,16 @@ fields = {
|
|||||||
+ ('>' if vm.is_disposablevm() else '')\
|
+ ('>' if vm.is_disposablevm() else '')\
|
||||||
+ ('}' if vm.is_netvm() else '')"},
|
+ ('}' if vm.is_netvm() else '')"},
|
||||||
|
|
||||||
"type": {"func": "'Tpl' if vm.is_template() else \
|
"type": {"func": "'HVM' if vm.type == 'HVM' else \
|
||||||
('Proxy' if vm.is_proxyvm() else \
|
('Tpl' if vm.is_template() else \
|
||||||
(' Net' if vm.is_netvm() else \
|
('' if vm.type in ['AppVM', 'DisposableVM'] else \
|
||||||
('HVM' if vm.type == 'HVM' else '')))"},
|
vm.type.replace('VM','')))"},
|
||||||
|
|
||||||
"updbl" : {"func": "'Yes' if vm.updateable else ''"},
|
"updbl" : {"func": "'Yes' if vm.updateable else ''"},
|
||||||
|
|
||||||
"template": {"func": "'n/a' if vm.is_template() else\
|
"template": {"func": "'n/a' if vm.is_template() else\
|
||||||
('None' if vm.template is None else\
|
('None' if vm.template is None else\
|
||||||
qvm_collection[vm.template.qid].name)"},
|
vm.template.name)"},
|
||||||
|
|
||||||
"netvm": {"func": "'n/a' if vm.is_netvm() and not vm.is_proxyvm() else\
|
"netvm": {"func": "'n/a' if vm.is_netvm() and not vm.is_proxyvm() else\
|
||||||
('*' if vm.uses_default_netvm else '') +\
|
('*' if vm.uses_default_netvm else '') +\
|
||||||
@ -165,8 +165,8 @@ def main():
|
|||||||
|
|
||||||
# Now, the AppVMs without template (or with template not included in the list)...
|
# Now, the AppVMs without template (or with template not included in the list)...
|
||||||
for appvm in vms_list:
|
for appvm in vms_list:
|
||||||
if appvm.is_appvm() and (appvm.template is None or \
|
if appvm.is_appvm() and not appvm.is_template() and \
|
||||||
appvm.template not in vms_list):
|
(appvm.template is None or appvm.template not in vms_list):
|
||||||
vms_to_display.append (appvm)
|
vms_to_display.append (appvm)
|
||||||
|
|
||||||
# Now, the template, and all its AppVMs...
|
# Now, the template, and all its AppVMs...
|
||||||
|
Loading…
Reference in New Issue
Block a user