Add `virsh migrate' option `--migratedisks' that allows CLI user to
explicitly specify block devices to migrate.
Signed-off-by: Pavel Boldin <pboldin(a)mirantis.com>
---
tools/virsh-domain.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 4b627e1..4f43a25 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -9793,6 +9793,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}
};
@@ -9852,6 +9856,45 @@ doMigrate(void *opaque)
VIR_MIGRATE_PARAM_DEST_NAME, opt) < 0)
goto save_error;
+ if (vshCommandOptStringReq(ctl, cmd, "migratedisks", &opt) < 0)
+ goto out;
+ if (opt) {
+ const char **val = NULL;
+ char *tok, *saveptr = NULL, *opt_copy = NULL, *optp;
+ size_t max = 0, n = 0;
+
+ if (VIR_STRDUP(opt_copy, opt) < 0)
+ goto save_error;
+
+ optp = opt_copy;
+ do {
+ tok = strtok_r(optp, ",", &saveptr);
+ optp = NULL;
+
+ if (VIR_RESIZE_N(val, max, n, 1) < 0) {
+ VIR_FREE(opt_copy);
+ VIR_FREE(val);
+ goto save_error;
+ }
+
+ val[n] = tok;
+ n++;
+ } while (tok != NULL);
+
+ if (virTypedParamsPackStrings(¶ms,
+ &nparams,
+ &maxparams,
+ VIR_MIGRATE_PARAM_MIGRATE_DISKS,
+ val) < 0) {
+ VIR_FREE(opt_copy);
+ VIR_FREE(val);
+ goto save_error;
+ }
+
+ VIR_FREE(opt_copy);
+ VIR_FREE(val);
+ }
+
if (vshCommandOptStringReq(ctl, cmd, "xml", &opt) < 0)
goto out;
if (opt) {
--
1.9.1