ia64/xen-unstable

annotate tools/python/xen/xend/server/ConsoleController.py @ 13642:ba3ec84c9423

[XEND] Add missing ConsoleController.py

Signed-off-by: Alastair Tse <atse@xensource.com>
author Alastair Tse <atse@xensource.com>
date Fri Jan 26 02:44:35 2007 +0000 (2007-01-26)
parents
children fbe161b1af16
rev   line source
atse@13642 1 from xen.xend.server.DevController import DevController
atse@13642 2 from xen.xend.XendLogging import log
atse@13642 3
atse@13642 4 from xen.xend.XendError import VmError
atse@13642 5
atse@13642 6 class ConsoleController(DevController):
atse@13642 7 """A dummy controller for us to represent serial and vnc
atse@13642 8 console devices with persistent UUIDs.
atse@13642 9 """
atse@13642 10
atse@13642 11 valid_cfg = ['uri', 'uuid', 'protocol']
atse@13642 12
atse@13642 13 def __init__(self, vm):
atse@13642 14 DevController.__init__(self, vm)
atse@13642 15 self.hotplug = False
atse@13642 16
atse@13642 17 def getDeviceDetails(self, config):
atse@13642 18 back = dict([(k, config[k]) for k in self.valid_cfg if k in config])
atse@13642 19 return (self.allocateDeviceID(), back, {})
atse@13642 20
atse@13642 21
atse@13642 22 def getDeviceConfiguration(self, devid):
atse@13642 23 result = DevController.getDeviceConfiguration(self, devid)
atse@13642 24 devinfo = self.readBackend(devid, *self.valid_cfg)
atse@13642 25 config = dict(zip(self.valid_cfg, devinfo))
atse@13642 26 config = dict([(key, val) for key, val in config.items()
atse@13642 27 if val != None])
atse@13642 28 return config
atse@13642 29