]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Add support for unsafe migration
authorJiri Denemark <jdenemar@redhat.com>
Mon, 20 Feb 2012 08:16:23 +0000 (09:16 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 22 Feb 2012 13:52:24 +0000 (14:52 +0100)
This patch adds VIR_MIGRATE_UNSAFE flag for migration APIs and new
VIR_ERR_MIGRATION_UNSAFE error code.  The error code should be returned
whenever migrating a domain is considered unsafe (e.g., it's configured
in a way that does not ensure data integrity once it is migrated).
VIR_MIGRATE_UNSAFE flag may be used to force migration even though it
would normally be considered unsafe and forbidden.

include/libvirt/libvirt.h.in
include/libvirt/virterror.h
src/libvirt.c
src/util/virterror.c

index 798ab071d313d81aae9a1707e29ffe9296c49785..e29df2a1d83db11357f321496480d5bb8b92fa10 100644 (file)
@@ -934,7 +934,7 @@ typedef enum {
     VIR_MIGRATE_CHANGE_PROTECTION = (1 << 8), /* protect for changing domain configuration through the
                                                * whole migration process; this will be used automatically
                                                * when supported */
-
+    VIR_MIGRATE_UNSAFE            = (1 << 9), /* force migration even if it is considered unsafe */
 } virDomainMigrateFlags;
 
 /* Domain migration. */
index 9dbadfe63f47a078dd35de404fe8bc7d09226acc..a3f9199abdbef531f469e6a9d1abda183c2b2759 100644 (file)
@@ -245,6 +245,7 @@ typedef enum {
                                            canceled/aborted by user */
     VIR_ERR_AUTH_CANCELLED = 79,        /* authentication cancelled */
     VIR_ERR_NO_DOMAIN_METADATA = 80,    /* The metadata is not present */
+    VIR_ERR_MIGRATE_UNSAFE = 81,        /* Migration is not safe */
 } virErrorNumber;
 
 /**
index 629419658a11206aa75f29ced7e466cb0b0eacde..a3bd4f48a7a7c73f01d660b000efc963cde10ebc 100644 (file)
@@ -5110,6 +5110,7 @@ virDomainMigrateDirect (virDomainPtr domain,
  *   VIR_MIGRATE_CHANGE_PROTECTION Protect against domain configuration
  *                                 changes during the migration process (set
  *                                 automatically when supported).
+ *   VIR_MIGRATE_UNSAFE    Force migration even if it is considered unsafe.
  *
  * VIR_MIGRATE_TUNNELLED requires that VIR_MIGRATE_PEER2PEER be set.
  * Applications using the VIR_MIGRATE_PEER2PEER flag will probably
@@ -5301,6 +5302,7 @@ error:
  *   VIR_MIGRATE_CHANGE_PROTECTION Protect against domain configuration
  *                                 changes during the migration process (set
  *                                 automatically when supported).
+ *   VIR_MIGRATE_UNSAFE    Force migration even if it is considered unsafe.
  *
  * VIR_MIGRATE_TUNNELLED requires that VIR_MIGRATE_PEER2PEER be set.
  * Applications using the VIR_MIGRATE_PEER2PEER flag will probably
@@ -5509,6 +5511,7 @@ error:
  *   VIR_MIGRATE_CHANGE_PROTECTION Protect against domain configuration
  *                                 changes during the migration process (set
  *                                 automatically when supported).
+ *   VIR_MIGRATE_UNSAFE    Force migration even if it is considered unsafe.
  *
  * The operation of this API hinges on the VIR_MIGRATE_PEER2PEER flag.
  * If the VIR_MIGRATE_PEER2PEER flag is NOT set, the duri parameter
@@ -5633,6 +5636,7 @@ error:
  *   VIR_MIGRATE_CHANGE_PROTECTION Protect against domain configuration
  *                                 changes during the migration process (set
  *                                 automatically when supported).
+ *   VIR_MIGRATE_UNSAFE    Force migration even if it is considered unsafe.
  *
  * The operation of this API hinges on the VIR_MIGRATE_PEER2PEER flag.
  *
index fb5ca6f821dd739f2ccaac568c60cc3ec5562b05..de6018527d3884c6e2823acfb790c15cbc46c540 100644 (file)
@@ -1232,6 +1232,12 @@ virErrorMsg(virErrorNumber error, const char *info)
             else
                 errmsg = _("metadata not found: %s");
             break;
+        case VIR_ERR_MIGRATE_UNSAFE:
+            if (!info)
+                errmsg = _("Unsafe migration");
+            else
+                errmsg = _("Unsafe migration: %s");
+            break;
     }
     return (errmsg);
 }