osdict: Move default_videomodel to guest

It's not really osdict specific
This commit is contained in:
Cole Robinson 2018-09-01 11:26:23 -04:00
parent 717cd87b16
commit b902fbd54f
2 changed files with 14 additions and 19 deletions

View File

@ -1209,16 +1209,26 @@ class Guest(XMLBuilder):
return True
return False
def _default_videomodel(self):
if self.os.is_pseries():
return "vga"
if self.os.is_arm_machvirt():
return "virtio"
if self.has_spice() and self.os.is_x86():
if self.has_gl():
return "virtio"
return "qxl"
if self._os_object.is_windows():
return "vga"
return None
def _set_video_defaults(self):
if self.has_spice():
self._add_spice_channels()
self._add_spice_sound()
self._add_spice_usbredir()
video_model = self._os_object.default_videomodel(self)
if self.os.is_arm_machvirt():
video_model = "virtio"
video_model = self._default_videomodel()
for video in self.devices.video:
if video.model == video.MODEL_DEFAULT:
video.model = video_model

View File

@ -361,21 +361,6 @@ class _OsVariant(object):
def supports_virtiorng(self):
return bool(self._device_filter(cls="rng", name="virtio-rng"))
def default_videomodel(self, guest):
if guest.os.is_pseries():
return "vga"
if guest.has_spice() and guest.os.is_x86():
if guest.has_gl():
return "virtio"
else:
return "qxl"
if self.is_windows():
return "vga"
return None
def get_recommended_resources(self, guest):
ret = {}
if not self._os: