[libvirt] [PATCH v2 6/6] virsh: selective block device migration

Pavel Boldin pboldin at mirantis.com
Thu May 21 11:07:35 UTC 2015


Add `virsh migrate' option `--migratedisks' that allows CLI user to
explicitly specify block devices to migrate.

Signed-off-by: Pavel Boldin <pboldin at mirantis.com>
---
 tools/virsh-domain.c | 23 +++++++++++++++++++++++
 tools/virsh.pod      |  5 ++++-
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 20f8c75..47a24ab 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -9784,6 +9784,10 @@ static const vshCmdOptDef opts_migrate[] = {
      .type = VSH_OT_STRING,
      .help = N_("filename containing updated XML for the target")
     },
+    {.name = "migratedisks",
+     .type = VSH_OT_STRING,
+     .help = N_("comma separated list of disks to be migrated")
+    },
     {.name = NULL}
 };
 
@@ -9843,6 +9847,25 @@ doMigrate(void *opaque)
                                 VIR_MIGRATE_PARAM_DEST_NAME, opt) < 0)
         goto save_error;
 
+    if (vshCommandOptStringReq(ctl, cmd, "migratedisks", &opt) < 0)
+        goto out;
+    if (opt) {
+        char **val = NULL;
+
+        val = virStringSplit(opt, ",", 0);
+
+        if (virTypedParamsAddStringList(&params,
+                                        &nparams,
+                                        &maxparams,
+                                        VIR_MIGRATE_PARAM_MIGRATE_DISKS,
+                                        (const char **)val) < 0) {
+            VIR_FREE(val);
+            goto save_error;
+        }
+
+        VIR_FREE(val);
+    }
+
     if (vshCommandOptStringReq(ctl, cmd, "xml", &opt) < 0)
         goto out;
     if (opt) {
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 1bb655b..aad0f3b 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -1521,6 +1521,7 @@ to the I<uri> namespace is displayed instead of being modified.
 [I<--compressed>] [I<--abort-on-error>] [I<--auto-converge>]
 I<domain> I<desturi> [I<migrateuri>] [I<graphicsuri>] [I<listen-address>]
 [I<dname>] [I<--timeout> B<seconds>] [I<--xml> B<file>]
+[I<--migratedisks> B<comma-separated-list>]
 
 Migrate domain to another host.  Add I<--live> for live migration; <--p2p>
 for peer-2-peer migration; I<--direct> for direct migration; or I<--tunnelled>
@@ -1536,7 +1537,9 @@ with incremental copy (same base image shared between source and destination).
 In both cases the disk images have to exist on destination host, the
 I<--copy-storage-...> options only tell libvirt to transfer data from the
 images on source host to the images found at the same place on the destination
-host. I<--change-protection> enforces that no incompatible configuration
+host. By default only non-shared non-readonly images are transfered. Use
+I<--migratedisks> to explicitly specify a list of images to transfer.
+I<--change-protection> enforces that no incompatible configuration
 changes will be made to the domain while the migration is underway; this flag
 is implicitly enabled when supported by the hypervisor, but can be explicitly
 used to reject the migration if the hypervisor lacks change protection
-- 
1.9.1




More information about the libvir-list mailing list