qvm-tools: add option to list only selected VMs

This commit is contained in:
Marek Marczykowski-Górecki 2013-10-23 20:52:32 +02:00
parent 71960d83cc
commit 084b5575a9

View File

@ -154,6 +154,8 @@ def main():
vms_list = [vm for vm in qvm_collection.values()]
if len(args) > 0:
vms_list = [vm for vm in vms_list if vm.name in args]
no_vms = len (vms_list)
vms_to_display = []
# Frist, the NetVMs...
@ -161,9 +163,10 @@ def main():
if netvm.is_netvm():
vms_to_display.append (netvm)
# Now, the AppVMs without template...
# Now, the AppVMs without template (or with template not included in the list)...
for appvm in vms_list:
if appvm.is_appvm() and appvm.template is None:
if appvm.is_appvm() and (appvm.template is None or \
appvm.template not in vms_list):
vms_to_display.append (appvm)
# Now, the template, and all its AppVMs...