[virt-tools-list] [PATCH 6 of 6] addhardware: switch video to qxl when adding a Spice 'device'

Marc-André Lureau marcandre.lureau at redhat.com
Fri Dec 17 13:51:27 UTC 2010


# HG changeset patch
# User Marc-André Lureau <marcandre.lureau at redhat.com>
# Date 1292272735 -3600
# Node ID e317718f7c235c3c69bd3377948ec81f5db6a1bd
# Parent  36976fe992df8ebdbe52fca392feb6a284ae3e1c
addhardware: switch video to qxl when adding a Spice 'device'

diff -r 36976fe992df -r e317718f7c23 src/virtManager/addhardware.py
--- a/src/virtManager/addhardware.py	Wed Dec 01 17:42:45 2010 +0100
+++ b/src/virtManager/addhardware.py	Mon Dec 13 21:38:55 2010 +0100
@@ -88,6 +88,10 @@
 
         self._dev = None
 
+        # callbacks in add_device()
+        self._hotplug = None
+        self._alter = None
+
         self.topwin.hide()
         self.window.signal_autoconnect({
             "on_create_pages_switch_page" : self.page_changed,
@@ -1052,6 +1056,8 @@
         # Hotplug device
         attach_err = False
         try:
+            if self._hotplug is not None:
+                self._hotplug()
             self.vm.attach_device(self._dev)
         except Exception, e:
             logging.debug("Device could not be hotplugged: %s" % str(e))
@@ -1068,6 +1074,8 @@
 
         # Alter persistent config
         try:
+            if self._alter is not None:
+                self._alter()
             self.vm.add_device(self._dev)
         except Exception, e:
             self.err.show_err(_("Error adding device: %s" % str(e)),
@@ -1250,6 +1258,10 @@
 
         self._dev = dev
 
+    def _alter_spice(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,
@@ -1267,6 +1279,9 @@
         except ValueError, e:
             self.err.val_err(_("Graphics device parameter error"), str(e))
 
+        if graphics == "spice":
+            self._alter = self._alter_spice
+
     def validate_page_sound(self):
         smodel = self.get_config_sound_model()
         try:




More information about the virt-tools-list mailing list