Add VM list filtering by tag
Uses same method as state or node filtering, rather than altering how the main LIMIT field works.
This commit is contained in:
@ -1747,19 +1747,23 @@ def vm_dump(filename, domain):
|
||||
'-s', '--state', 'target_state', default=None,
|
||||
help='Limit list to VMs in the specified state.'
|
||||
)
|
||||
@click.option(
|
||||
'-g', '--tag', 'target_tag', default=None,
|
||||
help='Limit list to VMs with the specified tag.'
|
||||
)
|
||||
@click.option(
|
||||
'-r', '--raw', 'raw', is_flag=True, default=False,
|
||||
help='Display the raw list of VM names only.'
|
||||
)
|
||||
@cluster_req
|
||||
def vm_list(target_node, target_state, limit, raw):
|
||||
def vm_list(target_node, target_state, target_tag, limit, raw):
|
||||
"""
|
||||
List all virtual machines; optionally only match names or full UUIDs matching regex LIMIT.
|
||||
|
||||
NOTE: Red-coloured network lists indicate one or more configured networks are missing/invalid.
|
||||
"""
|
||||
|
||||
retcode, retdata = pvc_vm.vm_list(config, limit, target_node, target_state)
|
||||
retcode, retdata = pvc_vm.vm_list(config, limit, target_node, target_state, target_tag)
|
||||
if retcode:
|
||||
retdata = pvc_vm.format_list(config, retdata, raw)
|
||||
else:
|
||||
|
Reference in New Issue
Block a user