qemu: rename migration APIs to include Src or Dst in their name

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.

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2018-02-12 17:11:41 +00:00
parent 8f5133f99e
commit ffb7954f88
5 changed files with 945 additions and 925 deletions

View File

@ -754,7 +754,7 @@ qemuStateInitialize(bool privileged,
if (!(qemu_driver->sharedDevices = virHashCreate(30, qemuSharedDeviceEntryFree))) if (!(qemu_driver->sharedDevices = virHashCreate(30, qemuSharedDeviceEntryFree)))
goto error; goto error;
if (qemuMigrationErrorInit(qemu_driver) < 0) if (qemuMigrationDstErrorInit(qemu_driver) < 0)
goto error; goto error;
if (privileged) { if (privileged) {
@ -3282,7 +3282,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
goto cleanup; goto cleanup;
/* Perform the migration */ /* Perform the migration */
if (qemuMigrationToFile(driver, vm, fd, compressedpath, asyncJob) < 0) if (qemuMigrationSrcToFile(driver, vm, fd, compressedpath, asyncJob) < 0)
goto cleanup; goto cleanup;
/* Touch up file header to mark image complete. */ /* Touch up file header to mark image complete. */
@ -3338,7 +3338,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver,
if (!(caps = virQEMUDriverGetCapabilities(driver, false))) if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
goto cleanup; goto cleanup;
if (!qemuMigrationIsAllowed(driver, vm, false, 0)) if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0))
goto cleanup; goto cleanup;
if (qemuDomainObjBeginAsyncJob(driver, vm, QEMU_ASYNC_JOB_SAVE, if (qemuDomainObjBeginAsyncJob(driver, vm, QEMU_ASYNC_JOB_SAVE,
@ -3893,11 +3893,11 @@ doCoreDump(virQEMUDriverPtr driver,
goto cleanup; goto cleanup;
} }
if (!qemuMigrationIsAllowed(driver, vm, false, 0)) if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0))
goto cleanup; goto cleanup;
ret = qemuMigrationToFile(driver, vm, fd, compressedpath, ret = qemuMigrationSrcToFile(driver, vm, fd, compressedpath,
QEMU_ASYNC_JOB_DUMP); QEMU_ASYNC_JOB_DUMP);
} }
if (ret < 0) if (ret < 0)
@ -4815,8 +4815,8 @@ processMonitorEOFEvent(virQEMUDriverPtr driver,
if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_IN) { if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_IN) {
stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED; stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED;
qemuMigrationErrorSave(driver, vm->def->name, qemuMigrationDstErrorSave(driver, vm->def->name,
qemuMonitorLastError(priv->mon)); qemuMonitorLastError(priv->mon));
} }
event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED, event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED,
@ -12109,15 +12109,15 @@ qemuDomainMigratePrepareTunnel(virConnectPtr dconn,
goto cleanup; goto cleanup;
} }
if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname, &origname))) if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
goto cleanup; goto cleanup;
if (virDomainMigratePrepareTunnelEnsureACL(dconn, def) < 0) if (virDomainMigratePrepareTunnelEnsureACL(dconn, def) < 0)
goto cleanup; goto cleanup;
ret = qemuMigrationPrepareTunnel(driver, ret = qemuMigrationDstPrepareTunnel(driver,
NULL, 0, NULL, NULL, /* No cookies in v2 */ NULL, 0, NULL, NULL, /* No cookies in v2 */
st, &def, origname, flags); st, &def, origname, flags);
cleanup: cleanup:
VIR_FREE(origname); VIR_FREE(origname);
@ -12158,7 +12158,7 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
goto cleanup; goto cleanup;
} }
if (!(compression = qemuMigrationCompressionParse(NULL, 0, flags))) if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
goto cleanup; goto cleanup;
if (virLockManagerPluginUsesState(driver->lockManager)) { if (virLockManagerPluginUsesState(driver->lockManager)) {
@ -12168,7 +12168,7 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
goto cleanup; goto cleanup;
} }
if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname, &origname))) if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
goto cleanup; goto cleanup;
if (virDomainMigratePrepare2EnsureACL(dconn, def) < 0) if (virDomainMigratePrepare2EnsureACL(dconn, def) < 0)
@ -12178,11 +12178,11 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
* length was not sufficiently large, causing failures * length was not sufficiently large, causing failures
* migrating between old & new libvirtd * migrating between old & new libvirtd
*/ */
ret = qemuMigrationPrepareDirect(driver, ret = qemuMigrationDstPrepareDirect(driver,
NULL, 0, NULL, NULL, /* No cookies */ NULL, 0, NULL, NULL, /* No cookies */
uri_in, uri_out, uri_in, uri_out,
&def, origname, NULL, 0, NULL, 0, &def, origname, NULL, 0, NULL, 0,
compression, flags); compression, flags);
cleanup: cleanup:
VIR_FREE(compression); VIR_FREE(compression);
@ -12218,7 +12218,7 @@ qemuDomainMigratePerform(virDomainPtr dom,
goto cleanup; goto cleanup;
} }
if (!(compression = qemuMigrationCompressionParse(NULL, 0, flags))) if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
goto cleanup; goto cleanup;
if (!(vm = qemuDomObjFromDomain(dom))) if (!(vm = qemuDomObjFromDomain(dom)))
@ -12240,11 +12240,11 @@ qemuDomainMigratePerform(virDomainPtr dom,
* *
* Consume any cookie we were able to decode though * Consume any cookie we were able to decode though
*/ */
ret = qemuMigrationPerform(driver, dom->conn, vm, NULL, ret = qemuMigrationSrcPerform(driver, dom->conn, vm, NULL,
NULL, dconnuri, uri, NULL, NULL, 0, NULL, 0, NULL, dconnuri, uri, NULL, NULL, 0, NULL, 0,
compression, &migParams, cookie, cookielen, compression, &migParams, cookie, cookielen,
NULL, NULL, /* No output cookies in v2 */ NULL, NULL, /* No output cookies in v2 */
flags, dname, resource, false); flags, dname, resource, false);
cleanup: cleanup:
qemuMigrationParamsClear(&migParams); qemuMigrationParamsClear(&migParams);
@ -12273,7 +12273,7 @@ qemuDomainMigrateFinish2(virConnectPtr dconn,
if (!vm) { if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN, virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching name '%s'"), dname); _("no domain with matching name '%s'"), dname);
qemuMigrationErrorReport(driver, dname); qemuMigrationDstErrorReport(driver, dname);
goto cleanup; goto cleanup;
} }
@ -12286,9 +12286,9 @@ qemuDomainMigrateFinish2(virConnectPtr dconn,
* length was not sufficiently large, causing failures * length was not sufficiently large, causing failures
* migrating between old & new libvirtd * migrating between old & new libvirtd
*/ */
dom = qemuMigrationFinish(driver, dconn, vm, dom = qemuMigrationDstFinish(driver, dconn, vm,
NULL, 0, NULL, NULL, /* No cookies */ NULL, 0, NULL, NULL, /* No cookies */
flags, retcode, false); flags, retcode, false);
cleanup: cleanup:
return dom; return dom;
@ -12320,8 +12320,8 @@ qemuDomainMigrateBegin3(virDomainPtr domain,
return NULL; return NULL;
} }
return qemuMigrationBegin(domain->conn, vm, xmlin, dname, return qemuMigrationSrcBegin(domain->conn, vm, xmlin, dname,
cookieout, cookieoutlen, 0, NULL, flags); cookieout, cookieoutlen, 0, NULL, flags);
} }
static char * static char *
@ -12366,9 +12366,9 @@ qemuDomainMigrateBegin3Params(virDomainPtr domain,
goto cleanup; goto cleanup;
} }
ret = qemuMigrationBegin(domain->conn, vm, xmlin, dname, ret = qemuMigrationSrcBegin(domain->conn, vm, xmlin, dname,
cookieout, cookieoutlen, cookieout, cookieoutlen,
nmigrate_disks, migrate_disks, flags); nmigrate_disks, migrate_disks, flags);
cleanup: cleanup:
VIR_FREE(migrate_disks); VIR_FREE(migrate_disks);
@ -12407,21 +12407,21 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
goto cleanup; goto cleanup;
} }
if (!(compression = qemuMigrationCompressionParse(NULL, 0, flags))) if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
goto cleanup; goto cleanup;
if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname, &origname))) if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
goto cleanup; goto cleanup;
if (virDomainMigratePrepare3EnsureACL(dconn, def) < 0) if (virDomainMigratePrepare3EnsureACL(dconn, def) < 0)
goto cleanup; goto cleanup;
ret = qemuMigrationPrepareDirect(driver, ret = qemuMigrationDstPrepareDirect(driver,
cookiein, cookieinlen, cookiein, cookieinlen,
cookieout, cookieoutlen, cookieout, cookieoutlen,
uri_in, uri_out, uri_in, uri_out,
&def, origname, NULL, 0, NULL, 0, &def, origname, NULL, 0, NULL, 0,
compression, flags); compression, flags);
cleanup: cleanup:
VIR_FREE(compression); VIR_FREE(compression);
@ -12483,7 +12483,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
if (nmigrate_disks < 0) if (nmigrate_disks < 0)
goto cleanup; goto cleanup;
if (!(compression = qemuMigrationCompressionParse(params, nparams, flags))) if (!(compression = qemuMigrationAnyCompressionParse(params, nparams, flags)))
goto cleanup; goto cleanup;
if (flags & VIR_MIGRATE_TUNNELLED) { if (flags & VIR_MIGRATE_TUNNELLED) {
@ -12496,19 +12496,19 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
goto cleanup; goto cleanup;
} }
if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname, &origname))) if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
goto cleanup; goto cleanup;
if (virDomainMigratePrepare3ParamsEnsureACL(dconn, def) < 0) if (virDomainMigratePrepare3ParamsEnsureACL(dconn, def) < 0)
goto cleanup; goto cleanup;
ret = qemuMigrationPrepareDirect(driver, ret = qemuMigrationDstPrepareDirect(driver,
cookiein, cookieinlen, cookiein, cookieinlen,
cookieout, cookieoutlen, cookieout, cookieoutlen,
uri_in, uri_out, uri_in, uri_out,
&def, origname, listenAddress, &def, origname, listenAddress,
nmigrate_disks, migrate_disks, nbdPort, nmigrate_disks, migrate_disks, nbdPort,
compression, flags); compression, flags);
cleanup: cleanup:
VIR_FREE(compression); VIR_FREE(compression);
@ -12545,16 +12545,16 @@ qemuDomainMigratePrepareTunnel3(virConnectPtr dconn,
goto cleanup; goto cleanup;
} }
if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname, &origname))) if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
goto cleanup; goto cleanup;
if (virDomainMigratePrepareTunnel3EnsureACL(dconn, def) < 0) if (virDomainMigratePrepareTunnel3EnsureACL(dconn, def) < 0)
goto cleanup; goto cleanup;
ret = qemuMigrationPrepareTunnel(driver, ret = qemuMigrationDstPrepareTunnel(driver,
cookiein, cookieinlen, cookiein, cookieinlen,
cookieout, cookieoutlen, cookieout, cookieoutlen,
st, &def, origname, flags); st, &def, origname, flags);
cleanup: cleanup:
VIR_FREE(origname); VIR_FREE(origname);
@ -12598,16 +12598,16 @@ qemuDomainMigratePrepareTunnel3Params(virConnectPtr dconn,
goto cleanup; goto cleanup;
} }
if (!(def = qemuMigrationPrepareDef(driver, dom_xml, dname, &origname))) if (!(def = qemuMigrationAnyPrepareDef(driver, dom_xml, dname, &origname)))
goto cleanup; goto cleanup;
if (virDomainMigratePrepareTunnel3ParamsEnsureACL(dconn, def) < 0) if (virDomainMigratePrepareTunnel3ParamsEnsureACL(dconn, def) < 0)
goto cleanup; goto cleanup;
ret = qemuMigrationPrepareTunnel(driver, ret = qemuMigrationDstPrepareTunnel(driver,
cookiein, cookieinlen, cookiein, cookieinlen,
cookieout, cookieoutlen, cookieout, cookieoutlen,
st, &def, origname, flags); st, &def, origname, flags);
cleanup: cleanup:
VIR_FREE(origname); VIR_FREE(origname);
@ -12637,7 +12637,7 @@ qemuDomainMigratePerform3(virDomainPtr dom,
virCheckFlags(QEMU_MIGRATION_FLAGS, -1); virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
if (!(compression = qemuMigrationCompressionParse(NULL, 0, flags))) if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
return -1; return -1;
if (!(vm = qemuDomObjFromDomain(dom))) if (!(vm = qemuDomObjFromDomain(dom)))
@ -12648,12 +12648,12 @@ qemuDomainMigratePerform3(virDomainPtr dom,
goto cleanup; goto cleanup;
} }
ret = qemuMigrationPerform(driver, dom->conn, vm, xmlin, NULL, ret = qemuMigrationSrcPerform(driver, dom->conn, vm, xmlin, NULL,
dconnuri, uri, NULL, NULL, 0, NULL, 0, dconnuri, uri, NULL, NULL, 0, NULL, 0,
compression, &migParams, compression, &migParams,
cookiein, cookieinlen, cookiein, cookieinlen,
cookieout, cookieoutlen, cookieout, cookieoutlen,
flags, dname, resource, true); flags, dname, resource, true);
cleanup: cleanup:
qemuMigrationParamsClear(&migParams); qemuMigrationParamsClear(&migParams);
@ -12728,7 +12728,7 @@ qemuDomainMigratePerform3Params(virDomainPtr dom,
if (!(migParams = qemuMigrationParams(params, nparams, flags))) if (!(migParams = qemuMigrationParams(params, nparams, flags)))
goto cleanup; goto cleanup;
if (!(compression = qemuMigrationCompressionParse(params, nparams, flags))) if (!(compression = qemuMigrationAnyCompressionParse(params, nparams, flags)))
goto cleanup; goto cleanup;
if (!(vm = qemuDomObjFromDomain(dom))) if (!(vm = qemuDomObjFromDomain(dom)))
@ -12739,12 +12739,12 @@ qemuDomainMigratePerform3Params(virDomainPtr dom,
goto cleanup; goto cleanup;
} }
ret = qemuMigrationPerform(driver, dom->conn, vm, dom_xml, persist_xml, ret = qemuMigrationSrcPerform(driver, dom->conn, vm, dom_xml, persist_xml,
dconnuri, uri, graphicsuri, listenAddress, dconnuri, uri, graphicsuri, listenAddress,
nmigrate_disks, migrate_disks, nbdPort, nmigrate_disks, migrate_disks, nbdPort,
compression, migParams, compression, migParams,
cookiein, cookieinlen, cookieout, cookieoutlen, cookiein, cookieinlen, cookieout, cookieoutlen,
flags, dname, bandwidth, true); flags, dname, bandwidth, true);
cleanup: cleanup:
VIR_FREE(compression); VIR_FREE(compression);
qemuMigrationParamsFree(&migParams); qemuMigrationParamsFree(&migParams);
@ -12779,7 +12779,7 @@ qemuDomainMigrateFinish3(virConnectPtr dconn,
if (!vm) { if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN, virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching name '%s'"), dname); _("no domain with matching name '%s'"), dname);
qemuMigrationErrorReport(driver, dname); qemuMigrationDstErrorReport(driver, dname);
return NULL; return NULL;
} }
@ -12788,10 +12788,10 @@ qemuDomainMigrateFinish3(virConnectPtr dconn,
return NULL; return NULL;
} }
return qemuMigrationFinish(driver, dconn, vm, return qemuMigrationDstFinish(driver, dconn, vm,
cookiein, cookieinlen, cookiein, cookieinlen,
cookieout, cookieoutlen, cookieout, cookieoutlen,
flags, cancelled, true); flags, cancelled, true);
} }
static virDomainPtr static virDomainPtr
@ -12827,7 +12827,7 @@ qemuDomainMigrateFinish3Params(virConnectPtr dconn,
if (!vm) { if (!vm) {
virReportError(VIR_ERR_NO_DOMAIN, virReportError(VIR_ERR_NO_DOMAIN,
_("no domain with matching name '%s'"), dname); _("no domain with matching name '%s'"), dname);
qemuMigrationErrorReport(driver, dname); qemuMigrationDstErrorReport(driver, dname);
return NULL; return NULL;
} }
@ -12836,10 +12836,10 @@ qemuDomainMigrateFinish3Params(virConnectPtr dconn,
return NULL; return NULL;
} }
return qemuMigrationFinish(driver, dconn, vm, return qemuMigrationDstFinish(driver, dconn, vm,
cookiein, cookieinlen, cookiein, cookieinlen,
cookieout, cookieoutlen, cookieout, cookieoutlen,
flags, cancelled, true); flags, cancelled, true);
} }
@ -12862,8 +12862,8 @@ qemuDomainMigrateConfirm3(virDomainPtr domain,
return -1; return -1;
} }
return qemuMigrationConfirm(domain->conn->privateData, vm, cookiein, cookieinlen, return qemuMigrationSrcConfirm(domain->conn->privateData, vm, cookiein, cookieinlen,
flags, cancelled); flags, cancelled);
} }
static int static int
@ -12890,8 +12890,8 @@ qemuDomainMigrateConfirm3Params(virDomainPtr domain,
return -1; return -1;
} }
return qemuMigrationConfirm(domain->conn->privateData, vm, cookiein, cookieinlen, return qemuMigrationSrcConfirm(domain->conn->privateData, vm, cookiein, cookieinlen,
flags, cancelled); flags, cancelled);
} }
@ -13180,14 +13180,14 @@ qemuDomainGetJobInfoMigrationStats(virQEMUDriverPtr driver,
jobInfo->status == QEMU_DOMAIN_JOB_STATUS_POSTCOPY) { jobInfo->status == QEMU_DOMAIN_JOB_STATUS_POSTCOPY) {
if (events && if (events &&
jobInfo->status != QEMU_DOMAIN_JOB_STATUS_ACTIVE && jobInfo->status != QEMU_DOMAIN_JOB_STATUS_ACTIVE &&
qemuMigrationFetchStats(driver, vm, QEMU_ASYNC_JOB_NONE, qemuMigrationAnyFetchStats(driver, vm, QEMU_ASYNC_JOB_NONE,
jobInfo, NULL) < 0) jobInfo, NULL) < 0)
return -1; return -1;
if (jobInfo->status == QEMU_DOMAIN_JOB_STATUS_ACTIVE && if (jobInfo->status == QEMU_DOMAIN_JOB_STATUS_ACTIVE &&
jobInfo->statsType == QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION && jobInfo->statsType == QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION &&
qemuMigrationFetchMirrorStats(driver, vm, QEMU_ASYNC_JOB_NONE, qemuMigrationSrcFetchMirrorStats(driver, vm, QEMU_ASYNC_JOB_NONE,
jobInfo) < 0) jobInfo) < 0)
return -1; return -1;
if (qemuDomainJobInfoUpdateTime(jobInfo) < 0) if (qemuDomainJobInfoUpdateTime(jobInfo) < 0)
@ -13582,7 +13582,7 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom,
priv = vm->privateData; priv = vm->privateData;
if (!qemuMigrationCapsGet(vm, QEMU_MONITOR_MIGRATION_CAPS_XBZRLE)) { if (!qemuMigrationAnyCapsGet(vm, QEMU_MONITOR_MIGRATION_CAPS_XBZRLE)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("Compressed migration is not supported by " _("Compressed migration is not supported by "
"QEMU binary")); "QEMU binary"));
@ -13633,7 +13633,7 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom,
priv = vm->privateData; priv = vm->privateData;
if (!qemuMigrationCapsGet(vm, QEMU_MONITOR_MIGRATION_CAPS_XBZRLE)) { if (!qemuMigrationAnyCapsGet(vm, QEMU_MONITOR_MIGRATION_CAPS_XBZRLE)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("Compressed migration is not supported by " _("Compressed migration is not supported by "
"QEMU binary")); "QEMU binary"));
@ -13985,7 +13985,7 @@ qemuDomainSnapshotCreateActiveInternal(virQEMUDriverPtr driver,
bool resume = false; bool resume = false;
int ret = -1; int ret = -1;
if (!qemuMigrationIsAllowed(driver, vm, false, 0)) if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0))
goto cleanup; goto cleanup;
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) { if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
@ -14918,7 +14918,7 @@ qemuDomainSnapshotCreateActiveExternal(virQEMUDriverPtr driver,
/* do the memory snapshot if necessary */ /* do the memory snapshot if necessary */
if (memory) { if (memory) {
/* check if migration is possible */ /* check if migration is possible */
if (!qemuMigrationIsAllowed(driver, vm, false, 0)) if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0))
goto cleanup; goto cleanup;
/* allow the migration job to be cancelled or the domain to be paused */ /* allow the migration job to be cancelled or the domain to be paused */

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,20 @@
# include "qemu_conf.h" # include "qemu_conf.h"
# include "qemu_domain.h" # include "qemu_domain.h"
/*
* General function naming conventions:
*
* - qemuMigrationSrcXXX - only runs on source host
* - qemuMigrationDstXXX - only runs on dest host
* - qemuMigrationAnyXXX - runs on source or dest host
*
* Exceptions:
*
* - qemuMigrationParamsXXX - runs on source or dest host
* - qemuMigrationOptionXXX - runs on source or dest host
* - qemuMigrationJobXXX - runs on source or dest host
*/
typedef struct _qemuMigrationCompression qemuMigrationCompression; typedef struct _qemuMigrationCompression qemuMigrationCompression;
typedef qemuMigrationCompression *qemuMigrationCompressionPtr; typedef qemuMigrationCompression *qemuMigrationCompressionPtr;
@ -112,15 +126,15 @@ struct _qemuMigrationCompression {
}; };
qemuMigrationCompressionPtr qemuMigrationCompressionPtr
qemuMigrationCompressionParse(virTypedParameterPtr params, qemuMigrationAnyCompressionParse(virTypedParameterPtr params,
int nparams, int nparams,
unsigned long flags); unsigned long flags);
int int
qemuMigrationCompressionDump(qemuMigrationCompressionPtr compression, qemuMigrationAnyCompressionDump(qemuMigrationCompressionPtr compression,
virTypedParameterPtr *params, virTypedParameterPtr *params,
int *nparams, int *nparams,
int *maxparams, int *maxparams,
unsigned long *flags); unsigned long *flags);
void void
qemuMigrationParamsClear(qemuMonitorMigrationParamsPtr migParams); qemuMigrationParamsClear(qemuMonitorMigrationParamsPtr migParams);
@ -134,166 +148,166 @@ qemuMigrationParams(virTypedParameterPtr params,
unsigned long flags); unsigned long flags);
int int
qemuMigrationSetOffline(virQEMUDriverPtr driver, qemuMigrationSrcSetOffline(virQEMUDriverPtr driver,
virDomainObjPtr vm); virDomainObjPtr vm);
char * char *
qemuMigrationBegin(virConnectPtr conn, qemuMigrationSrcBegin(virConnectPtr conn,
virDomainObjPtr vm, virDomainObjPtr vm,
const char *xmlin, const char *xmlin,
const char *dname, const char *dname,
char **cookieout, char **cookieout,
int *cookieoutlen, int *cookieoutlen,
size_t nmigrate_disks, size_t nmigrate_disks,
const char **migrate_disks, const char **migrate_disks,
unsigned long flags); unsigned long flags);
virDomainDefPtr virDomainDefPtr
qemuMigrationPrepareDef(virQEMUDriverPtr driver, qemuMigrationAnyPrepareDef(virQEMUDriverPtr driver,
const char *dom_xml, const char *dom_xml,
const char *dname,
char **origname);
int
qemuMigrationDstPrepareTunnel(virQEMUDriverPtr driver,
const char *cookiein,
int cookieinlen,
char **cookieout,
int *cookieoutlen,
virStreamPtr st,
virDomainDefPtr *def,
const char *origname,
unsigned long flags);
int
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
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, const char *dname,
char **origname); unsigned long resource,
bool v3proto);
int
qemuMigrationPrepareTunnel(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);
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);
virDomainPtr virDomainPtr
qemuMigrationFinish(virQEMUDriverPtr driver, qemuMigrationDstFinish(virQEMUDriverPtr driver,
virConnectPtr dconn, virConnectPtr dconn,
virDomainObjPtr vm, virDomainObjPtr vm,
const char *cookiein, const char *cookiein,
int cookieinlen, int cookieinlen,
char **cookieout, char **cookieout,
int *cookieoutlen, int *cookieoutlen,
unsigned long flags, unsigned long flags,
int retcode, int retcode,
bool v3proto); bool v3proto);
int int
qemuMigrationConfirm(virQEMUDriverPtr driver, qemuMigrationSrcConfirm(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
const char *cookiein, const char *cookiein,
int cookieinlen, int cookieinlen,
unsigned int flags, unsigned int flags,
int cancelled); int cancelled);
bool bool
qemuMigrationIsAllowed(virQEMUDriverPtr driver, qemuMigrationSrcIsAllowed(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
bool remote, bool remote,
unsigned int flags); unsigned int flags);
int int
qemuMigrationToFile(virQEMUDriverPtr driver, qemuMigrationSrcToFile(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
int fd, int fd,
const char *compressor, const char *compressor,
qemuDomainAsyncJob asyncJob) qemuDomainAsyncJob asyncJob)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK; ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
int int
qemuMigrationCancel(virQEMUDriverPtr driver, qemuMigrationSrcCancel(virQEMUDriverPtr driver,
virDomainObjPtr vm); virDomainObjPtr vm);
int int
qemuMigrationFetchStats(virQEMUDriverPtr driver, qemuMigrationAnyFetchStats(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob, qemuDomainAsyncJob asyncJob,
qemuDomainJobInfoPtr jobInfo, qemuDomainJobInfoPtr jobInfo,
char **error); char **error);
int int
qemuMigrationErrorInit(virQEMUDriverPtr driver); qemuMigrationDstErrorInit(virQEMUDriverPtr driver);
void void
qemuMigrationErrorSave(virQEMUDriverPtr driver, qemuMigrationDstErrorSave(virQEMUDriverPtr driver,
const char *name, const char *name,
virErrorPtr err); virErrorPtr err);
void void
qemuMigrationErrorReport(virQEMUDriverPtr driver, qemuMigrationDstErrorReport(virQEMUDriverPtr driver,
const char *name); const char *name);
int int
qemuMigrationCheckIncoming(virQEMUCapsPtr qemuCaps, qemuMigrationDstCheckProtocol(virQEMUCapsPtr qemuCaps,
const char *migrateFrom); const char *migrateFrom);
char * char *
qemuMigrationIncomingURI(const char *migrateFrom, qemuMigrationDstGetURI(const char *migrateFrom,
int migrateFd); int migrateFd);
int int
qemuMigrationRunIncoming(virQEMUDriverPtr driver, qemuMigrationDstRun(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
const char *uri, const char *uri,
qemuDomainAsyncJob asyncJob); qemuDomainAsyncJob asyncJob);
void void
qemuMigrationPostcopyFailed(virQEMUDriverPtr driver, qemuMigrationAnyPostcopyFailed(virQEMUDriverPtr driver,
virDomainObjPtr vm); virDomainObjPtr vm);
void void
qemuMigrationReset(virQEMUDriverPtr driver, qemuMigrationParamsReset(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
qemuDomainAsyncJob job); qemuDomainAsyncJob job);
int int
qemuMigrationFetchMirrorStats(virQEMUDriverPtr driver, qemuMigrationSrcFetchMirrorStats(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob, qemuDomainAsyncJob asyncJob,
qemuDomainJobInfoPtr jobInfo); qemuDomainJobInfoPtr jobInfo);
bool bool
qemuMigrationCapsGet(virDomainObjPtr vm, qemuMigrationAnyCapsGet(virDomainObjPtr vm,
qemuMonitorMigrationCaps cap); qemuMonitorMigrationCaps cap);
#endif /* __QEMU_MIGRATION_H__ */ #endif /* __QEMU_MIGRATION_H__ */

