domain: Factor out a vmmDomainBase class

This will be used to implement a virtinst Guest backed domain, to allow
customizing a VM before install.

Also make some small changes to how we add and remove devices.
This commit is contained in:
Cole Robinson 2010-02-07 12:10:41 -05:00
parent e6ea45aa8e
commit d99c04b02a
3 changed files with 1131 additions and 1012 deletions

View File

@ -1045,13 +1045,13 @@ class vmmAddHardware(gobject.GObject):
# Encountered an error
return (True, ret)
xml = self._dev.get_xml_config()
logging.debug("Adding device:\n" + xml)
self._dev.get_xml_config()
logging.debug("Adding device:\n" + self._dev.get_xml_config())
# Hotplug device
attach_err = False
try:
self.vm.attach_device(xml)
self.vm.attach_device(self._dev)
except Exception, e:
logging.debug("Device could not be hotplugged: %s" % str(e))
attach_err = True
@ -1067,7 +1067,7 @@ class vmmAddHardware(gobject.GObject):
# Alter persistent config
try:
self.vm.add_device(xml)
self.vm.add_device(self._dev)
except Exception, e:
self.err.show_err(_("Error adding device: %s" % str(e)),
"".join(traceback.format_exc()))

View File

@ -1177,8 +1177,7 @@ class vmmDetails(gobject.GObject):
detach_err = False
try:
if self.vm.is_active():
devxml = self.vm.get_device_xml(dev_type, dev_id_info)
self.vm.detach_device(devxml)
self.vm.detach_device(dev_type, dev_id_info)
except Exception, e:
logging.debug("Device could not be hotUNplugged: %s" % str(e))
detach_err = True

File diff suppressed because it is too large Load Diff