From: Shaju Abraham <shaju.abraham(a)nutanix.com>
In order to support the local migration, the migration framework
should distinguish between local and non local migrations. Add a flag
to the 'virsh migrate' command so that framework can easily identify
a local migration attempt.
Signed-off-by: Shaju Abraham <shaju.abraham(a)nutanix.com>
---
include/libvirt/libvirt-domain.h | 6 ++++++
tools/virsh-domain.c | 7 +++++++
2 files changed, 13 insertions(+)
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 5846e93d98..018635b4f1 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -849,6 +849,12 @@ typedef enum {
*/
VIR_MIGRATE_PARALLEL = (1 << 17),
+ /* Setting the VIR_MIGRATE_LOCAL flag tells libvirt that the migration
+ * is within the host and bypass checks which refuses local host migration.It
+ * indicates that the same UUID and name will be used for different domains.
+ */
+ VIR_MIGRATE_LOCAL = (1 << 18),
+
} virDomainMigrateFlags;
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index e64e08e5da..b91117a6a2 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -10421,6 +10421,10 @@ static const vshCmdOptDef opts_migrate[] = {
.type = VSH_OT_BOOL,
.help = N_("peer-2-peer migration")
},
+ {.name = "local",
+ .type = VSH_OT_BOOL,
+ .help = N_("local migration")
+ },
{.name = "direct",
.type = VSH_OT_BOOL,
.help = N_("direct migration")
@@ -10820,6 +10824,9 @@ doMigrate(void *opaque)
flags |= VIR_MIGRATE_LIVE;
if (vshCommandOptBool(cmd, "p2p"))
flags |= VIR_MIGRATE_PEER2PEER;
+
+ if (vshCommandOptBool(cmd, "local"))
+ flags |= VIR_MIGRATE_LOCAL;
if (vshCommandOptBool(cmd, "tunnelled"))
flags |= VIR_MIGRATE_TUNNELLED;
--
2.24.1