View File

@ -3069,7 +3069,7 @@ qemuProcessRecoverMigrationIn(virQEMUDriverPtr driver,
* confirm success or failure yet; killing it seems safest unless * confirm success or failure yet; killing it seems safest unless
* we already started guest CPUs or we were in post-copy mode */ * we already started guest CPUs or we were in post-copy mode */
if (postcopy) { if (postcopy) {
qemuMigrationPostcopyFailed(driver, vm); qemuMigrationAnyPostcopyFailed(driver, vm);
} else if (state != VIR_DOMAIN_RUNNING) { } else if (state != VIR_DOMAIN_RUNNING) {
VIR_DEBUG("Killing migrated domain %s", vm->def->name); VIR_DEBUG("Killing migrated domain %s", vm->def->name);
return -1; return -1;
@ -3077,7 +3077,7 @@ qemuProcessRecoverMigrationIn(virQEMUDriverPtr driver,
break; break;
} }
qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_NONE); qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_NONE);
return 0; return 0;
} }
@ -3115,11 +3115,11 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver,
* post-copy mode * post-copy mode
*/ */
if (postcopy) { if (postcopy) {
qemuMigrationPostcopyFailed(driver, vm); qemuMigrationAnyPostcopyFailed(driver, vm);
} else { } else {
VIR_DEBUG("Cancelling unfinished migration of domain %s", VIR_DEBUG("Cancelling unfinished migration of domain %s",
vm->def->name); vm->def->name);
if (qemuMigrationCancel(driver, vm) < 0) { if (qemuMigrationSrcCancel(driver, vm) < 0) {
VIR_WARN("Could not cancel ongoing migration of domain %s", VIR_WARN("Could not cancel ongoing migration of domain %s",
vm->def->name); vm->def->name);
} }
@ -3133,7 +3133,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver,
* post-copy mode we can use PAUSED_POSTCOPY_FAILED state for this * post-copy mode we can use PAUSED_POSTCOPY_FAILED state for this
*/ */
if (postcopy) if (postcopy)
qemuMigrationPostcopyFailed(driver, vm); qemuMigrationAnyPostcopyFailed(driver, vm);
break; break;
case QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED: case QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED:
@ -3142,7 +3142,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver,
* as broken in that case * as broken in that case
*/ */
if (postcopy) { if (postcopy) {
qemuMigrationPostcopyFailed(driver, vm); qemuMigrationAnyPostcopyFailed(driver, vm);
} else { } else {
VIR_DEBUG("Resuming domain %s after failed migration", VIR_DEBUG("Resuming domain %s after failed migration",
vm->def->name); vm->def->name);
@ -3171,7 +3171,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver,
} }
} }
qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_NONE); qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_NONE);
return 0; return 0;
} }
@ -4142,7 +4142,7 @@ qemuProcessIncomingDefNew(virQEMUCapsPtr qemuCaps,
{ {
qemuProcessIncomingDefPtr inc = NULL; qemuProcessIncomingDefPtr inc = NULL;
if (qemuMigrationCheckIncoming(qemuCaps, migrateFrom) < 0) if (qemuMigrationDstCheckProtocol(qemuCaps, migrateFrom) < 0)
return NULL; return NULL;
if (VIR_ALLOC(inc) < 0) if (VIR_ALLOC(inc) < 0)
@ -4151,7 +4151,7 @@ qemuProcessIncomingDefNew(virQEMUCapsPtr qemuCaps,
if (VIR_STRDUP(inc->address, listenAddress) < 0) if (VIR_STRDUP(inc->address, listenAddress) < 0)
goto error; goto error;
inc->launchURI = qemuMigrationIncomingURI(migrateFrom, fd); inc->launchURI = qemuMigrationDstGetURI(migrateFrom, fd);
if (!inc->launchURI) if (!inc->launchURI)
goto error; goto error;
@ -6348,7 +6348,7 @@ qemuProcessStart(virConnectPtr conn,
if (incoming && if (incoming &&
incoming->deferredURI && incoming->deferredURI &&
qemuMigrationRunIncoming(driver, vm, incoming->deferredURI, asyncJob) < 0) qemuMigrationDstRun(driver, vm, incoming->deferredURI, asyncJob) < 0)
goto stop; goto stop;
if (qemuProcessFinishStartup(driver, vm, asyncJob, if (qemuProcessFinishStartup(driver, vm, asyncJob,

View File

@ -447,8 +447,8 @@ testCompareXMLToArgv(const void *data)
goto cleanup; goto cleanup;
if (info->migrateFrom && if (info->migrateFrom &&
!(migrateURI = qemuMigrationIncomingURI(info->migrateFrom, !(migrateURI = qemuMigrationDstGetURI(info->migrateFrom,
info->migrateFd))) info->migrateFd)))
goto cleanup; goto cleanup;
if (!(vm = virDomainObjNew(driver.xmlopt))) if (!(vm = virDomainObjNew(driver.xmlopt)))