[virt-tools-list] [virt-manager] [PATCH 2/2] guest: Query availability of spicevmc channels in domcaps

Lin Ma lma at suse.com
Fri Nov 4 04:11:45 UTC 2022


Signed-off-by: Lin Ma <lma at suse.com>
---
 virtinst/domcapabilities.py | 7 +++++++
 virtinst/guest.py           | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py
index cb5fddbb..ab0bf2ab 100644
--- a/virtinst/domcapabilities.py
+++ b/virtinst/domcapabilities.py
@@ -114,6 +114,7 @@ class _Devices(_CapsBlock):
     tpm = XMLChildProperty(_make_capsblock("tpm"), is_single=True)
     filesystem = XMLChildProperty(_make_capsblock("filesystem"), is_single=True)
     redirdev = XMLChildProperty(_make_capsblock("redirdev"), is_single=True)
+    channel = XMLChildProperty(_make_capsblock("channel"), is_single=True)
 
 
 class _Features(_CapsBlock):
@@ -449,6 +450,12 @@ class DomainCapabilities(XMLBuilder):
 
         return self.devices.graphics.get_enum("type").has_value("spice")
 
+    def supports_channel_spicevmc(self):
+        """
+        Return True if libvirt advertises support for spice channel
+        """
+        return self.devices.channel.get_enum("type").has_value("spicevmc")
+
     def supports_redirdev_usb(self):
         """
         Return True if libvirt advertises support for USB redirect
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 1d1e2ee9..c2244ae3 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -1127,6 +1127,8 @@ class Guest(XMLBuilder):
             self.add_device(ctrl)
 
     def _add_spice_channels(self):
+        if not self.lookup_domcaps().supports_channel_spicevmc():
+            return
         if self.skip_default_channel:
             return
         for chn in self.devices.channel:
-- 
2.37.3



More information about the virt-tools-list mailing list