-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvbd.py
More file actions
31 lines (27 loc) · 857 Bytes
/
Copy pathvbd.py
File metadata and controls
31 lines (27 loc) · 857 Bytes
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
"""
"""
class VBD:
def __init__(self, session, vm_ref, vdi_ref):
self._session = session
self._vm_ref = vm_ref
self._vdi_ref = vdi_ref
def create(self):
rec = {
'VM': self._vm_ref,
'VDI': self._vdi_ref,
'userdevice': 'autodetect',
'bootable': True,
'mode': 'RW',
'type': 'disk',
'unpluggable': True,
'empty': False,
'other_config': {},
'qos_algorithm_type': '',
'qos_algorithm_params': {},
'qos_supported_algorithms': [],
}
self._vbd_ref = self._session.xenapi.VBD.create(rec)
return self._vbd_ref
def plug(self):
self._session.xenapi.VBD.plug(self._vbd_ref)
orig_dev = self._session.xenapi.VBD.get_device(self._vbd_ref)