guest: Add an entry point for setting machine=q35 default

We will want this at some point, but it's dependent on libosinfo
work
This commit is contained in:
Cole Robinson 2018-09-12 14:49:10 -04:00
parent d60229825f
commit 2549e60698
2 changed files with 19 additions and 5 deletions

View File

@ -454,12 +454,9 @@ class Guest(XMLBuilder):
self.set_capabilities_defaults()
if not self.os.machine:
capsinfo = self.lookup_capsinfo()
default = capsinfo.machines and capsinfo.machines[0] or None
self.os.machine = default
self._set_default_machine()
self._set_default_uefi()
self._add_default_graphics()
self._add_default_video_device()
self._add_default_input_device()
@ -487,6 +484,20 @@ class Guest(XMLBuilder):
# Private xml routines #
########################
def _set_default_machine(self):
if self.os.machine:
return
if (self.os.is_x86() and
self.conn.is_qemu() and
self.osinfo.supports_chipset_q35()):
self.os.machine = "q35"
return
capsinfo = self.lookup_capsinfo()
default = capsinfo.machines and capsinfo.machines[0] or None
self.os.machine = default
def _set_default_uefi(self):
if (self.prefers_uefi() and
not self.os.kernel and

View File

@ -363,6 +363,9 @@ class _OsVariant(object):
# 2018-09-01: osinfo data is wrong for RHEL/centos here
return self._is_related_to("rhel6.0")
def supports_chipset_q35(self):
return False
def get_recommended_resources(self, guest):
ret = {}
if not self._os: