[virt-tools-list] [PATCH 1/3] add new "spice-disable-usbredir" option to disable autoredir feature

Guannan Ren gren at redhat.com
Sat Jun 29 05:08:09 UTC 2013


The value is stored in gsettings. By default, we use spice autoredir
feature for usb redirection.
---
 data/org.virt-manager.virt-manager.gschema.xml | 6 ++++++
 virt-manager                                   | 5 +++++
 virtManager/config.py                          | 5 +++++
 3 files changed, 16 insertions(+)

diff --git a/data/org.virt-manager.virt-manager.gschema.xml b/data/org.virt-manager.virt-manager.gschema.xml
index d086a64..c56db56 100644
--- a/data/org.virt-manager.virt-manager.gschema.xml
+++ b/data/org.virt-manager.virt-manager.gschema.xml
@@ -160,6 +160,12 @@
       <summary>Grab keyboard sequence for the graphical console</summary>
       <description>Grab keyboard sequence for the graphical console</description>
     </key>
+
+    <key name="auto-redirect" type="b">
+      <default>true</default>
+      <summary>Enable SPICE Auto USB redirection in console window</summary>
+      <description>Whether to enable SPICE Auto USB redirection while connected to the guest console.</description>
+    </key>
   </schema>
 
   <schema id="org.virt-manager.virt-manager.details"
diff --git a/virt-manager b/virt-manager
index 5b237a6..ab4f998 100755
--- a/virt-manager
+++ b/virt-manager
@@ -145,6 +145,8 @@ def parse_commandline():
         help="Show domain graphical console window")
     optParser.add_option("--show-host-summary", action="callback",
        callback=opt_show_cb, help="Show connection details window")
+    optParser.add_option("--spice-disable-usbredir", action="store_true",
+                        dest="usbredir", help="Disable USB redirection support")
 
     return optParser.parse_args()
 
@@ -260,6 +262,9 @@ def main():
     config.askpass_package = cliconfig.askpass_package
     config.default_graphics_from_config = cliconfig.default_graphics
 
+    if options.usbredir and config.get_auto_redirection():
+        config.set_auto_redirection(False)
+
     # Add our icon dir to icon theme
     icon_theme = Gtk.IconTheme.get_default()
     icon_theme.prepend_search_path(cliconfig.icon_dir)
diff --git a/virtManager/config.py b/virtManager/config.py
index 19e030c..7c63567 100644
--- a/virtManager/config.py
+++ b/virtManager/config.py
@@ -371,6 +371,11 @@ class vmmConfig(object):
     def set_console_scaling(self, pref):
         self.conf.set("/console/scaling", pref)
 
+    def get_auto_redirection(self):
+        return self.conf.get("/console/auto-redirect")
+    def set_auto_redirection(self, state):
+        self.conf.set("/console/auto-redirect", state)
+
     # Show VM details toolbar
     def get_details_show_toolbar(self):
         res = self.conf.get("/details/show-toolbar")
-- 
1.8.1.4




More information about the virt-tools-list mailing list