[XEND] Accomodate extra "devices" in SXP that do not have DevControllers

Signed-off-by: Alastair Tse <atse@xensource.com>
This commit is contained in:
Alastair Tse committed 2006-11-17 17:57:49 +00:00
1 parent 13dde37355
commit edd64e7966
3 files changed
+14 -6

No files matched your search

+6 -4
View File
@@ -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
+5
View File
@@ -48,6 +48,11 @@ class XendDevices:
return cls.controllers.keys()
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.
+3 -2
View File
@@ -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()
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.