mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-08-28 05:49:35 +03:00
graphics: Check domcaps for whether spice is available
This has been reported for the libvirt qemu driver since v1.3.5, released June 2016. But we need to keep some fallback logic for the test driver, and to keep the testsuite happy Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
@ -32,9 +32,15 @@
|
||||
<source mode="bind"/>
|
||||
<target type="virtio" name="org.qemu.guest_agent.0"/>
|
||||
</channel>
|
||||
<channel type="spicevmc">
|
||||
<target type="virtio" name="com.redhat.spice.0"/>
|
||||
</channel>
|
||||
<input type="tablet" bus="usb"/>
|
||||
<input type="keyboard" bus="usb"/>
|
||||
<graphics type="vnc" port="-1"/>
|
||||
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
|
||||
<image compression="off"/>
|
||||
</graphics>
|
||||
<sound model="ich6"/>
|
||||
<video>
|
||||
<model type="vga"/>
|
||||
</video>
|
||||
|
@ -129,14 +129,6 @@ class DeviceGraphics(Device):
|
||||
# Default config #
|
||||
##################
|
||||
|
||||
def _spice_supported(self):
|
||||
if not self.conn.is_qemu() and not self.conn.is_test():
|
||||
return False
|
||||
# Spice has issues on some host arches, like ppc, so allow it
|
||||
if self.conn.caps.host.cpu.arch not in ["i686", "x86_64"]:
|
||||
return False
|
||||
return True
|
||||
|
||||
def _listen_need_port(self):
|
||||
listen = self.get_first_listen_type()
|
||||
return not listen or listen in ["address", "network"]
|
||||
@ -163,7 +155,8 @@ class DeviceGraphics(Device):
|
||||
def _default_type(self, guest):
|
||||
gtype = guest.default_graphics_type
|
||||
log.debug("Using default_graphics=%s", gtype)
|
||||
if gtype == "spice" and not self._spice_supported():
|
||||
if (gtype == "spice" and
|
||||
not guest.lookup_domcaps().supports_graphics_spice()):
|
||||
log.debug("spice requested but HV doesn't support it. "
|
||||
"Using vnc.")
|
||||
gtype = "vnc"
|
||||
|
@ -100,6 +100,7 @@ class _Devices(_CapsBlock):
|
||||
hostdev = XMLChildProperty(_make_capsblock("hostdev"), is_single=True)
|
||||
disk = XMLChildProperty(_make_capsblock("disk"), is_single=True)
|
||||
video = XMLChildProperty(_make_capsblock("video"), is_single=True)
|
||||
graphics = XMLChildProperty(_make_capsblock("graphics"), is_single=True)
|
||||
|
||||
|
||||
class _Features(_CapsBlock):
|
||||
@ -350,6 +351,18 @@ class DomainCapabilities(XMLBuilder):
|
||||
models = self.devices.video.get_enum("modelType").get_values()
|
||||
return bool("bochs" in models)
|
||||
|
||||
def supports_graphics_spice(self):
|
||||
if not self.devices.graphics.supported:
|
||||
# domcaps is too old, or the driver doesn't advertise graphics
|
||||
# support. Use our pre-existing logic
|
||||
if not self.conn.is_qemu() and not self.conn.is_test():
|
||||
return False
|
||||
return self.conn.caps.host.cpu.arch in ["i686", "x86_64"]
|
||||
|
||||
types = self.devices.graphics.get_enum("type").get_values()
|
||||
return bool("spice" in types)
|
||||
|
||||
|
||||
XML_NAME = "domainCapabilities"
|
||||
os = XMLChildProperty(_OS, is_single=True)
|
||||
cpu = XMLChildProperty(_CPU, is_single=True)
|
||||
|
Reference in New Issue
Block a user