create: Fix default qemu-ga setup (bz 1016613)

We were adding default devices before setting the OS value, which qemu_ga
setup depends on.
This commit is contained in:
Cole Robinson 2013-11-09 18:33:49 -05:00
parent eb33bd34e7
commit 8dcb65bd50
2 changed files with 12 additions and 12 deletions

View File

@ -1470,7 +1470,7 @@ class vmmCreate(vmmGObjectUI):
guest.default_graphics_type = self.config.get_graphics_type()
return virtinst.VirtualGraphics(guest.conn)
def build_guest(self):
def build_guest(self, variant):
guest = self.conn.caps.build_virtinst_guest(
self.conn.get_backend(), self.capsguest, self.capsdomain)
guest.os.machine = self.get_config_machine()
@ -1482,6 +1482,14 @@ class vmmCreate(vmmGObjectUI):
self.err.show_err(_("Error setting UUID: %s") % str(e))
return None
# OS distro/variant validation
try:
if variant:
guest.os_variant = variant
except ValueError, e:
self.err.show_err(_("Error setting OS information."), e)
return None
# Set up default devices
try:
gdev = self.get_graphics_device(guest)
@ -1523,7 +1531,7 @@ class vmmCreate(vmmGObjectUI):
# detction. But the 'real' self.guest is created in validate_install,
# and it just uses build_guest, so don't ever add any other guest
# altering here.
self.guest = self.build_guest()
self.guest = self.build_guest(None)
if not self.guest:
return False
return True
@ -1613,7 +1621,7 @@ class vmmCreate(vmmGObjectUI):
try:
# Overwrite the guest
installer = instclass(self.conn.get_backend())
self.guest = self.build_guest()
self.guest = self.build_guest(variant or distro)
if not self.guest:
return False
self.guest.installer = installer
@ -1649,14 +1657,6 @@ class vmmCreate(vmmGObjectUI):
return self.err.val_err(
_("Error setting install media location."), e)
# OS distro/variant validation
try:
variant = variant or distro
if variant:
self.guest.os_variant = variant
except ValueError, e:
return self.err.val_err(_("Error setting OS information."), e)
# Setting kernel
if instmethod == INSTALL_PAGE_IMPORT:
kernel = self.widget("config-kernel").get_text() or None

View File

@ -191,7 +191,7 @@ class Guest(XMLBuilder):
def _get_os_variant(self):
return self._os_variant
def _set_os_variant(self, val):
logging.debug("Guest.os_variant set to %s", val)
logging.debug("Setting Guest.os_variant to '%s'", val)
val = val.lower()
if osdict.lookup_os(val) is None:
raise ValueError(_("Distro '%s' does not exist in our dictionary")