direct-io.hg

changeset 13628: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 9d1d9877131d
children 2f8a7e5fd8ba
files tools/python/xen/xend/server/ConsoleController.py
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/python/xen/xend/server/ConsoleController.py	Fri Jan 26 02:44:35 2007 +0000
     1.3 @@ -0,0 +1,29 @@
     1.4 +from xen.xend.server.DevController import DevController
     1.5 +from xen.xend.XendLogging import log
     1.6 +
     1.7 +from xen.xend.XendError import VmError
     1.8 +
     1.9 +class ConsoleController(DevController):
    1.10 +    """A dummy controller for us to represent serial and vnc
    1.11 +    console devices with persistent UUIDs.
    1.12 +    """
    1.13 +
    1.14 +    valid_cfg = ['uri', 'uuid', 'protocol']
    1.15 +
    1.16 +    def __init__(self, vm):
    1.17 +        DevController.__init__(self, vm)
    1.18 +        self.hotplug = False
    1.19 +
    1.20 +    def getDeviceDetails(self, config):
    1.21 +        back = dict([(k, config[k]) for k in self.valid_cfg if k in config])
    1.22 +        return (self.allocateDeviceID(), back, {})
    1.23 +
    1.24 +
    1.25 +    def getDeviceConfiguration(self, devid):
    1.26 +        result = DevController.getDeviceConfiguration(self, devid)
    1.27 +        devinfo = self.readBackend(devid, *self.valid_cfg)
    1.28 +        config = dict(zip(self.valid_cfg, devinfo))
    1.29 +        config = dict([(key, val) for key, val in config.items()
    1.30 +                       if val != None])
    1.31 +        return config
    1.32 +