[virt-tools-list] [PATCH 2 of 5] addhardware: switch video devices to qxl when adding Spice

Marc-André Lureau marcandre.lureau at redhat.com
Wed Dec 22 09:56:06 UTC 2010


# HG changeset patch
# User Marc-André Lureau <marcandre.lureau at redhat.com>
# Date 1292959283 -3600
# Node ID 2b694c7d07ecd89cc00a5dc2556544677adb4bc8
# Parent  707b594a1ab7e80be1dc29c3c61be13c9e95c803
addhardware: switch video devices to qxl when adding Spice

diff -r 707b594a1ab7 -r 2b694c7d07ec src/virtManager/addhardware.py
--- a/src/virtManager/addhardware.py	Tue Dec 21 20:16:01 2010 +0100
+++ b/src/virtManager/addhardware.py	Tue Dec 21 20:21:23 2010 +0100
@@ -91,6 +91,8 @@
         self.host_storage_timer = None
 
         self._dev = None
+        # callbacks in add_device()
+        self._alter_cb = None
 
         self.window.signal_autoconnect({
             "on_create_cancel_clicked" : self.close,
@@ -929,6 +931,8 @@
 
         # Alter persistent config
         try:
+            if self._alter_cb is not None:
+                self._alter_cb()
             self.vm.add_device(self._dev)
         except Exception, e:
             self.err.show_err(_("Error adding device: %s" % str(e)),
@@ -1090,6 +1094,10 @@
 
         self._dev = dev
 
+    def _alter_spice_cb(self):
+        for d in self.vm.get_video_devices():
+            self.vm.define_video_model(d, "qxl")
+
     def validate_page_graphics(self):
         graphics = self.get_config_graphics()
         _type = {"vnc": virtinst.VirtualGraphics.TYPE_VNC,
@@ -1107,6 +1115,9 @@
         except ValueError, e:
             self.err.val_err(_("Graphics device parameter error"), str(e))
 
+        if graphics == "spice":
+            self._alter_cb = self._alter_spice_cb
+
     def validate_page_sound(self):
         smodel = self.get_config_sound_model()
         try:




More information about the virt-tools-list mailing list