# HG changeset patch
# User Alastair Tse <atse@xxxxxxxxxxxxx>
# Node ID f1d2860c51370f7a89c5b8b6b7941b8975928349
# Parent 516821812322fe0290794f499bd758a47af4c3e5
[XEND] Accomodate extra "devices" in SXP that do not have DevControllers
Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx>
---
tools/python/xen/xend/XendConfig.py | 10 ++++++----
tools/python/xen/xend/XendDevices.py | 5 +++++
tools/python/xen/xend/XendDomainInfo.py | 5 +++--
3 files changed, 14 insertions(+), 6 deletions(-)
diff -r 516821812322 -r f1d2860c5137 tools/python/xen/xend/XendConfig.py
--- a/tools/python/xen/xend/XendConfig.py Fri Nov 17 17:03:59 2006 +0000
+++ b/tools/python/xen/xend/XendConfig.py Fri Nov 17 17:57:49 2006 +0000
@@ -780,7 +780,8 @@ class XendConfig(dict):
# Verify devices
for d_uuid, (d_type, d_info) in self['device'].items():
- if d_type not in XendDevices.valid_devices():
+ if d_type not in XendDevices.valid_devices() and \
+ d_type not in XendDevices.pseudo_devices():
raise XendConfigError('Invalid device (%s)' % d_type)
# Verify restart modes
@@ -798,7 +799,8 @@ class XendConfig(dict):
self['vtpm_refs'] = []
def device_add(self, dev_type, cfg_sxp = None, cfg_xenapi = None):
- if dev_type not in XendDevices.valid_devices():
+ if dev_type not in XendDevices.valid_devices() and \
+ dev_type not in XendDevices.pseudo_devices():
raise XendConfigError("XendConfig: %s not a valid device type" %
dev_type)
@@ -917,8 +919,8 @@ class XendConfig(dict):
if dev_type == 'pci': # special case for pci devices
pci_devs.append(dev_info)
else:
- sxpr = self.device_sxpr(dev_type = dev_type,
- dev_info = dev_info)
+ sxpr = self.device_sxpr(dev_type = dev_type,
+ dev_info = dev_info)
sxprs.append((dev_type, sxpr))
# if we have any pci_devs, we parse them differently into
diff -r 516821812322 -r f1d2860c5137 tools/python/xen/xend/XendDevices.py
--- a/tools/python/xen/xend/XendDevices.py Fri Nov 17 17:03:59 2006 +0000
+++ b/tools/python/xen/xend/XendDevices.py Fri Nov 17 17:57:49 2006 +0000
@@ -49,6 +49,11 @@ class XendDevices:
valid_devices = classmethod(valid_devices)
#@classmethod
+ def pseudo_devices(cls):
+ return ['console']
+ pseudo_devices = classmethod(pseudo_devices)
+
+ #@classmethod
def make_controller(cls, name, domain):
"""Factory function to make device controllers per domain.
diff -r 516821812322 -r f1d2860c5137 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Fri Nov 17 17:03:59 2006 +0000
+++ b/tools/python/xen/xend/XendDomainInfo.py Fri Nov 17 17:57:49 2006 +0000
@@ -1119,8 +1119,9 @@ class XendDomainInfo:
@raise: VmError for invalid devices
"""
for (devclass, config) in self.info.all_devices_sxpr():
- log.info("createDevice: %s : %s" % (devclass, config))
- self._createDevice(devclass, config)
+ if devclass in XendDevices.valid_devices():
+ log.info("createDevice: %s : %s" % (devclass, config))
+ self._createDevice(devclass, config)
if self.image:
self.image.createDeviceModel()
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|