File 1d37a4c4-libxl-detect-save-restore.patch of Package libvirt

commit 1d37a4c46ba520d9c82f81f1486aa7af61235773
Author: Jim Fehlig <jfehlig@suse.com>
Date:   Tue Jun 24 11:10:49 2014 -0600

    libxl: detect support for save and restore
    
    libxl does not support save, restore, or migrate on all architectures,
    notably ARM.  Detect whether libxl supports these operations using
    LIBXL_HAVE_NO_SUSPEND_RESUME.  If not supported, drop advertisement of
    <migration_features>.
    
    Found by Ian Campbell while improving Xen's OSSTEST infrastructure
    
    http://lists.xen.org/archives/html/xen-devel/2014-06/msg02171.html

Index: libvirt-1.2.5/src/libxl/libxl_conf.c
===================================================================
--- libvirt-1.2.5.orig/src/libxl/libxl_conf.c
+++ libvirt-1.2.5/src/libxl/libxl_conf.c
@@ -1338,7 +1338,11 @@ libxlMakeCapabilities(libxl_ctx *ctx)
 {
     virCapsPtr caps;
 
+#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
+    if ((caps = virCapabilitiesNew(virArchFromHost(), 0, 0)) == NULL)
+#else
     if ((caps = virCapabilitiesNew(virArchFromHost(), 1, 1)) == NULL)
+#endif
         return NULL;
 
     if (libxlCapsInitHost(ctx, caps) < 0)
Index: libvirt-1.2.5/src/libxl/libxl_driver.c
===================================================================
--- libvirt-1.2.5.orig/src/libxl/libxl_driver.c
+++ libvirt-1.2.5/src/libxl/libxl_driver.c
@@ -1381,6 +1381,11 @@ libxlDomainSaveFlags(virDomainPtr dom, c
     int ret = -1;
     bool remove_dom = false;
 
+#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
+    virReportUnsupportedError();
+    return -1;
+#endif
+
     virCheckFlags(0, -1);
     if (dxml) {
         virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
@@ -1442,6 +1447,11 @@ libxlDomainRestoreFlags(virConnectPtr co
     int fd = -1;
     int ret = -1;
 
+#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
+    virReportUnsupportedError();
+    return -1;
+#endif
+
     virCheckFlags(VIR_DOMAIN_SAVE_PAUSED, -1);
     if (dxml) {
         virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
@@ -4354,6 +4364,11 @@ libxlDomainMigrateBegin3Params(virDomain
     const char *xmlin = NULL;
     virDomainObjPtr vm = NULL;
 
+#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
+    virReportUnsupportedError();
+    return NULL;
+#endif
+
     virCheckFlags(LIBXL_MIGRATION_FLAGS, NULL);
     if (virTypedParamsValidate(params, nparams, LIBXL_MIGRATION_PARAMETERS) < 0)
         return NULL;
@@ -4398,6 +4413,11 @@ libxlDomainMigratePrepare3Params(virConn
     const char *dname = NULL;
     const char *uri_in = NULL;
 
+#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
+    virReportUnsupportedError();
+    return -1;
+#endif
+
     virCheckFlags(LIBXL_MIGRATION_FLAGS, -1);
     if (virTypedParamsValidate(params, nparams, LIBXL_MIGRATION_PARAMETERS) < 0)
         goto error;
@@ -4448,6 +4468,11 @@ libxlDomainMigratePerform3Params(virDoma
     const char *uri = NULL;
     int ret = -1;
 
+#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
+    virReportUnsupportedError();
+    return -1;
+#endif
+
     virCheckFlags(LIBXL_MIGRATION_FLAGS, -1);
     if (virTypedParamsValidate(params, nparams, LIBXL_MIGRATION_PARAMETERS) < 0)
         goto cleanup;
@@ -4500,6 +4525,11 @@ libxlDomainMigrateFinish3Params(virConne
     virDomainObjPtr vm = NULL;
     const char *dname = NULL;
 
+#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
+    virReportUnsupportedError();
+    return NULL;
+#endif
+
     virCheckFlags(LIBXL_MIGRATION_FLAGS, NULL);
     if (virTypedParamsValidate(params, nparams, LIBXL_MIGRATION_PARAMETERS) < 0)
         return NULL;
@@ -4548,6 +4578,11 @@ libxlDomainMigrateConfirm3Params(virDoma
     libxlDriverPrivatePtr driver = domain->conn->privateData;
     virDomainObjPtr vm = NULL;
 
+#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
+    virReportUnsupportedError();
+    return -1;
+#endif
+
     virCheckFlags(LIBXL_MIGRATION_FLAGS, -1);
     if (virTypedParamsValidate(params, nparams, LIBXL_MIGRATION_PARAMETERS) < 0)
         return -1;