from ccnode.tags import Tag from ccnode.hypervisor import lib as _libvirt from ccnode.hypervisor.lib import DOMAIN_STATES as STATE class VirtualMachine(object): """Represent a VM instance.""" def __init__(self, dom): """ :param dom: libvirt domain instance """ #: UUID string of domain self.uuid = dom.UUIDString() #: state of VM: started, stoped, paused self.state = STATE[dom.info()[0]] #: tags for this VM self.tags = dict( test=Tag('test', 'plop'), ) @property def name(self): return _libvirt.connection.lookupByUUIDString(self.uuid).name() def start(): pass def stop(): pass def pause(): pass def define(): pass def undefined(): pass