ia64/xen-unstable

changeset 13080:a7da43e10ab3

Write the xfb configuration details to the store, rather than storing them in
memory. This ensures that the VM can be rebooted after a xend restart.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Mon Dec 18 00:00:57 2006 +0000 (2006-12-18)
parents c700f2346f9c
children d7150286ca7b
files tools/python/xen/xend/server/vfbif.py
line diff
     1.1 --- a/tools/python/xen/xend/server/vfbif.py	Sun Dec 17 23:59:08 2006 +0000
     1.2 +++ b/tools/python/xen/xend/server/vfbif.py	Mon Dec 18 00:00:57 2006 +0000
     1.3 @@ -13,6 +13,9 @@ def spawn_detached(path, args, env):
     1.4      else:
     1.5          os.waitpid(p, 0)
     1.6          
     1.7 +CONFIG_ENTRIES = ['type', 'vncdisplay', 'vnclisten', 'vncpasswd', 'vncunused',
     1.8 +                  'display', 'xauthority']
     1.9 +
    1.10  class VfbifController(DevController):
    1.11      """Virtual frame buffer controller. Handles all vfb devices for a domain.
    1.12      Note that we only support a single vfb per domain at the moment.
    1.13 @@ -20,24 +23,27 @@ class VfbifController(DevController):
    1.14  
    1.15      def __init__(self, vm):
    1.16          DevController.__init__(self, vm)
    1.17 -        self.config = {}
    1.18          
    1.19      def getDeviceDetails(self, config):
    1.20          """@see DevController.getDeviceDetails"""
    1.21 -        devid = 0
    1.22 -        back = {}
    1.23 -        front = {}
    1.24 -        return (devid, back, front)
    1.25 +
    1.26 +        back = dict([(k, config[k]) for k in CONFIG_ENTRIES
    1.27 +                     if config.has_key(k)])
    1.28 +
    1.29 +        return (0, back, {})
    1.30 +
    1.31  
    1.32      def getDeviceConfiguration(self, devid):
    1.33 -        r = DevController.getDeviceConfiguration(self, devid)
    1.34 -        for (k,v) in self.config.iteritems():
    1.35 -            r[k] = v
    1.36 -        return r
    1.37 -    
    1.38 +        result = DevController.getDeviceConfiguration(self, devid)
    1.39 +
    1.40 +        devinfo = self.readBackend(devid, *CONFIG_ENTRIES)
    1.41 +        return dict([(CONFIG_ENTRIES[i], devinfo[i])
    1.42 +                     for i in range(len(CONFIG_ENTRIES))
    1.43 +                     if devinfo[i] is not None])
    1.44 +
    1.45 +
    1.46      def createDevice(self, config):
    1.47          DevController.createDevice(self, config)
    1.48 -        self.config = config
    1.49          std_args = [ "--domid", "%d" % self.vm.getDomid(),
    1.50                       "--title", self.vm.getName() ]
    1.51          t = config.get("type", None)
    1.52 @@ -47,7 +53,7 @@ class VfbifController(DevController):
    1.53                  passwd = config["vncpasswd"]
    1.54              else:
    1.55                  passwd = xen.xend.XendRoot.instance().get_vncpasswd_default()
    1.56 -            if not(passwd is None or passwd == ""):
    1.57 +            if passwd:
    1.58                  self.vm.storeVm("vncpasswd", passwd)
    1.59                  log.debug("Stored a VNC password for vfb access")
    1.60              else: