1
from xen.xend.server.DevController import DevController
2
from xen.xend.XendLogging import log
4
from xen.xend.XendError import VmError
8
CONFIG_ENTRIES = ['type', 'vncdisplay', 'vnclisten', 'vncpasswd', 'vncunused',
9
'display', 'xauthority', 'keymap', 'vnc', 'sdl', 'uuid',
10
'location', 'protocol', 'opengl']
12
class VfbifController(DevController):
13
"""Virtual frame buffer controller. Handles all vfb devices for a domain.
14
Note that we only support a single vfb per domain at the moment.
17
def __init__(self, vm):
18
DevController.__init__(self, vm)
20
def getDeviceDetails(self, config):
21
"""@see DevController.getDeviceDetails"""
23
back = dict([(k, str(config[k])) for k in CONFIG_ENTRIES
24
if config.has_key(k)])
27
return (devid, back, {})
30
def getDeviceConfiguration(self, devid, transaction = None):
31
result = DevController.getDeviceConfiguration(self, devid, transaction)
33
if transaction is None:
34
devinfo = self.readBackend(devid, *CONFIG_ENTRIES)
36
devinfo = self.readBackendTxn(transaction, devid, *CONFIG_ENTRIES)
37
return dict([(CONFIG_ENTRIES[i], devinfo[i])
38
for i in range(len(CONFIG_ENTRIES))
39
if devinfo[i] is not None])
41
def waitForDevice(self, devid):
42
# is a qemu-dm managed device, don't wait for hotplug for these.
45
def reconfigureDevice(self, _, config):
46
""" Only allow appending location information of vnc port into
49
if 'location' in config:
50
(devid, back, front) = self.getDeviceDetails(config)
51
self.writeBackend(devid, 'location', config['location'])
52
return back.get('uuid')
54
raise VmError('Refusing to reconfigure device vfb:%d' % devid)
56
def destroyDevice(self, devid, force):
57
# remove the backend xenstore entries no matter what
58
# because we kill qemu-dm with extreme prejudice
59
# not giving it a chance to remove them itself
60
DevController.destroyDevice(self, devid, True)
63
def migrate(self, deviceConfig, network, dst, step, domName):
64
# Handled by qemu-dm so no action needed
68
class VkbdifController(DevController):
69
"""Virtual keyboard controller. Handles all vkbd devices for a domain.
72
def getDeviceDetails(self, config):
73
"""@see DevController.getDeviceDetails"""
77
return (devid, back, front)
79
def waitForDevice(self, config):
80
# is a qemu-dm managed device, don't wait for hotplug for these.
83
def destroyDevice(self, devid, force):
84
# remove the backend xenstore entries no matter what
85
# because we kill qemu-dm with extreme prejudice
86
# not giving it a chance to remove them itself
87
DevController.destroyDevice(self, devid, True)
89
def migrate(self, deviceConfig, network, dst, step, domName):
90
# Handled by qemu-dm so no action needed