{"migrateuri", VSH_OT_DATA, 0, N_("migration URI, usually can be omitted")},
{"dname", VSH_OT_DATA, 0, N_("rename to new name during migration (if supported)")},
{"timeout", VSH_OT_INT, 0, N_("force guest to suspend if live migration exceeds timeout (in seconds)")},
+ {"xml", VSH_OT_STRING, 0, N_("filename containing updated XML for the target")},
{NULL, 0, 0, NULL}
};
const vshCmd *cmd = data->cmd;
#if HAVE_PTHREAD_SIGMASK
sigset_t sigmask, oldsigmask;
+ const char *xmlfile = NULL;
+ char *xml = NULL;
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGINT);
goto out;
}
+ if (vshCommandOptString(cmd, "xml", &xmlfile) < 0) {
+ vshError(ctl, "%s", _("malformed xml argument"));
+ goto out;
+ }
+
if (vshCommandOptBool (cmd, "live"))
flags |= VIR_MIGRATE_LIVE;
if (vshCommandOptBool (cmd, "p2p"))
if (vshCommandOptBool (cmd, "copy-storage-inc"))
flags |= VIR_MIGRATE_NON_SHARED_INC;
+
+ if (xmlfile &&
+ virFileReadAll(xmlfile, 8192, &xml) < 0)
+ goto out;
+
+
if ((flags & VIR_MIGRATE_PEER2PEER) ||
vshCommandOptBool (cmd, "direct")) {
/* For peer2peer migration or direct migration we only expect one URI
goto out;
}
- if (virDomainMigrateToURI (dom, desturi, flags, dname, 0) == 0)
+ if (virDomainMigrateToURI2(dom, desturi, NULL, xml, flags, dname, 0) == 0)
ret = '0';
} else {
/* For traditional live migration, connect to the destination host directly. */
dconn = virConnectOpenAuth (desturi, virConnectAuthPtrDefault, 0);
if (!dconn) goto out;
- ddom = virDomainMigrate (dom, dconn, flags, dname, migrateuri, 0);
+ ddom = virDomainMigrate2(dom, dconn, xml, flags, dname, migrateuri, 0);
if (ddom) {
virDomainFree(ddom);
ret = '0';
out_sig:
#endif
if (dom) virDomainFree (dom);
+ VIR_FREE(xml);
ignore_value(safewrite(data->writefd, &ret, sizeof(ret)));
}