Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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