ia64/xen-unstable

changeset 18753:91a2b9309a72

xend: ioport & irq persistence thru reboot

When a domU is configured for a serial port as documented at:
http://wiki.xensource.com/xenwiki/InstallationNotes

the VM does see the serial port, however when dom0 is rebooted and
the VM started it no longer has access to the serial port.

xm list -l <vm> no longer shows the ioports or irq attributes

Attached patch adds implementation of getDeviceConfiguration(),
returns details dict and implements waitForDevice() to irqif.py and
iopif.py.

Also added preprocess_irq() to create.py.

Signed-off-by: Pat Campbell <plc@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Nov 03 10:23:09 2008 +0000 (2008-11-03)
parents f12d9595d07c
children 303b1014f91e
files tools/python/xen/xend/server/iopif.py tools/python/xen/xend/server/irqif.py tools/python/xen/xm/create.py
line diff
     1.1 --- a/tools/python/xen/xend/server/iopif.py	Fri Oct 31 14:02:39 2008 +0000
     1.2 +++ b/tools/python/xen/xend/server/iopif.py	Mon Nov 03 10:23:09 2008 +0000
     1.3 @@ -45,9 +45,22 @@ def parse_ioport(val):
     1.4  
     1.5  class IOPortsController(DevController):
     1.6  
     1.7 +    valid_cfg = ['to', 'from', 'uuid']
     1.8 +
     1.9      def __init__(self, vm):
    1.10          DevController.__init__(self, vm)
    1.11  
    1.12 +    def getDeviceConfiguration(self, devid, transaction = None):
    1.13 +        result = DevController.getDeviceConfiguration(self, devid, transaction)
    1.14 +        if transaction is None:
    1.15 +            devinfo = self.readBackend(devid, *self.valid_cfg)
    1.16 +        else:
    1.17 +            devinfo = self.readBackendTxn(transaction, devid, *self.valid_cfg)
    1.18 +        config = dict(zip(self.valid_cfg, devinfo))
    1.19 +        config = dict([(key, val) for key, val in config.items()
    1.20 +                       if val != None])
    1.21 +        return config
    1.22 +
    1.23      def getDeviceDetails(self, config):
    1.24          """@see DevController.getDeviceDetails"""
    1.25  
    1.26 @@ -81,4 +94,9 @@ class IOPortsController(DevController):
    1.27                  'ioports: Failed to configure legacy i/o range: %s - %s' %
    1.28                  (io_from, io_to))
    1.29  
    1.30 -        return (None, {}, {})
    1.31 +        back = dict([(k, config[k]) for k in self.valid_cfg if k in config])
    1.32 +        return (self.allocateDeviceID(), back, {})
    1.33 +
    1.34 +    def waitForDevice(self, devid):
    1.35 +        # don't wait for hotplug
    1.36 +        return
     2.1 --- a/tools/python/xen/xend/server/irqif.py	Fri Oct 31 14:02:39 2008 +0000
     2.2 +++ b/tools/python/xen/xend/server/irqif.py	Mon Nov 03 10:23:09 2008 +0000
     2.3 @@ -39,6 +39,18 @@ class IRQController(DevController):
     2.4      def __init__(self, vm):
     2.5          DevController.__init__(self, vm)
     2.6  
     2.7 +    valid_cfg = ['irq', 'uuid']
     2.8 +
     2.9 +    def getDeviceConfiguration(self, devid, transaction = None):
    2.10 +        result = DevController.getDeviceConfiguration(self, devid, transaction)
    2.11 +        if transaction is None:
    2.12 +            devinfo = self.readBackend(devid, *self.valid_cfg)
    2.13 +        else:
    2.14 +            devinfo = self.readBackendTxn(transaction, devid, *self.valid_cfg)
    2.15 +        config = dict(zip(self.valid_cfg, devinfo))
    2.16 +        config = dict([(key, val) for key, val in config.items()
    2.17 +                       if val != None])
    2.18 +        return config
    2.19  
    2.20      def getDeviceDetails(self, config):
    2.21          """@see DevController.getDeviceDetails"""
    2.22 @@ -75,4 +87,9 @@ class IRQController(DevController):
    2.23          if rc < 0:
    2.24              raise VmError(
    2.25                  'irq: Failed to map irq %x' % (pirq))
    2.26 -        return (None, {}, {})
    2.27 +        back = dict([(k, config[k]) for k in self.valid_cfg if k in config])
    2.28 +        return (self.allocateDeviceID(), back, {})
    2.29 +
    2.30 +    def waitForDevice(self, devid):
    2.31 +        # don't wait for hotplug
    2.32 +        return
     3.1 --- a/tools/python/xen/xm/create.py	Fri Oct 31 14:02:39 2008 +0000
     3.2 +++ b/tools/python/xen/xm/create.py	Mon Nov 03 10:23:09 2008 +0000
     3.3 @@ -1036,6 +1036,14 @@ def preprocess_ioports(vals):
     3.4          ioports.append(hexd)
     3.5      vals.ioports = ioports
     3.6          
     3.7 +def preprocess_irq(vals):
     3.8 +    if not vals.irq: return
     3.9 +    irq = []
    3.10 +    for v in vals.irq:
    3.11 +        d = repr(v)
    3.12 +        irq.append(d)
    3.13 +    vals.irq = irq
    3.14 +
    3.15  def preprocess_vtpm(vals):
    3.16      if not vals.vtpm: return
    3.17      vtpms = []
    3.18 @@ -1134,6 +1142,7 @@ def preprocess(vals):
    3.19      preprocess_vscsi(vals)
    3.20      preprocess_ioports(vals)
    3.21      preprocess_ip(vals)
    3.22 +    preprocess_irq(vals)
    3.23      preprocess_nfs(vals)
    3.24      preprocess_vtpm(vals)
    3.25      preprocess_access_control(vals)