Commit 4de1b5cb authored by Antoine Millet's avatar Antoine Millet

Implemented titles on VMs

parent aaf181f3
......@@ -61,6 +61,15 @@ class VirtualMachine(object):
#: UUID string of domain
self.uuid = dom.UUIDString() =
# Get title of VM
self.title = dom.metadata(libvirt.VIR_DOMAIN_METADATA_TITLE, None)
except (libvirt.libvirtError, AttributeError):
# libvirtError handle the case where the title is not defined on the
# vm, AttributeError handle the case where the libvirt is too old
# to allow metadata handling
self.title = None
#: state of VM: started, stoped, paused
self._state = STATE[[0]]
#: tags for this VM
......@@ -83,6 +83,14 @@ def h(dom):
def t(dom):
"""Title of the VM (or name if title is not defined)."""
if dom.title is None:
return dom.title
def cpu(dom):
"""Number of CPU of the VM."""
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment