mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-12 09:18:00 +03:00
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:
parent
eb33bd34e7
commit
8dcb65bd50
@ -1470,7 +1470,7 @@ class vmmCreate(vmmGObjectUI):
|
|||||||
guest.default_graphics_type = self.config.get_graphics_type()
|
guest.default_graphics_type = self.config.get_graphics_type()
|
||||||
return virtinst.VirtualGraphics(guest.conn)
|
return virtinst.VirtualGraphics(guest.conn)
|
||||||
|
|
||||||
def build_guest(self):
|
def build_guest(self, variant):
|
||||||
guest = self.conn.caps.build_virtinst_guest(
|
guest = self.conn.caps.build_virtinst_guest(
|
||||||
self.conn.get_backend(), self.capsguest, self.capsdomain)
|
self.conn.get_backend(), self.capsguest, self.capsdomain)
|
||||||
guest.os.machine = self.get_config_machine()
|
guest.os.machine = self.get_config_machine()
|
||||||
@ -1482,6 +1482,14 @@ class vmmCreate(vmmGObjectUI):
|
|||||||
self.err.show_err(_("Error setting UUID: %s") % str(e))
|
self.err.show_err(_("Error setting UUID: %s") % str(e))
|
||||||
return None
|
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
|
# Set up default devices
|
||||||
try:
|
try:
|
||||||
gdev = self.get_graphics_device(guest)
|
gdev = self.get_graphics_device(guest)
|
||||||
@ -1523,7 +1531,7 @@ class vmmCreate(vmmGObjectUI):
|
|||||||
# detction. But the 'real' self.guest is created in validate_install,
|
# 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
|
# and it just uses build_guest, so don't ever add any other guest
|
||||||
# altering here.
|
# altering here.
|
||||||
self.guest = self.build_guest()
|
self.guest = self.build_guest(None)
|
||||||
if not self.guest:
|
if not self.guest:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
@ -1613,7 +1621,7 @@ class vmmCreate(vmmGObjectUI):
|
|||||||
try:
|
try:
|
||||||
# Overwrite the guest
|
# Overwrite the guest
|
||||||
installer = instclass(self.conn.get_backend())
|
installer = instclass(self.conn.get_backend())
|
||||||
self.guest = self.build_guest()
|
self.guest = self.build_guest(variant or distro)
|
||||||
if not self.guest:
|
if not self.guest:
|
||||||
return False
|
return False
|
||||||
self.guest.installer = installer
|
self.guest.installer = installer
|
||||||
@ -1649,14 +1657,6 @@ class vmmCreate(vmmGObjectUI):
|
|||||||
return self.err.val_err(
|
return self.err.val_err(
|
||||||
_("Error setting install media location."), e)
|
_("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
|
# Setting kernel
|
||||||
if instmethod == INSTALL_PAGE_IMPORT:
|
if instmethod == INSTALL_PAGE_IMPORT:
|
||||||
kernel = self.widget("config-kernel").get_text() or None
|
kernel = self.widget("config-kernel").get_text() or None
|
||||||
|
@ -191,7 +191,7 @@ class Guest(XMLBuilder):
|
|||||||
def _get_os_variant(self):
|
def _get_os_variant(self):
|
||||||
return self._os_variant
|
return self._os_variant
|
||||||
def _set_os_variant(self, val):
|
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()
|
val = val.lower()
|
||||||
if osdict.lookup_os(val) is None:
|
if osdict.lookup_os(val) is None:
|
||||||
raise ValueError(_("Distro '%s' does not exist in our dictionary")
|
raise ValueError(_("Distro '%s' does not exist in our dictionary")
|
||||||
|
Loading…
Reference in New Issue
Block a user