ia64/xen-unstable
changeset 12512:f1d2860c5137
[XEND] Accomodate extra "devices" in SXP that do not have DevControllers
Signed-off-by: Alastair Tse <atse@xensource.com>
Signed-off-by: Alastair Tse <atse@xensource.com>
author | Alastair Tse <atse@xensource.com> |
---|---|
date | Fri Nov 17 17:57:49 2006 +0000 (2006-11-17) |
parents | 516821812322 |
children | f0ba459065d3 |
files | tools/python/xen/xend/XendConfig.py tools/python/xen/xend/XendDevices.py tools/python/xen/xend/XendDomainInfo.py |
line diff
1.1 --- a/tools/python/xen/xend/XendConfig.py Fri Nov 17 17:03:59 2006 +0000 1.2 +++ b/tools/python/xen/xend/XendConfig.py Fri Nov 17 17:57:49 2006 +0000 1.3 @@ -780,7 +780,8 @@ class XendConfig(dict): 1.4 1.5 # Verify devices 1.6 for d_uuid, (d_type, d_info) in self['device'].items(): 1.7 - if d_type not in XendDevices.valid_devices(): 1.8 + if d_type not in XendDevices.valid_devices() and \ 1.9 + d_type not in XendDevices.pseudo_devices(): 1.10 raise XendConfigError('Invalid device (%s)' % d_type) 1.11 1.12 # Verify restart modes 1.13 @@ -798,7 +799,8 @@ class XendConfig(dict): 1.14 self['vtpm_refs'] = [] 1.15 1.16 def device_add(self, dev_type, cfg_sxp = None, cfg_xenapi = None): 1.17 - if dev_type not in XendDevices.valid_devices(): 1.18 + if dev_type not in XendDevices.valid_devices() and \ 1.19 + dev_type not in XendDevices.pseudo_devices(): 1.20 raise XendConfigError("XendConfig: %s not a valid device type" % 1.21 dev_type) 1.22 1.23 @@ -917,8 +919,8 @@ class XendConfig(dict): 1.24 if dev_type == 'pci': # special case for pci devices 1.25 pci_devs.append(dev_info) 1.26 else: 1.27 - sxpr = self.device_sxpr(dev_type = dev_type, 1.28 - dev_info = dev_info) 1.29 + sxpr = self.device_sxpr(dev_type = dev_type, 1.30 + dev_info = dev_info) 1.31 sxprs.append((dev_type, sxpr)) 1.32 1.33 # if we have any pci_devs, we parse them differently into
2.1 --- a/tools/python/xen/xend/XendDevices.py Fri Nov 17 17:03:59 2006 +0000 2.2 +++ b/tools/python/xen/xend/XendDevices.py Fri Nov 17 17:57:49 2006 +0000 2.3 @@ -49,6 +49,11 @@ class XendDevices: 2.4 valid_devices = classmethod(valid_devices) 2.5 2.6 #@classmethod 2.7 + def pseudo_devices(cls): 2.8 + return ['console'] 2.9 + pseudo_devices = classmethod(pseudo_devices) 2.10 + 2.11 + #@classmethod 2.12 def make_controller(cls, name, domain): 2.13 """Factory function to make device controllers per domain. 2.14
3.1 --- a/tools/python/xen/xend/XendDomainInfo.py Fri Nov 17 17:03:59 2006 +0000 3.2 +++ b/tools/python/xen/xend/XendDomainInfo.py Fri Nov 17 17:57:49 2006 +0000 3.3 @@ -1119,8 +1119,9 @@ class XendDomainInfo: 3.4 @raise: VmError for invalid devices 3.5 """ 3.6 for (devclass, config) in self.info.all_devices_sxpr(): 3.7 - log.info("createDevice: %s : %s" % (devclass, config)) 3.8 - self._createDevice(devclass, config) 3.9 + if devclass in XendDevices.valid_devices(): 3.10 + log.info("createDevice: %s : %s" % (devclass, config)) 3.11 + self._createDevice(devclass, config) 3.12 3.13 if self.image: 3.14 self.image.createDeviceModel()