It is very difficult while reading the migration code trying to
understand whether a particular function is being called on the src side
or the dst side, or either. Putting "Src" or "Dst" in the method names
will
make this much more obvious. "Any" is used in a few helpers which can be
called from both sides.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/qemu/qemu_driver.c | 152 ++++++++---------
src/qemu/qemu_migration.c | 424 +++++++++++++++++++++++-----------------------
src/qemu/qemu_migration.h | 158 ++++++++---------
3 files changed, 367 insertions(+), 367 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5a374e69ec..47186d4e2e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3342,7 +3342,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver,
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto cleanup;
- if (!qemuMigrationIsAllowed(driver, vm, false, 0))
+ if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0))
goto cleanup;
if (qemuDomainObjBeginAsyncJob(driver, vm, QEMU_ASYNC_JOB_SAVE,
@@ -3897,7 +3897,7 @@ doCoreDump(virQEMUDriverPtr driver,
goto cleanup;
}
- if (!qemuMigrationIsAllowed(driver, vm, false, 0))
+ if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0))
goto cleanup;
ret = qemuMigrationToFile(driver, vm, fd, compressedpath,
@@ -12113,15 +12113,15 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
goto cleanup;
}
- if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname, &origname)))
+ if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
goto cleanup;
if (virDomainMigratePrepareTunnelEnsureACL(dconn, def) < 0)
goto cleanup;
- ret = qemuMigrationPrepareTunnel(driver,
- NULL, 0, NULL, NULL, /* No cookies in v2 */
- st, &def, origname, flags);
+ ret = qemuMigrationDstPrepareTunnel(driver,
+ NULL, 0, NULL, NULL, /* No cookies in v2 */
+ st, &def, origname, flags);
cleanup:
VIR_FREE(origname);
@@ -12172,7 +12172,7 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
goto cleanup;
}
- if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname, &origname)))
+ if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
goto cleanup;
if (virDomainMigratePrepare2EnsureACL(dconn, def) < 0)
@@ -12182,11 +12182,11 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
* length was not sufficiently large, causing failures
* migrating between old & new libvirtd
*/
- ret = qemuMigrationPrepareDirect(driver,
- NULL, 0, NULL, NULL, /* No cookies */
- uri_in, uri_out,
- &def, origname, NULL, 0, NULL, 0,
- compression, flags);
+ ret = qemuMigrationDstPrepareDirect(driver,
+ NULL, 0, NULL, NULL, /* No cookies */
+ uri_in, uri_out,
+ &def, origname, NULL, 0, NULL, 0,
+ compression, flags);
cleanup:
VIR_FREE(compression);
@@ -12244,11 +12244,11 @@ qemuDomainMigratePerform(virDomainPtr dom,
*
* Consume any cookie we were able to decode though
*/
- ret = qemuMigrationPerform(driver, dom->conn, vm, NULL,
- NULL, dconnuri, uri, NULL, NULL, 0, NULL, 0,
- compression, &migParams, cookie, cookielen,
- NULL, NULL, /* No output cookies in v2 */
- flags, dname, resource, false);
+ ret = qemuMigrationSrcPerform(driver, dom->conn, vm, NULL,
+ NULL, dconnuri, uri, NULL, NULL, 0, NULL, 0,
+ compression, &migParams, cookie, cookielen,
+ NULL, NULL, /* No output cookies in v2 */
+ flags, dname, resource, false);
cleanup:
qemuMigrationParamsClear(&migParams);
@@ -12290,9 +12290,9 @@ qemuDomainMigrateFinish2(virConnectPtr dconn,
* length was not sufficiently large, causing failures
* migrating between old & new libvirtd
*/
- dom = qemuMigrationFinish(driver, dconn, vm,
- NULL, 0, NULL, NULL, /* No cookies */
- flags, retcode, false);
+ dom = qemuMigrationDstFinish(driver, dconn, vm,
+ NULL, 0, NULL, NULL, /* No cookies */
+ flags, retcode, false);
cleanup:
return dom;
@@ -12324,8 +12324,8 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
return NULL;
}
- return qemuMigrationBegin(domain->conn, vm, xmlin, dname,
- cookieout, cookieoutlen, 0, NULL, flags);
+ return qemuMigrationSrcBegin(domain->conn, vm, xmlin, dname,
+ cookieout, cookieoutlen, 0, NULL, flags);
}
static char *
@@ -12370,9 +12370,9 @@ qemuDomainMigrateBegin3Params(virDomainPtr domain,
goto cleanup;
}
- ret = qemuMigrationBegin(domain->conn, vm, xmlin, dname,
- cookieout, cookieoutlen,
- nmigrate_disks, migrate_disks, flags);
+ ret = qemuMigrationSrcBegin(domain->conn, vm, xmlin, dname,
+ cookieout, cookieoutlen,
+ nmigrate_disks, migrate_disks, flags);
cleanup:
VIR_FREE(migrate_disks);
@@ -12414,18 +12414,18 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
if (!(compression = qemuMigrationCompressionParse(NULL, 0, flags)))
goto cleanup;
- if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname, &origname)))
+ if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
goto cleanup;
if (virDomainMigratePrepare3EnsureACL(dconn, def) < 0)
goto cleanup;
- ret = qemuMigrationPrepareDirect(driver,
- cookiein, cookieinlen,
- cookieout, cookieoutlen,
- uri_in, uri_out,
- &def, origname, NULL, 0, NULL, 0,
- compression, flags);
+ ret = qemuMigrationDstPrepareDirect(driver,
+ cookiein, cookieinlen,
+ cookieout, cookieoutlen,
+ uri_in, uri_out,
+ &def, origname, NULL, 0, NULL, 0,
+ compression, flags);
cleanup:
VIR_FREE(compression);
@@ -12500,19 +12500,19 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
goto cleanup;
}
- if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname, &origname)))
+ if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
goto cleanup;
if (virDomainMigratePrepare3ParamsEnsureACL(dconn, def) < 0)
goto cleanup;
- ret = qemuMigrationPrepareDirect(driver,
- cookiein, cookieinlen,
- cookieout, cookieoutlen,
- uri_in, uri_out,
- &def, origname, listenAddress,
- nmigrate_disks, migrate_disks, nbdPort,
- compression, flags);
+ ret = qemuMigrationDstPrepareDirect(driver,
+ cookiein, cookieinlen,
+ cookieout, cookieoutlen,
+ uri_in, uri_out,
+ &def, origname, listenAddress,
+ nmigrate_disks, migrate_disks, nbdPort,
+ compression, flags);
cleanup:
VIR_FREE(compression);
@@ -12549,16 +12549,16 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
goto cleanup;
}
- if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname, &origname)))
+ if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
goto cleanup;
if (virDomainMigratePrepareTunnel3EnsureACL(dconn, def) < 0)
goto cleanup;
- ret = qemuMigrationPrepareTunnel(driver,
- cookiein, cookieinlen,
- cookieout, cookieoutlen,
- st, &def, origname, flags);
+ ret = qemuMigrationDstPrepareTunnel(driver,
+ cookiein, cookieinlen,
+ cookieout, cookieoutlen,
+ st, &def, origname, flags);
cleanup:
VIR_FREE(origname);
@@ -12602,16 +12602,16 @@ qemuDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
goto cleanup;
}
- if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname, &origname)))
+ if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
goto cleanup;
if (virDomainMigratePrepareTunnel3ParamsEnsureACL(dconn, def) < 0)
goto cleanup;
- ret = qemuMigrationPrepareTunnel(driver,
- cookiein, cookieinlen,
- cookieout, cookieoutlen,
- st, &def, origname, flags);
+ ret = qemuMigrationDstPrepareTunnel(driver,
+ cookiein, cookieinlen,
+ cookieout, cookieoutlen,
+ st, &def, origname, flags);
cleanup:
VIR_FREE(origname);
@@ -12652,12 +12652,12 @@ qemuDomainMigratePerform3(virDomainPtr dom,
goto cleanup;
}
- ret = qemuMigrationPerform(driver, dom->conn, vm, xmlin, NULL,
- dconnuri, uri, NULL, NULL, 0, NULL, 0,
- compression, &migParams,
- cookiein, cookieinlen,
- cookieout, cookieoutlen,
- flags, dname, resource, true);
+ ret = qemuMigrationSrcPerform(driver, dom->conn, vm, xmlin, NULL,
+ dconnuri, uri, NULL, NULL, 0, NULL, 0,
+ compression, &migParams,
+ cookiein, cookieinlen,
+ cookieout, cookieoutlen,
+ flags, dname, resource, true);
cleanup:
qemuMigrationParamsClear(&migParams);
@@ -12743,12 +12743,12 @@ qemuDomainMigratePerform3Params(virDomainPtr dom,
goto cleanup;
}
- ret = qemuMigrationPerform(driver, dom->conn, vm, dom_xml, persist_xml,
- dconnuri, uri, graphicsuri, listenAddress,
- nmigrate_disks, migrate_disks, nbdPort,
- compression, migParams,
- cookiein, cookieinlen, cookieout, cookieoutlen,
- flags, dname, bandwidth, true);
+ ret = qemuMigrationSrcPerform(driver, dom->conn, vm, dom_xml, persist_xml,
+ dconnuri, uri, graphicsuri, listenAddress,
+ nmigrate_disks, migrate_disks, nbdPort,
+ compression, migParams,
+ cookiein, cookieinlen, cookieout, cookieoutlen,
+ flags, dname, bandwidth, true);
cleanup:
VIR_FREE(compression);
qemuMigrationParamsFree(&migParams);
@@ -12792,10 +12792,10 @@ qemuDomainMigrateFinish3(virConnectPtr dconn,
return NULL;
}
- return qemuMigrationFinish(driver, dconn, vm,
- cookiein, cookieinlen,
- cookieout, cookieoutlen,
- flags, cancelled, true);
+ return qemuMigrationDstFinish(driver, dconn, vm,
+ cookiein, cookieinlen,
+ cookieout, cookieoutlen,
+ flags, cancelled, true);
}
static virDomainPtr
@@ -12840,10 +12840,10 @@ qemuDomainMigrateFinish3Params(virConnectPtr dconn,
return NULL;
}
- return qemuMigrationFinish(driver, dconn, vm,
- cookiein, cookieinlen,
- cookieout, cookieoutlen,
- flags, cancelled, true);
+ return qemuMigrationDstFinish(driver, dconn, vm,
+ cookiein, cookieinlen,
+ cookieout, cookieoutlen,
+ flags, cancelled, true);
}
@@ -12866,8 +12866,8 @@ qemuDomainMigrateConfirm3(virDomainPtr domain,
return -1;
}
- return qemuMigrationConfirm(domain->conn->privateData, vm, cookiein,
cookieinlen,
- flags, cancelled);
+ return qemuMigrationSrcConfirm(domain->conn->privateData, vm, cookiein,
cookieinlen,
+ flags, cancelled);
}
static int
@@ -12894,8 +12894,8 @@ qemuDomainMigrateConfirm3Params(virDomainPtr domain,
return -1;
}
- return qemuMigrationConfirm(domain->conn->privateData, vm, cookiein,
cookieinlen,
- flags, cancelled);
+ return qemuMigrationSrcConfirm(domain->conn->privateData, vm, cookiein,
cookieinlen,
+ flags, cancelled);
}
@@ -13989,7 +13989,7 @@ qemuDomainSnapshotCreateActiveInternal(virQEMUDriverPtr driver,
bool resume = false;
int ret = -1;
- if (!qemuMigrationIsAllowed(driver, vm, false, 0))
+ if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0))
goto cleanup;
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
@@ -14922,7 +14922,7 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver,
/* do the memory snapshot if necessary */
if (memory) {
/* check if migration is possible */
- if (!qemuMigrationIsAllowed(driver, vm, false, 0))
+ if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0))
goto cleanup;
/* allow the migration job to be cancelled or the domain to be paused */
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 29247d6a39..f99a20b9ab 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1054,14 +1054,14 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver,
/**
- * qemuMigrationIsAllowedHostdev:
+ * qemuMigrationSrcIsAllowedHostdev:
* @def: domain definition
*
* Checks that @def does not contain any host devices unsupported accross
* migrations. Returns true if the vm is allowed to migrate.
*/
static bool
-qemuMigrationIsAllowedHostdev(const virDomainDef *def)
+qemuMigrationSrcIsAllowedHostdev(const virDomainDef *def)
{
size_t i;
@@ -1082,7 +1082,7 @@ qemuMigrationIsAllowedHostdev(const virDomainDef *def)
/**
- * qemuMigrationIsAllowed:
+ * qemuMigrationSrcIsAllowed:
* @driver: qemu driver struct
* @vm: domain object
* @remote: migration is remote
@@ -1096,10 +1096,10 @@ qemuMigrationIsAllowedHostdev(const virDomainDef *def)
* false otherwise.
*/
bool
-qemuMigrationIsAllowed(virQEMUDriverPtr driver,
- virDomainObjPtr vm,
- bool remote,
- unsigned int flags)
+qemuMigrationSrcIsAllowed(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ bool remote,
+ unsigned int flags)
{
int nsnapshots;
int pauseReason;
@@ -1145,7 +1145,7 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver,
return false;
}
- if (!qemuMigrationIsAllowedHostdev(vm->def))
+ if (!qemuMigrationSrcIsAllowedHostdev(vm->def))
return false;
if (vm->def->cpu) {
@@ -1994,15 +1994,15 @@ qemuMigrationCleanup(virDomainObjPtr vm,
/* The caller is supposed to lock the vm and start a migration job. */
static char *
-qemuMigrationBeginPhase(virQEMUDriverPtr driver,
- virDomainObjPtr vm,
- const char *xmlin,
- const char *dname,
- char **cookieout,
- int *cookieoutlen,
- size_t nmigrate_disks,
- const char **migrate_disks,
- unsigned long flags)
+qemuMigrationSrcBeginPhase(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ const char *xmlin,
+ const char *dname,
+ char **cookieout,
+ int *cookieoutlen,
+ size_t nmigrate_disks,
+ const char **migrate_disks,
+ unsigned long flags)
{
char *rv = NULL;
qemuMigrationCookiePtr mig = NULL;
@@ -2028,7 +2028,7 @@ qemuMigrationBeginPhase(virQEMUDriverPtr driver,
if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT)
qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_BEGIN3);
- if (!qemuMigrationIsAllowed(driver, vm, true, flags))
+ if (!qemuMigrationSrcIsAllowed(driver, vm, true, flags))
goto cleanup;
if (!(flags & (VIR_MIGRATE_UNSAFE | VIR_MIGRATE_OFFLINE)) &&
@@ -2164,15 +2164,15 @@ qemuMigrationBeginPhase(virQEMUDriverPtr driver,
}
char *
-qemuMigrationBegin(virConnectPtr conn,
- virDomainObjPtr vm,
- const char *xmlin,
- const char *dname,
- char **cookieout,
- int *cookieoutlen,
- size_t nmigrate_disks,
- const char **migrate_disks,
- unsigned long flags)
+qemuMigrationSrcBegin(virConnectPtr conn,
+ virDomainObjPtr vm,
+ const char *xmlin,
+ const char *dname,
+ char **cookieout,
+ int *cookieoutlen,
+ size_t nmigrate_disks,
+ const char **migrate_disks,
+ unsigned long flags)
{
virQEMUDriverPtr driver = conn->privateData;
virQEMUDriverConfigPtr cfg = NULL;
@@ -2204,9 +2204,9 @@ qemuMigrationBegin(virConnectPtr conn,
qemuProcessRefreshDisks(driver, vm, asyncJob) < 0)
goto endjob;
- if (!(xml = qemuMigrationBeginPhase(driver, vm, xmlin, dname,
- cookieout, cookieoutlen,
- nmigrate_disks, migrate_disks, flags)))
+ if (!(xml = qemuMigrationSrcBeginPhase(driver, vm, xmlin, dname,
+ cookieout, cookieoutlen,
+ nmigrate_disks, migrate_disks, flags)))
goto endjob;
if (flags & VIR_MIGRATE_TLS) {
@@ -2248,8 +2248,8 @@ qemuMigrationBegin(virConnectPtr conn,
*/
static void
-qemuMigrationPrepareCleanup(virQEMUDriverPtr driver,
- virDomainObjPtr vm)
+qemuMigrationDstPrepareCleanup(virQEMUDriverPtr driver,
+ virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -2268,12 +2268,12 @@ qemuMigrationPrepareCleanup(virQEMUDriverPtr driver,
}
static qemuProcessIncomingDefPtr
-qemuMigrationPrepareIncoming(virDomainObjPtr vm,
- bool tunnel,
- const char *protocol,
- const char *listenAddress,
- unsigned short port,
- int fd)
+qemuMigrationDstPrepareIncoming(virDomainObjPtr vm,
+ bool tunnel,
+ const char *protocol,
+ const char *listenAddress,
+ unsigned short port,
+ int fd)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
qemuProcessIncomingDefPtr inc = NULL;
@@ -2580,23 +2580,23 @@ qemuMigrationResetTLS(virQEMUDriverPtr driver,
static int
-qemuMigrationPrepareAny(virQEMUDriverPtr driver,
- const char *cookiein,
- int cookieinlen,
- char **cookieout,
- int *cookieoutlen,
- virDomainDefPtr *def,
- const char *origname,
- virStreamPtr st,
- const char *protocol,
- unsigned short port,
- bool autoPort,
- const char *listenAddress,
- size_t nmigrate_disks,
- const char **migrate_disks,
- int nbdPort,
- qemuMigrationCompressionPtr compression,
- unsigned long flags)
+qemuMigrationDstPrepareAny(virQEMUDriverPtr driver,
+ const char *cookiein,
+ int cookieinlen,
+ char **cookieout,
+ int *cookieoutlen,
+ virDomainDefPtr *def,
+ const char *origname,
+ virStreamPtr st,
+ const char *protocol,
+ unsigned short port,
+ bool autoPort,
+ const char *listenAddress,
+ size_t nmigrate_disks,
+ const char **migrate_disks,
+ int nbdPort,
+ qemuMigrationCompressionPtr compression,
+ unsigned long flags)
{
virDomainObjPtr vm = NULL;
virObjectEventPtr event = NULL;
@@ -2664,7 +2664,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto cleanup;
- if (!qemuMigrationIsAllowedHostdev(*def))
+ if (!qemuMigrationSrcIsAllowedHostdev(*def))
goto cleanup;
/* Let migration hook filter domain XML */
@@ -2779,9 +2779,9 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
priv->allowReboot = mig->allowReboot;
- if (!(incoming = qemuMigrationPrepareIncoming(vm, tunnel, protocol,
- listenAddress, port,
- dataFD[0])))
+ if (!(incoming = qemuMigrationDstPrepareIncoming(vm, tunnel, protocol,
+ listenAddress, port,
+ dataFD[0])))
goto stopjob;
if (qemuProcessPrepareDomain(driver, vm, startFlags) < 0)
@@ -2897,7 +2897,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
VIR_WARN("Unable to encode migration cookie");
}
- if (qemuDomainCleanupAdd(vm, qemuMigrationPrepareCleanup) < 0)
+ if (qemuDomainCleanupAdd(vm, qemuMigrationDstPrepareCleanup) < 0)
goto stopjob;
if (!(flags & VIR_MIGRATE_OFFLINE)) {
@@ -2973,15 +2973,15 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
* sets up the corresponding virStream to handle the incoming data.
*/
int
-qemuMigrationPrepareTunnel(virQEMUDriverPtr driver,
- const char *cookiein,
- int cookieinlen,
- char **cookieout,
- int *cookieoutlen,
- virStreamPtr st,
- virDomainDefPtr *def,
- const char *origname,
- unsigned long flags)
+qemuMigrationDstPrepareTunnel(virQEMUDriverPtr driver,
+ const char *cookiein,
+ int cookieinlen,
+ char **cookieout,
+ int *cookieoutlen,
+ virStreamPtr st,
+ virDomainDefPtr *def,
+ const char *origname,
+ unsigned long flags)
{
qemuMigrationCompressionPtr compression = NULL;
int ret;
@@ -3001,10 +3001,10 @@ qemuMigrationPrepareTunnel(virQEMUDriverPtr driver,
if (!(compression = qemuMigrationCompressionParse(NULL, 0, flags)))
return -1;
- ret = qemuMigrationPrepareAny(driver, cookiein, cookieinlen,
- cookieout, cookieoutlen, def, origname,
- st, NULL, 0, false, NULL, 0, NULL, 0,
- compression, flags);
+ ret = qemuMigrationDstPrepareAny(driver, cookiein, cookieinlen,
+ cookieout, cookieoutlen, def, origname,
+ st, NULL, 0, false, NULL, 0, NULL, 0,
+ compression, flags);
VIR_FREE(compression);
return ret;
}
@@ -3034,21 +3034,21 @@ qemuMigrationParseURI(const char *uri, bool *wellFormed)
int
-qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
- const char *cookiein,
- int cookieinlen,
- char **cookieout,
- int *cookieoutlen,
- const char *uri_in,
- char **uri_out,
- virDomainDefPtr *def,
- const char *origname,
- const char *listenAddress,
- size_t nmigrate_disks,
- const char **migrate_disks,
- int nbdPort,
- qemuMigrationCompressionPtr compression,
- unsigned long flags)
+qemuMigrationDstPrepareDirect(virQEMUDriverPtr driver,
+ const char *cookiein,
+ int cookieinlen,
+ char **cookieout,
+ int *cookieoutlen,
+ const char *uri_in,
+ char **uri_out,
+ virDomainDefPtr *def,
+ const char *origname,
+ const char *listenAddress,
+ size_t nmigrate_disks,
+ const char **migrate_disks,
+ int nbdPort,
+ qemuMigrationCompressionPtr compression,
+ unsigned long flags)
{
unsigned short port = 0;
bool autoPort = true;
@@ -3166,12 +3166,12 @@ qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
if (*uri_out)
VIR_DEBUG("Generated uri_out=%s", *uri_out);
- ret = qemuMigrationPrepareAny(driver, cookiein, cookieinlen,
- cookieout, cookieoutlen, def, origname,
- NULL, uri ? uri->scheme : "tcp",
- port, autoPort, listenAddress,
- nmigrate_disks, migrate_disks, nbdPort,
- compression, flags);
+ ret = qemuMigrationDstPrepareAny(driver, cookiein, cookieinlen,
+ cookieout, cookieoutlen, def, origname,
+ NULL, uri ? uri->scheme : "tcp",
+ port, autoPort, listenAddress,
+ nmigrate_disks, migrate_disks, nbdPort,
+ compression, flags);
cleanup:
virURIFree(uri);
VIR_FREE(hostname);
@@ -3186,10 +3186,10 @@ qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
virDomainDefPtr
-qemuMigrationPrepareDef(virQEMUDriverPtr driver,
- const char *dom_xml,
- const char *dname,
- char **origname)
+qemuMigrationAnyPrepareDef(virQEMUDriverPtr driver,
+ const char *dom_xml,
+ const char *dname,
+ char **origname)
{
virCapsPtr caps = NULL;
virDomainDefPtr def;
@@ -3228,12 +3228,12 @@ qemuMigrationPrepareDef(virQEMUDriverPtr driver,
static int
-qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
- virDomainObjPtr vm,
- const char *cookiein,
- int cookieinlen,
- unsigned int flags,
- int retcode)
+qemuMigrationSrcConfirmPhase(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ const char *cookiein,
+ int cookieinlen,
+ unsigned int flags,
+ int retcode)
{
qemuMigrationCookiePtr mig;
virObjectEventPtr event;
@@ -3342,12 +3342,12 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
}
int
-qemuMigrationConfirm(virQEMUDriverPtr driver,
- virDomainObjPtr vm,
- const char *cookiein,
- int cookieinlen,
- unsigned int flags,
- int cancelled)
+qemuMigrationSrcConfirm(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ const char *cookiein,
+ int cookieinlen,
+ unsigned int flags,
+ int cancelled)
{
qemuMigrationJobPhase phase;
virQEMUDriverConfigPtr cfg = NULL;
@@ -3367,7 +3367,7 @@ qemuMigrationConfirm(virQEMUDriverPtr driver,
virCloseCallbacksUnset(driver->closeCallbacks, vm,
qemuMigrationCleanup);
- ret = qemuMigrationConfirmPhase(driver, vm,
+ ret = qemuMigrationSrcConfirmPhase(driver, vm,
cookiein, cookieinlen,
flags, cancelled);
@@ -3753,8 +3753,8 @@ qemuMigrationRun(virQEMUDriverPtr driver,
if (flags & VIR_MIGRATE_PERSIST_DEST) {
if (persist_xml) {
- if (!(persistDef = qemuMigrationPrepareDef(driver, persist_xml,
- NULL, NULL)))
+ if (!(persistDef = qemuMigrationAnyPrepareDef(driver, persist_xml,
+ NULL, NULL)))
goto error;
} else {
virDomainDefPtr def = vm->newDef ? vm->newDef : vm->def;
@@ -4430,9 +4430,9 @@ doPeer2PeerMigrate3(virQEMUDriverPtr driver,
* bit here, because we are already running inside the context of
* a single job. */
- dom_xml = qemuMigrationBeginPhase(driver, vm, xmlin, dname,
- &cookieout, &cookieoutlen,
- nmigrate_disks, migrate_disks, flags);
+ dom_xml = qemuMigrationSrcBeginPhase(driver, vm, xmlin, dname,
+ &cookieout, &cookieoutlen,
+ nmigrate_disks, migrate_disks, flags);
if (!dom_xml)
goto cleanup;
@@ -4682,9 +4682,9 @@ doPeer2PeerMigrate3(virQEMUDriverPtr driver,
cookieinlen = cookieoutlen;
cookieout = NULL;
cookieoutlen = 0;
- ret = qemuMigrationConfirmPhase(driver, vm,
- cookiein, cookieinlen,
- flags, cancelled);
+ ret = qemuMigrationSrcConfirmPhase(driver, vm,
+ cookiein, cookieinlen,
+ flags, cancelled);
/* If Confirm3 returns -1, there's nothing more we can
* do, but fortunately worst case is that there is a
* domain left in 'paused' state on source.
@@ -4904,28 +4904,28 @@ static int doPeer2PeerMigrate(virQEMUDriverPtr driver,
* perform phase of v2 non-peer2peer migration.
*/
static int
-qemuMigrationPerformJob(virQEMUDriverPtr driver,
- virConnectPtr conn,
- virDomainObjPtr vm,
- const char *xmlin,
- const char *persist_xml,
- const char *dconnuri,
- const char *uri,
- const char *graphicsuri,
- const char *listenAddress,
- size_t nmigrate_disks,
- const char **migrate_disks,
- int nbdPort,
- qemuMigrationCompressionPtr compression,
- qemuMonitorMigrationParamsPtr migParams,
- const char *cookiein,
- int cookieinlen,
- char **cookieout,
- int *cookieoutlen,
- unsigned long flags,
- const char *dname,
- unsigned long resource,
- bool v3proto)
+qemuMigrationSrcPerformJob(virQEMUDriverPtr driver,
+ virConnectPtr conn,
+ virDomainObjPtr vm,
+ const char *xmlin,
+ const char *persist_xml,
+ const char *dconnuri,
+ const char *uri,
+ const char *graphicsuri,
+ const char *listenAddress,
+ size_t nmigrate_disks,
+ const char **migrate_disks,
+ int nbdPort,
+ qemuMigrationCompressionPtr compression,
+ qemuMonitorMigrationParamsPtr migParams,
+ const char *cookiein,
+ int cookieinlen,
+ char **cookieout,
+ int *cookieoutlen,
+ unsigned long flags,
+ const char *dname,
+ unsigned long resource,
+ bool v3proto)
{
virObjectEventPtr event = NULL;
int ret = -1;
@@ -4941,7 +4941,7 @@ qemuMigrationPerformJob(virQEMUDriverPtr driver,
goto endjob;
}
- if (!qemuMigrationIsAllowed(driver, vm, true, flags))
+ if (!qemuMigrationSrcIsAllowed(driver, vm, true, flags))
goto endjob;
if (!(flags & (VIR_MIGRATE_UNSAFE | VIR_MIGRATE_OFFLINE)) &&
@@ -5021,22 +5021,22 @@ qemuMigrationPerformJob(virQEMUDriverPtr driver,
* This implements perform phase of v3 migration protocol.
*/
static int
-qemuMigrationPerformPhase(virQEMUDriverPtr driver,
- virConnectPtr conn,
- virDomainObjPtr vm,
- const char *persist_xml,
- const char *uri,
- const char *graphicsuri,
- size_t nmigrate_disks,
- const char **migrate_disks,
- qemuMigrationCompressionPtr compression,
- qemuMonitorMigrationParamsPtr migParams,
- const char *cookiein,
- int cookieinlen,
- char **cookieout,
- int *cookieoutlen,
- unsigned long flags,
- unsigned long resource)
+qemuMigrationSrcPerformPhase(virQEMUDriverPtr driver,
+ virConnectPtr conn,
+ virDomainObjPtr vm,
+ const char *persist_xml,
+ const char *uri,
+ const char *graphicsuri,
+ size_t nmigrate_disks,
+ const char **migrate_disks,
+ qemuMigrationCompressionPtr compression,
+ qemuMonitorMigrationParamsPtr migParams,
+ const char *cookiein,
+ int cookieinlen,
+ char **cookieout,
+ int *cookieoutlen,
+ unsigned long flags,
+ unsigned long resource)
{
virObjectEventPtr event = NULL;
int ret = -1;
@@ -5091,28 +5091,28 @@ qemuMigrationPerformPhase(virQEMUDriverPtr driver,
}
int
-qemuMigrationPerform(virQEMUDriverPtr driver,
- virConnectPtr conn,
- virDomainObjPtr vm,
- const char *xmlin,
- const char *persist_xml,
- const char *dconnuri,
- const char *uri,
- const char *graphicsuri,
- const char *listenAddress,
- size_t nmigrate_disks,
- const char **migrate_disks,
- int nbdPort,
- qemuMigrationCompressionPtr compression,
- qemuMonitorMigrationParamsPtr migParams,
- const char *cookiein,
- int cookieinlen,
- char **cookieout,
- int *cookieoutlen,
- unsigned long flags,
- const char *dname,
- unsigned long resource,
- bool v3proto)
+qemuMigrationSrcPerform(virQEMUDriverPtr driver,
+ virConnectPtr conn,
+ virDomainObjPtr vm,
+ const char *xmlin,
+ const char *persist_xml,
+ const char *dconnuri,
+ const char *uri,
+ const char *graphicsuri,
+ const char *listenAddress,
+ size_t nmigrate_disks,
+ const char **migrate_disks,
+ int nbdPort,
+ qemuMigrationCompressionPtr compression,
+ qemuMonitorMigrationParamsPtr migParams,
+ const char *cookiein,
+ int cookieinlen,
+ char **cookieout,
+ int *cookieoutlen,
+ unsigned long flags,
+ const char *dname,
+ unsigned long resource,
+ bool v3proto)
{
VIR_DEBUG("driver=%p, conn=%p, vm=%p, xmlin=%s, dconnuri=%s, "
"uri=%s, graphicsuri=%s, listenAddress=%s, "
@@ -5132,13 +5132,13 @@ qemuMigrationPerform(virQEMUDriverPtr driver,
return -1;
}
- return qemuMigrationPerformJob(driver, conn, vm, xmlin, persist_xml, dconnuri,
uri,
- graphicsuri, listenAddress,
- nmigrate_disks, migrate_disks, nbdPort,
- compression, migParams,
- cookiein, cookieinlen,
- cookieout, cookieoutlen,
- flags, dname, resource, v3proto);
+ return qemuMigrationSrcPerformJob(driver, conn, vm, xmlin, persist_xml, dconnuri,
uri,
+ graphicsuri, listenAddress,
+ nmigrate_disks, migrate_disks, nbdPort,
+ compression, migParams,
+ cookiein, cookieinlen,
+ cookieout, cookieoutlen,
+ flags, dname, resource, v3proto);
} else {
if (dconnuri) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -5147,21 +5147,21 @@ qemuMigrationPerform(virQEMUDriverPtr driver,
}
if (v3proto) {
- return qemuMigrationPerformPhase(driver, conn, vm, persist_xml, uri,
- graphicsuri,
- nmigrate_disks, migrate_disks,
- compression, migParams,
- cookiein, cookieinlen,
- cookieout, cookieoutlen,
- flags, resource);
+ return qemuMigrationSrcPerformPhase(driver, conn, vm, persist_xml, uri,
+ graphicsuri,
+ nmigrate_disks, migrate_disks,
+ compression, migParams,
+ cookiein, cookieinlen,
+ cookieout, cookieoutlen,
+ flags, resource);
} else {
- return qemuMigrationPerformJob(driver, conn, vm, xmlin, persist_xml, NULL,
- uri, graphicsuri, listenAddress,
- nmigrate_disks, migrate_disks, nbdPort,
- compression, migParams,
- cookiein, cookieinlen,
- cookieout, cookieoutlen, flags,
- dname, resource, v3proto);
+ return qemuMigrationSrcPerformJob(driver, conn, vm, xmlin, persist_xml,
NULL,
+ uri, graphicsuri, listenAddress,
+ nmigrate_disks, migrate_disks, nbdPort,
+ compression, migParams,
+ cookiein, cookieinlen,
+ cookieout, cookieoutlen, flags,
+ dname, resource, v3proto);
}
}
}
@@ -5271,16 +5271,16 @@ qemuMigrationPersist(virQEMUDriverPtr driver,
virDomainPtr
-qemuMigrationFinish(virQEMUDriverPtr driver,
- virConnectPtr dconn,
- virDomainObjPtr vm,
- const char *cookiein,
- int cookieinlen,
- char **cookieout,
- int *cookieoutlen,
- unsigned long flags,
- int retcode,
- bool v3proto)
+qemuMigrationDstFinish(virQEMUDriverPtr driver,
+ virConnectPtr dconn,
+ virDomainObjPtr vm,
+ const char *cookiein,
+ int cookieinlen,
+ char **cookieout,
+ int *cookieoutlen,
+ unsigned long flags,
+ int retcode,
+ bool v3proto)
{
virDomainPtr dom = NULL;
qemuMigrationCookiePtr mig = NULL;
@@ -5314,7 +5314,7 @@ qemuMigrationFinish(virQEMUDriverPtr driver,
v3proto ? QEMU_MIGRATION_PHASE_FINISH3
: QEMU_MIGRATION_PHASE_FINISH2);
- qemuDomainCleanupRemove(vm, qemuMigrationPrepareCleanup);
+ qemuDomainCleanupRemove(vm, qemuMigrationDstPrepareCleanup);
VIR_FREE(priv->job.completed);
cookie_flags = QEMU_MIGRATION_COOKIE_NETWORK |
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index 234f1eb858..ebaf58297c 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -138,99 +138,99 @@ qemuMigrationSetOffline(virQEMUDriverPtr driver,
virDomainObjPtr vm);
char *
-qemuMigrationBegin(virConnectPtr conn,
- virDomainObjPtr vm,
- const char *xmlin,
- const char *dname,
- char **cookieout,
- int *cookieoutlen,
- size_t nmigrate_disks,
- const char **migrate_disks,
- unsigned long flags);
+qemuMigrationSrcBegin(virConnectPtr conn,
+ virDomainObjPtr vm,
+ const char *xmlin,
+ const char *dname,
+ char **cookieout,
+ int *cookieoutlen,
+ size_t nmigrate_disks,
+ const char **migrate_disks,
+ unsigned long flags);
virDomainDefPtr
-qemuMigrationPrepareDef(virQEMUDriverPtr driver,
- const char *dom_xml,
- const char *dname,
- char **origname);
+qemuMigrationAnyPrepareDef(virQEMUDriverPtr driver,
+ const char *dom_xml,
+ const char *dname,
+ char **origname);
int
-qemuMigrationPrepareTunnel(virQEMUDriverPtr driver,
- const char *cookiein,
- int cookieinlen,
- char **cookieout,
- int *cookieoutlen,
- virStreamPtr st,
- virDomainDefPtr *def,
- const char *origname,
- unsigned long flags);
+qemuMigrationDstPrepareTunnel(virQEMUDriverPtr driver,
+ const char *cookiein,
+ int cookieinlen,
+ char **cookieout,
+ int *cookieoutlen,
+ virStreamPtr st,
+ virDomainDefPtr *def,
+ const char *origname,
+ unsigned long flags);
int
-qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
- const char *cookiein,
- int cookieinlen,
- char **cookieout,
- int *cookieoutlen,
- const char *uri_in,
- char **uri_out,
- virDomainDefPtr *def,
- const char *origname,
- const char *listenAddress,
- size_t nmigrate_disks,
- const char **migrate_disks,
- int nbdPort,
- qemuMigrationCompressionPtr compression,
- unsigned long flags);
+qemuMigrationDstPrepareDirect(virQEMUDriverPtr driver,
+ const char *cookiein,
+ int cookieinlen,
+ char **cookieout,
+ int *cookieoutlen,
+ const char *uri_in,
+ char **uri_out,
+ virDomainDefPtr *def,
+ const char *origname,
+ const char *listenAddress,
+ size_t nmigrate_disks,
+ const char **migrate_disks,
+ int nbdPort,
+ qemuMigrationCompressionPtr compression,
+ unsigned long flags);
int
-qemuMigrationPerform(virQEMUDriverPtr driver,
- virConnectPtr conn,
- virDomainObjPtr vm,
- const char *xmlin,
- const char *persist_xml,
- const char *dconnuri,
- const char *uri,
- const char *graphicsuri,
- const char *listenAddress,
- size_t nmigrate_disks,
- const char **migrate_disks,
- int nbdPort,
- qemuMigrationCompressionPtr compression,
- qemuMonitorMigrationParamsPtr migParams,
- const char *cookiein,
- int cookieinlen,
- char **cookieout,
- int *cookieoutlen,
- unsigned long flags,
- const char *dname,
- unsigned long resource,
- bool v3proto);
+qemuMigrationSrcPerform(virQEMUDriverPtr driver,
+ virConnectPtr conn,
+ virDomainObjPtr vm,
+ const char *xmlin,
+ const char *persist_xml,
+ const char *dconnuri,
+ const char *uri,
+ const char *graphicsuri,
+ const char *listenAddress,
+ size_t nmigrate_disks,
+ const char **migrate_disks,
+ int nbdPort,
+ qemuMigrationCompressionPtr compression,
+ qemuMonitorMigrationParamsPtr migParams,
+ const char *cookiein,
+ int cookieinlen,
+ char **cookieout,
+ int *cookieoutlen,
+ unsigned long flags,
+ const char *dname,
+ unsigned long resource,
+ bool v3proto);
virDomainPtr
-qemuMigrationFinish(virQEMUDriverPtr driver,
- virConnectPtr dconn,
- virDomainObjPtr vm,
- const char *cookiein,
- int cookieinlen,
- char **cookieout,
- int *cookieoutlen,
- unsigned long flags,
- int retcode,
- bool v3proto);
+qemuMigrationDstFinish(virQEMUDriverPtr driver,
+ virConnectPtr dconn,
+ virDomainObjPtr vm,
+ const char *cookiein,
+ int cookieinlen,
+ char **cookieout,
+ int *cookieoutlen,
+ unsigned long flags,
+ int retcode,
+ bool v3proto);
int
-qemuMigrationConfirm(virQEMUDriverPtr driver,
- virDomainObjPtr vm,
- const char *cookiein,
- int cookieinlen,
- unsigned int flags,
- int cancelled);
+qemuMigrationSrcConfirm(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ const char *cookiein,
+ int cookieinlen,
+ unsigned int flags,
+ int cancelled);
bool
-qemuMigrationIsAllowed(virQEMUDriverPtr driver,
- virDomainObjPtr vm,
- bool remote,
- unsigned int flags);
+qemuMigrationSrcIsAllowed(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ bool remote,
+ unsigned int flags);
int
qemuMigrationToFile(virQEMUDriverPtr driver,
--
2.14.3