Add functions for manipulating VM tags

Adds tags to schema (v3), to VM definition, adds function to modify
tags, adds function to get tags, and adds tags to VM data output.

Tags will enable more granular classification of VMs based either on
administrator configuration or from automated system events.
This commit is contained in:
2021-07-13 01:46:50 -04:00
parent c6d552ae57
commit 9a199992a1
3 changed files with 44 additions and 2 deletions

View File

@ -306,6 +306,14 @@ def getDomainDiskList(zkhandler, dom_uuid):
return disk_list
#
# Get a list of domain tags
#
def getDomainTags(zkhandler, dom_uuid):
tags = zkhandler.read(('domain.meta.tags', dom_uuid)).split(',')
return tags
#
# Get domain information from XML
#
@ -352,6 +360,8 @@ def getInformationFromXML(zkhandler, uuid):
else:
stats_data = {}
domain_tags = getDomainTags(zkhandler, uuid)
domain_uuid, domain_name, domain_description, domain_memory, domain_vcpu, domain_vcputopo = getDomainMainDetails(parsed_xml)
domain_networks = getDomainNetworks(parsed_xml, stats_data)
@ -378,6 +388,7 @@ def getInformationFromXML(zkhandler, uuid):
'node_selector': domain_node_selector,
'node_autostart': bool(strtobool(domain_node_autostart)),
'migration_method': domain_migration_method,
'tags': domain_tags,
'description': domain_description,
'profile': domain_profile,
'memory': int(domain_memory),