[libvirt] [PATCH v3 9/9] virsh: selective block device migration

Michal Privoznik mprivozn at redhat.com
Tue May 26 13:01:51 UTC 2015

From: Pavel Boldin <pboldin at mirantis.com>

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>
Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
 tools/virsh-domain.c | 23 +++++++++++++++++++++++
 tools/virsh.pod      | 21 ++++++++++++---------
 2 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 91a1ca2..41d3829 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -9889,6 +9889,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}
@@ -9948,6 +9952,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 d588e5a..9275091 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<disk-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,15 +1537,17 @@ 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
-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
-support.  I<--verbose> displays the progress of migration.  I<--compressed>
-activates compression of memory pages that have to be transferred repeatedly
-during live migration. I<--abort-on-error> cancels the migration if a soft
-error (for example I/O error) happens during the migration. I<--auto-converge>
-forces convergence during live migration.
+host. By default only non-shared non-readonly images are transfered. Use
+I<--migratedisks> to explicitly specify a list of disk targets to transfer.
+B<disk-list> is a comma separated list then.  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 support.  I<--verbose> displays the progress
+of migration.  I<--compressed> activates compression of memory pages that have
+to be transferred repeatedly during live migration. I<--abort-on-error> cancels
+the migration if a soft error (for example I/O error) happens during the
+migration. I<--auto-converge> forces convergence during live migration.
 B<Note>: Individual hypervisors usually do not support all possible types of
 migration. For example, QEMU does not support direct migration.

More information about the libvir-list mailing list