mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
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:
parent
8f5133f99e
commit
ffb7954f88
@ -754,7 +754,7 @@ qemuStateInitialize(bool privileged,
|
||||
if (!(qemu_driver->sharedDevices = virHashCreate(30, qemuSharedDeviceEntryFree)))
|
||||
goto error;
|
||||
|
||||
if (qemuMigrationErrorInit(qemu_driver) < 0)
|
||||
if (qemuMigrationDstErrorInit(qemu_driver) < 0)
|
||||
goto error;
|
||||
|
||||
if (privileged) {
|
||||
@ -3282,7 +3282,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
|
||||
goto cleanup;
|
||||
|
||||
/* Perform the migration */
|
||||
if (qemuMigrationToFile(driver, vm, fd, compressedpath, asyncJob) < 0)
|
||||
if (qemuMigrationSrcToFile(driver, vm, fd, compressedpath, asyncJob) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* Touch up file header to mark image complete. */
|
||||
@ -3338,7 +3338,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,
|
||||
@ -3893,11 +3893,11 @@ 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,
|
||||
QEMU_ASYNC_JOB_DUMP);
|
||||
ret = qemuMigrationSrcToFile(driver, vm, fd, compressedpath,
|
||||
QEMU_ASYNC_JOB_DUMP);
|
||||
}
|
||||
|
||||
if (ret < 0)
|
||||
@ -4815,8 +4815,8 @@ processMonitorEOFEvent(virQEMUDriverPtr driver,
|
||||
|
||||
if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_IN) {
|
||||
stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED;
|
||||
qemuMigrationErrorSave(driver, vm->def->name,
|
||||
qemuMonitorLastError(priv->mon));
|
||||
qemuMigrationDstErrorSave(driver, vm->def->name,
|
||||
qemuMonitorLastError(priv->mon));
|
||||
}
|
||||
|
||||
event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED,
|
||||
@ -12109,15 +12109,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);
|
||||
@ -12158,7 +12158,7 @@ qemuDomainMigratePrepare2(virConnectPtr dconn,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(compression = qemuMigrationCompressionParse(NULL, 0, flags)))
|
||||
if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
|
||||
goto cleanup;
|
||||
|
||||
if (virLockManagerPluginUsesState(driver->lockManager)) {
|
||||
@ -12168,7 +12168,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)
|
||||
@ -12178,11 +12178,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);
|
||||
@ -12218,7 +12218,7 @@ qemuDomainMigratePerform(virDomainPtr dom,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(compression = qemuMigrationCompressionParse(NULL, 0, flags)))
|
||||
if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(vm = qemuDomObjFromDomain(dom)))
|
||||
@ -12240,11 +12240,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);
|
||||
@ -12273,7 +12273,7 @@ qemuDomainMigrateFinish2(virConnectPtr dconn,
|
||||
if (!vm) {
|
||||
virReportError(VIR_ERR_NO_DOMAIN,
|
||||
_("no domain with matching name '%s'"), dname);
|
||||
qemuMigrationErrorReport(driver, dname);
|
||||
qemuMigrationDstErrorReport(driver, dname);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -12286,9 +12286,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;
|
||||
@ -12320,8 +12320,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 *
|
||||
@ -12366,9 +12366,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);
|
||||
@ -12407,21 +12407,21 @@ qemuDomainMigratePrepare3(virConnectPtr dconn,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(compression = qemuMigrationCompressionParse(NULL, 0, flags)))
|
||||
if (!(compression = qemuMigrationAnyCompressionParse(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);
|
||||
@ -12483,7 +12483,7 @@ qemuDomainMigratePrepare3Params(virConnectPtr dconn,
|
||||
if (nmigrate_disks < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!(compression = qemuMigrationCompressionParse(params, nparams, flags)))
|
||||
if (!(compression = qemuMigrationAnyCompressionParse(params, nparams, flags)))
|
||||
goto cleanup;
|
||||
|
||||
if (flags & VIR_MIGRATE_TUNNELLED) {
|
||||
@ -12496,19 +12496,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);
|
||||
@ -12545,16 +12545,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);
|
||||
@ -12598,16 +12598,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);
|
||||
@ -12637,7 +12637,7 @@ qemuDomainMigratePerform3(virDomainPtr dom,
|
||||
|
||||
virCheckFlags(QEMU_MIGRATION_FLAGS, -1);
|
||||
|
||||
if (!(compression = qemuMigrationCompressionParse(NULL, 0, flags)))
|
||||
if (!(compression = qemuMigrationAnyCompressionParse(NULL, 0, flags)))
|
||||
return -1;
|
||||
|
||||
if (!(vm = qemuDomObjFromDomain(dom)))
|
||||
@ -12648,12 +12648,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);
|
||||
@ -12728,7 +12728,7 @@ qemuDomainMigratePerform3Params(virDomainPtr dom,
|
||||
if (!(migParams = qemuMigrationParams(params, nparams, flags)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(compression = qemuMigrationCompressionParse(params, nparams, flags)))
|
||||
if (!(compression = qemuMigrationAnyCompressionParse(params, nparams, flags)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(vm = qemuDomObjFromDomain(dom)))
|
||||
@ -12739,12 +12739,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);
|
||||
@ -12779,7 +12779,7 @@ qemuDomainMigrateFinish3(virConnectPtr dconn,
|
||||
if (!vm) {
|
||||
virReportError(VIR_ERR_NO_DOMAIN,
|
||||
_("no domain with matching name '%s'"), dname);
|
||||
qemuMigrationErrorReport(driver, dname);
|
||||
qemuMigrationDstErrorReport(driver, dname);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -12788,10 +12788,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
|
||||
@ -12827,7 +12827,7 @@ qemuDomainMigrateFinish3Params(virConnectPtr dconn,
|
||||
if (!vm) {
|
||||
virReportError(VIR_ERR_NO_DOMAIN,
|
||||
_("no domain with matching name '%s'"), dname);
|
||||
qemuMigrationErrorReport(driver, dname);
|
||||
qemuMigrationDstErrorReport(driver, dname);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -12836,10 +12836,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);
|
||||
}
|
||||
|
||||
|
||||
@ -12862,8 +12862,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
|
||||
@ -12890,8 +12890,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);
|
||||
}
|
||||
|
||||
|
||||
@ -13180,14 +13180,14 @@ qemuDomainGetJobInfoMigrationStats(virQEMUDriverPtr driver,
|
||||
jobInfo->status == QEMU_DOMAIN_JOB_STATUS_POSTCOPY) {
|
||||
if (events &&
|
||||
jobInfo->status != QEMU_DOMAIN_JOB_STATUS_ACTIVE &&
|
||||
qemuMigrationFetchStats(driver, vm, QEMU_ASYNC_JOB_NONE,
|
||||
jobInfo, NULL) < 0)
|
||||
qemuMigrationAnyFetchStats(driver, vm, QEMU_ASYNC_JOB_NONE,
|
||||
jobInfo, NULL) < 0)
|
||||
return -1;
|
||||
|
||||
if (jobInfo->status == QEMU_DOMAIN_JOB_STATUS_ACTIVE &&
|
||||
jobInfo->statsType == QEMU_DOMAIN_JOB_STATS_TYPE_MIGRATION &&
|
||||
qemuMigrationFetchMirrorStats(driver, vm, QEMU_ASYNC_JOB_NONE,
|
||||
jobInfo) < 0)
|
||||
qemuMigrationSrcFetchMirrorStats(driver, vm, QEMU_ASYNC_JOB_NONE,
|
||||
jobInfo) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuDomainJobInfoUpdateTime(jobInfo) < 0)
|
||||
@ -13582,7 +13582,7 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom,
|
||||
|
||||
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",
|
||||
_("Compressed migration is not supported by "
|
||||
"QEMU binary"));
|
||||
@ -13633,7 +13633,7 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom,
|
||||
|
||||
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",
|
||||
_("Compressed migration is not supported by "
|
||||
"QEMU binary"));
|
||||
@ -13985,7 +13985,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) {
|
||||
@ -14918,7 +14918,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 */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -25,6 +25,20 @@
|
||||
# include "qemu_conf.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 qemuMigrationCompression *qemuMigrationCompressionPtr;
|
||||
|
||||
@ -112,15 +126,15 @@ struct _qemuMigrationCompression {
|
||||
};
|
||||
|
||||
qemuMigrationCompressionPtr
|
||||
qemuMigrationCompressionParse(virTypedParameterPtr params,
|
||||
int nparams,
|
||||
unsigned long flags);
|
||||
qemuMigrationAnyCompressionParse(virTypedParameterPtr params,
|
||||
int nparams,
|
||||
unsigned long flags);
|
||||
int
|
||||
qemuMigrationCompressionDump(qemuMigrationCompressionPtr compression,
|
||||
virTypedParameterPtr *params,
|
||||
int *nparams,
|
||||
int *maxparams,
|
||||
unsigned long *flags);
|
||||
qemuMigrationAnyCompressionDump(qemuMigrationCompressionPtr compression,
|
||||
virTypedParameterPtr *params,
|
||||
int *nparams,
|
||||
int *maxparams,
|
||||
unsigned long *flags);
|
||||
|
||||
void
|
||||
qemuMigrationParamsClear(qemuMonitorMigrationParamsPtr migParams);
|
||||
@ -134,166 +148,166 @@ qemuMigrationParams(virTypedParameterPtr params,
|
||||
unsigned long flags);
|
||||
|
||||
int
|
||||
qemuMigrationSetOffline(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm);
|
||||
qemuMigrationSrcSetOffline(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,
|
||||
qemuMigrationAnyPrepareDef(virQEMUDriverPtr driver,
|
||||
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,
|
||||
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);
|
||||
|
||||
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);
|
||||
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,
|
||||
virDomainObjPtr vm,
|
||||
int fd,
|
||||
const char *compressor,
|
||||
qemuDomainAsyncJob asyncJob)
|
||||
qemuMigrationSrcToFile(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
int fd,
|
||||
const char *compressor,
|
||||
qemuDomainAsyncJob asyncJob)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
|
||||
|
||||
int
|
||||
qemuMigrationCancel(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm);
|
||||
qemuMigrationSrcCancel(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm);
|
||||
|
||||
int
|
||||
qemuMigrationFetchStats(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
qemuDomainAsyncJob asyncJob,
|
||||
qemuDomainJobInfoPtr jobInfo,
|
||||
char **error);
|
||||
qemuMigrationAnyFetchStats(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
qemuDomainAsyncJob asyncJob,
|
||||
qemuDomainJobInfoPtr jobInfo,
|
||||
char **error);
|
||||
|
||||
int
|
||||
qemuMigrationErrorInit(virQEMUDriverPtr driver);
|
||||
qemuMigrationDstErrorInit(virQEMUDriverPtr driver);
|
||||
|
||||
void
|
||||
qemuMigrationErrorSave(virQEMUDriverPtr driver,
|
||||
const char *name,
|
||||
virErrorPtr err);
|
||||
qemuMigrationDstErrorSave(virQEMUDriverPtr driver,
|
||||
const char *name,
|
||||
virErrorPtr err);
|
||||
|
||||
void
|
||||
qemuMigrationErrorReport(virQEMUDriverPtr driver,
|
||||
const char *name);
|
||||
qemuMigrationDstErrorReport(virQEMUDriverPtr driver,
|
||||
const char *name);
|
||||
|
||||
int
|
||||
qemuMigrationCheckIncoming(virQEMUCapsPtr qemuCaps,
|
||||
const char *migrateFrom);
|
||||
qemuMigrationDstCheckProtocol(virQEMUCapsPtr qemuCaps,
|
||||
const char *migrateFrom);
|
||||
|
||||
char *
|
||||
qemuMigrationIncomingURI(const char *migrateFrom,
|
||||
int migrateFd);
|
||||
qemuMigrationDstGetURI(const char *migrateFrom,
|
||||
int migrateFd);
|
||||
|
||||
int
|
||||
qemuMigrationRunIncoming(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
const char *uri,
|
||||
qemuDomainAsyncJob asyncJob);
|
||||
qemuMigrationDstRun(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
const char *uri,
|
||||
qemuDomainAsyncJob asyncJob);
|
||||
|
||||
void
|
||||
qemuMigrationPostcopyFailed(virQEMUDriverPtr driver,
|
||||
qemuMigrationAnyPostcopyFailed(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm);
|
||||
|
||||
void
|
||||
qemuMigrationReset(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
qemuDomainAsyncJob job);
|
||||
qemuMigrationParamsReset(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
qemuDomainAsyncJob job);
|
||||
|
||||
int
|
||||
qemuMigrationFetchMirrorStats(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
qemuDomainAsyncJob asyncJob,
|
||||
qemuDomainJobInfoPtr jobInfo);
|
||||
qemuMigrationSrcFetchMirrorStats(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
qemuDomainAsyncJob asyncJob,
|
||||
qemuDomainJobInfoPtr jobInfo);
|
||||
|
||||
bool
|
||||
qemuMigrationCapsGet(virDomainObjPtr vm,
|
||||
qemuMonitorMigrationCaps cap);
|
||||
qemuMigrationAnyCapsGet(virDomainObjPtr vm,
|
||||
qemuMonitorMigrationCaps cap);
|
||||
|
||||
#endif /* __QEMU_MIGRATION_H__ */
|
||||
|
@ -3069,7 +3069,7 @@ qemuProcessRecoverMigrationIn(virQEMUDriverPtr driver,
|
||||
* confirm success or failure yet; killing it seems safest unless
|
||||
* we already started guest CPUs or we were in post-copy mode */
|
||||
if (postcopy) {
|
||||
qemuMigrationPostcopyFailed(driver, vm);
|
||||
qemuMigrationAnyPostcopyFailed(driver, vm);
|
||||
} else if (state != VIR_DOMAIN_RUNNING) {
|
||||
VIR_DEBUG("Killing migrated domain %s", vm->def->name);
|
||||
return -1;
|
||||
@ -3077,7 +3077,7 @@ qemuProcessRecoverMigrationIn(virQEMUDriverPtr driver,
|
||||
break;
|
||||
}
|
||||
|
||||
qemuMigrationReset(driver, vm, QEMU_ASYNC_JOB_NONE);
|
||||
qemuMigrationParamsReset(driver, vm, QEMU_ASYNC_JOB_NONE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3115,11 +3115,11 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver,
|
||||
* post-copy mode
|
||||
*/
|
||||
if (postcopy) {
|
||||
qemuMigrationPostcopyFailed(driver, vm);
|
||||
qemuMigrationAnyPostcopyFailed(driver, vm);
|
||||
} else {
|
||||
VIR_DEBUG("Cancelling unfinished migration of domain %s",
|
||||
vm->def->name);
|
||||
if (qemuMigrationCancel(driver, vm) < 0) {
|
||||
if (qemuMigrationSrcCancel(driver, vm) < 0) {
|
||||
VIR_WARN("Could not cancel ongoing migration of domain %s",
|
||||
vm->def->name);
|
||||
}
|
||||
@ -3133,7 +3133,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver,
|
||||
* post-copy mode we can use PAUSED_POSTCOPY_FAILED state for this
|
||||
*/
|
||||
if (postcopy)
|
||||
qemuMigrationPostcopyFailed(driver, vm);
|
||||
qemuMigrationAnyPostcopyFailed(driver, vm);
|
||||
break;
|
||||
|
||||
case QEMU_MIGRATION_PHASE_CONFIRM3_CANCELLED:
|
||||
@ -3142,7 +3142,7 @@ qemuProcessRecoverMigrationOut(virQEMUDriverPtr driver,
|
||||
* as broken in that case
|
||||
*/
|
||||
if (postcopy) {
|
||||
qemuMigrationPostcopyFailed(driver, vm);
|
||||
qemuMigrationAnyPostcopyFailed(driver, vm);
|
||||
} else {
|
||||
VIR_DEBUG("Resuming domain %s after failed migration",
|
||||
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;
|
||||
}
|
||||
|
||||
@ -4142,7 +4142,7 @@ qemuProcessIncomingDefNew(virQEMUCapsPtr qemuCaps,
|
||||
{
|
||||
qemuProcessIncomingDefPtr inc = NULL;
|
||||
|
||||
if (qemuMigrationCheckIncoming(qemuCaps, migrateFrom) < 0)
|
||||
if (qemuMigrationDstCheckProtocol(qemuCaps, migrateFrom) < 0)
|
||||
return NULL;
|
||||
|
||||
if (VIR_ALLOC(inc) < 0)
|
||||
@ -4151,7 +4151,7 @@ qemuProcessIncomingDefNew(virQEMUCapsPtr qemuCaps,
|
||||
if (VIR_STRDUP(inc->address, listenAddress) < 0)
|
||||
goto error;
|
||||
|
||||
inc->launchURI = qemuMigrationIncomingURI(migrateFrom, fd);
|
||||
inc->launchURI = qemuMigrationDstGetURI(migrateFrom, fd);
|
||||
if (!inc->launchURI)
|
||||
goto error;
|
||||
|
||||
@ -6348,7 +6348,7 @@ qemuProcessStart(virConnectPtr conn,
|
||||
|
||||
if (incoming &&
|
||||
incoming->deferredURI &&
|
||||
qemuMigrationRunIncoming(driver, vm, incoming->deferredURI, asyncJob) < 0)
|
||||
qemuMigrationDstRun(driver, vm, incoming->deferredURI, asyncJob) < 0)
|
||||
goto stop;
|
||||
|
||||
if (qemuProcessFinishStartup(driver, vm, asyncJob,
|
||||
|
@ -447,8 +447,8 @@ testCompareXMLToArgv(const void *data)
|
||||
goto cleanup;
|
||||
|
||||
if (info->migrateFrom &&
|
||||
!(migrateURI = qemuMigrationIncomingURI(info->migrateFrom,
|
||||
info->migrateFd)))
|
||||
!(migrateURI = qemuMigrationDstGetURI(info->migrateFrom,
|
||||
info->migrateFd)))
|
||||
goto cleanup;
|
||||
|
||||
if (!(vm = virDomainObjNew(driver.xmlopt)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user