[libvirt] [PATCH v2 1/4] Add support for unsafe migration

Jiri Denemark jdenemar at redhat.com
Wed Feb 22 14:51:08 UTC 2012


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.
---
Notes:
    Version 2:
    - no change

 include/libvirt/libvirt.h.in |    2 +-
 include/libvirt/virterror.h  |    1 +
 src/libvirt.c                |    4 ++++
 src/util/virterror.c         |    6 ++++++
 4 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 798ab07..e29df2a 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -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. */
diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h
index 9dbadfe..a3f9199 100644
--- a/include/libvirt/virterror.h
+++ b/include/libvirt/virterror.h
@@ -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;
 
 /**
diff --git a/src/libvirt.c b/src/libvirt.c
index 6294196..a3bd4f4 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -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.
  *
diff --git a/src/util/virterror.c b/src/util/virterror.c
index fb5ca6f..de60185 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -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);
 }
-- 
1.7.8.4




More information about the libvir-list mailing list