[virt-tools-list] [PATCH 10/12] virtinst/cli: add spice rendernode argument

marcandre.lureau at redhat.com marcandre.lureau at redhat.com
Tue Feb 21 13:01:00 UTC 2017


From: Marc-André Lureau <marcandre.lureau at redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
 man/virt-install.pod                                     | 4 ++++
 tests/cli-test-xml/compare/virt-install-many-devices.xml | 5 +++++
 tests/clitest.py                                         | 1 +
 tests/xmlparse-xml/change-graphics-out.xml               | 2 +-
 tests/xmlparse.py                                        | 1 +
 virtinst/cli.py                                          | 7 +++++++
 virtinst/devicegraphics.py                               | 1 +
 virtinst/support.py                                      | 2 ++
 8 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/man/virt-install.pod b/man/virt-install.pod
index 27524f88..7f3b52c5 100644
--- a/man/virt-install.pod
+++ b/man/virt-install.pod
@@ -1010,6 +1010,10 @@ is used by 'vnc' and 'spice'
 Whether to use OpenGl accelerated rendering. Value is 'yes' or 'no'. This is
 used by 'spice'.
 
+=item B<rendernode>
+
+DRM render node path to use. This is used when 'gl' is enabled.
+
 =back
 
 Use --graphics=? to see a list of all available sub options. Complete details at L<http://libvirt.org/formatdomain.html#elementsGraphics>
diff --git a/tests/cli-test-xml/compare/virt-install-many-devices.xml b/tests/cli-test-xml/compare/virt-install-many-devices.xml
index 45010e0e..345dd270 100644
--- a/tests/cli-test-xml/compare/virt-install-many-devices.xml
+++ b/tests/cli-test-xml/compare/virt-install-many-devices.xml
@@ -246,6 +246,11 @@
       <image compression="off"/>
       <listen type="none"/>
     </graphics>
+    <graphics type="spice">
+      <gl enable="yes" rendernode="/dev/dri/foo"/>
+      <image compression="off"/>
+      <listen type="none"/>
+    </graphics>
     <serial type="tcp">
       <source mode="bind" host="127.0.0.1" service="2222"/>
       <protocol type="telnet"/>
diff --git a/tests/clitest.py b/tests/clitest.py
index 7b4e259d..c70d0d97 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -485,6 +485,7 @@ c.add_compare(""" \
 --graphics spice,image_compression=foo,streaming_mode=bar,clipboard_copypaste=yes,mouse_mode=client,filetransfer_enable=on \
 --graphics spice,gl=yes,listen=socket \
 --graphics spice,gl=yes,listen=none \
+--graphics spice,gl=yes,listen=none,rendernode=/dev/dri/foo \
 \
 --controller usb,model=ich9-ehci1,address=0:0:4.7,index=0 \
 --controller usb,model=ich9-uhci1,address=0:0:4.0,index=0,master=0 \
diff --git a/tests/xmlparse-xml/change-graphics-out.xml b/tests/xmlparse-xml/change-graphics-out.xml
index 0c084587..72cc136e 100644
--- a/tests/xmlparse-xml/change-graphics-out.xml
+++ b/tests/xmlparse-xml/change-graphics-out.xml
@@ -39,7 +39,7 @@
       <channel name="cursor" mode="any"/>
       <channel name="playback" mode="insecure"/>
       <channel name="display" mode="secure"/>
-      <gl enable="yes"/>
+      <gl enable="yes" rendernode="/dev/dri/foo"/>
       <image compression="auto_glz"/>
       <streaming mode="filter"/>
       <clipboard copypaste="yes"/>
diff --git a/tests/xmlparse.py b/tests/xmlparse.py
index 9697fbf8..5c8ab0be 100644
--- a/tests/xmlparse.py
+++ b/tests/xmlparse.py
@@ -651,6 +651,7 @@ class XMLParseTest(unittest.TestCase):
         check("mouse_mode", None, "client")
         check("filetransfer_enable", None, False)
         check("gl", None, True)
+        check("rendernode", None, "/dev/dri/foo")
 
         self._alter_compare(guest.get_xml_config(), outfile)
 
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 94ba5cbb..423d8723 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -2183,6 +2183,12 @@ class ParserGraphics(VirtCLIParser):
             elif not inst.conn.check_support(
                     inst.conn.SUPPORT_CONN_SPICE_GL):
                 logging.warn("qemu/libvirt version may not support spice GL")
+        if inst.conn.is_qemu() and inst.rendernode:
+            if inst.type != "spice":
+                logging.warn("graphics type=%s does not support rendernode", inst.type)
+            elif not inst.conn.check_support(
+                    inst.conn.SUPPORT_CONN_SPICE_RENDERNODE):
+                logging.warn("qemu/libvirt version may not support rendernode")
 
         return ret
 
@@ -2206,6 +2212,7 @@ ParserGraphics.add_arg("mouse_mode", "mouse_mode")
 ParserGraphics.add_arg("filetransfer_enable", "filetransfer_enable",
             is_onoff=True)
 ParserGraphics.add_arg("gl", "gl", is_onoff=True)
+ParserGraphics.add_arg("rendernode", "rendernode")
 
 
 ########################
diff --git a/virtinst/devicegraphics.py b/virtinst/devicegraphics.py
index 3741e9d7..ac69df5e 100644
--- a/virtinst/devicegraphics.py
+++ b/virtinst/devicegraphics.py
@@ -249,5 +249,6 @@ class VirtualGraphics(VirtualDevice):
     mouse_mode = XMLProperty("./mouse/@mode")
     filetransfer_enable = XMLProperty("./filetransfer/@enable", is_yesno=True)
     gl = XMLProperty("./gl/@enable", is_yesno=True)
+    rendernode = XMLProperty("./gl/@rendernode")
 
 VirtualGraphics.register_type()
diff --git a/virtinst/support.py b/virtinst/support.py
index 5a62cc8b..a35dec7a 100644
--- a/virtinst/support.py
+++ b/virtinst/support.py
@@ -313,6 +313,8 @@ SUPPORT_CONN_MEM_STATS_PERIOD = _make(
     version="1.1.1", hv_version={"qemu": 0})
 SUPPORT_CONN_SPICE_GL = _make(version="3.1.0",
     hv_version={"qemu": "2.6.0", "test": 0})
+SUPPORT_CONN_SPICE_RENDERNODE = _make(version="3.1.0",
+    hv_version={"qemu": "2.9.0", "test": 0})
 SUPPORT_CONN_VIDEO_VIRTIO_ACCEL3D = _make(version="1.3.0",
     hv_version={"qemu": "2.5.0", "test": 0})
 SUPPORT_CONN_GRAPHICS_LISTEN_NONE = _make(version="2.0.0")
-- 
2.11.0.295.gd7dffce1c.dirty




More information about the virt-tools-list mailing list