[libvirt] [PATCH v2 2/4] qemu: Implement new seamless attribute

Michal Privoznik mprivozn at redhat.com
Fri Sep 14 17:34:51 UTC 2012


This requires adding "seamless-migration='on|off'" to the
qemu command line. It is turned on by default (if not running
on ancient qemu that doesn't support this).
---
 src/qemu/qemu_capabilities.c |    3 +++
 src/qemu/qemu_capabilities.h |    1 +
 src/qemu/qemu_command.c      |   14 ++++++++++++++
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index af3b0b2..7514f04 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -177,6 +177,7 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
 
               "disable-s4", /* 105 */
               "usb-redir.filter",
+              "seamless-migration",
     );
 
 struct _qemuCaps {
@@ -1140,6 +1141,8 @@ qemuCapsComputeCmdFlags(const char *help,
     }
     if (strstr(help, "-spice"))
         qemuCapsSet(caps, QEMU_CAPS_SPICE);
+    if (strstr(help, "seamless-migration="))
+        qemuCapsSet(caps, QEMU_CAPS_SEAMLESS_MIGRATION);
     if (strstr(help, "boot=on"))
         qemuCapsSet(caps, QEMU_CAPS_DRIVE_BOOT);
     if (strstr(help, "serial=s"))
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index bbb07c9..d33cdd1 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -142,6 +142,7 @@ enum qemuCapsFlags {
     QEMU_CAPS_DISABLE_S3         = 104, /* S3 BIOS Advertisement on/off */
     QEMU_CAPS_DISABLE_S4         = 105, /* S4 BIOS Advertisement on/off */
     QEMU_CAPS_USB_REDIR_FILTER   = 106, /* usb-redir.filter */
+    QEMU_CAPS_SEAMLESS_MIGRATION = 107, /* seamless-migration for SPICE */
 
     QEMU_CAPS_LAST,                   /* this must always be the last item */
 };
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ec825bc..a9e54fb 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6069,6 +6069,20 @@ qemuBuildCommandLine(virConnectPtr conn,
         if (def->graphics[0]->data.spice.copypaste == VIR_DOMAIN_GRAPHICS_SPICE_CLIPBOARD_COPYPASTE_NO)
             virBufferAddLit(&opt, ",disable-copy-paste");
 
+        if (qemuCapsGet(caps, QEMU_CAPS_SEAMLESS_MIGRATION)) {
+            if (def->graphics[0]->data.spice.seamless ==
+                VIR_DOMAIN_GRAPHICS_SPICE_MIGRATION_SEAMLESS_OFF)
+                virBufferAddLit(&opt, ",seamless-migration=off");
+            else
+                virBufferAddLit(&opt, ",seamless-migration=on");
+        } else if (def->graphics[0]->data.spice.seamless ==
+                   VIR_DOMAIN_GRAPHICS_SPICE_MIGRATION_SEAMLESS_ON) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("SPICE seamless migration is not "
+                             "supported by this version of qemu"));
+            goto error;
+        }
+
         virCommandAddArg(cmd, "-spice");
         virCommandAddArgBuffer(cmd, &opt);
         if (def->graphics[0]->data.spice.keymap)
-- 
1.7.8.6




More information about the libvir-list mailing list