mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-24 04:12:20 +00:00
qemu: Move qemuDomainCheckMigrationCapabilities
Since the function is tightly connected to migration, it was renamed as qemuMigrationCapsCheck and moved to qemu_migration_params.c. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
0eceb3bc14
commit
1ce205f93e
@ -11782,78 +11782,6 @@ qemuDomainCheckCCWS390AddressSupport(const virDomainDef *def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
qemuDomainCheckMigrationCapabilities(virQEMUDriverPtr driver,
|
|
||||||
virDomainObjPtr vm,
|
|
||||||
qemuDomainAsyncJob asyncJob)
|
|
||||||
{
|
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
|
||||||
char **caps = NULL;
|
|
||||||
char **capStr;
|
|
||||||
int ret = -1;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
rc = qemuMonitorGetMigrationCapabilities(priv->mon, &caps);
|
|
||||||
|
|
||||||
if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (!caps) {
|
|
||||||
ret = 0;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
priv->migrationCaps = virBitmapNew(QEMU_MONITOR_MIGRATION_CAPS_LAST);
|
|
||||||
if (!priv->migrationCaps)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
for (capStr = caps; *capStr; capStr++) {
|
|
||||||
int cap = qemuMonitorMigrationCapsTypeFromString(*capStr);
|
|
||||||
|
|
||||||
if (cap < 0) {
|
|
||||||
VIR_DEBUG("Unknown migration capability: '%s'", *capStr);
|
|
||||||
} else {
|
|
||||||
ignore_value(virBitmapSetBit(priv->migrationCaps, cap));
|
|
||||||
VIR_DEBUG("Found migration capability: '%s'", *capStr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT)) {
|
|
||||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
rc = qemuMonitorSetMigrationCapability(priv->mon,
|
|
||||||
QEMU_MONITOR_MIGRATION_CAPS_EVENTS,
|
|
||||||
true);
|
|
||||||
|
|
||||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (rc < 0) {
|
|
||||||
virResetLastError();
|
|
||||||
VIR_DEBUG("Cannot enable migration events; clearing capability");
|
|
||||||
virQEMUCapsClear(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Migration events capability must always be enabled, clearing it from
|
|
||||||
* migration capabilities bitmap makes sure it won't be touched anywhere
|
|
||||||
* else.
|
|
||||||
*/
|
|
||||||
ignore_value(virBitmapClearBit(priv->migrationCaps,
|
|
||||||
QEMU_MONITOR_MIGRATION_CAPS_EVENTS));
|
|
||||||
|
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
virStringListFree(caps);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qemuDomainPrepareDiskSourceChain:
|
* qemuDomainPrepareDiskSourceChain:
|
||||||
*
|
*
|
||||||
|
@ -982,10 +982,6 @@ bool qemuDomainCheckCCWS390AddressSupport(const virDomainDef *def,
|
|||||||
const char *devicename);
|
const char *devicename);
|
||||||
|
|
||||||
int
|
int
|
||||||
qemuDomainCheckMigrationCapabilities(virQEMUDriverPtr driver,
|
|
||||||
virDomainObjPtr vm,
|
|
||||||
qemuDomainAsyncJob asyncJob);
|
|
||||||
int
|
|
||||||
qemuDomainPrepareDiskSourceChain(virDomainDiskDefPtr disk,
|
qemuDomainPrepareDiskSourceChain(virDomainDiskDefPtr disk,
|
||||||
virStorageSourcePtr src,
|
virStorageSourcePtr src,
|
||||||
virQEMUDriverConfigPtr cfg,
|
virQEMUDriverConfigPtr cfg,
|
||||||
|
@ -452,3 +452,75 @@ qemuMigrationParamsReset(virQEMUDriverPtr driver,
|
|||||||
virFreeError(err);
|
virFreeError(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
qemuMigrationCapsCheck(virQEMUDriverPtr driver,
|
||||||
|
virDomainObjPtr vm,
|
||||||
|
int asyncJob)
|
||||||
|
{
|
||||||
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
|
char **caps = NULL;
|
||||||
|
char **capStr;
|
||||||
|
int ret = -1;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
rc = qemuMonitorGetMigrationCapabilities(priv->mon, &caps);
|
||||||
|
|
||||||
|
if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (!caps) {
|
||||||
|
ret = 0;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
priv->migrationCaps = virBitmapNew(QEMU_MONITOR_MIGRATION_CAPS_LAST);
|
||||||
|
if (!priv->migrationCaps)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
for (capStr = caps; *capStr; capStr++) {
|
||||||
|
int cap = qemuMonitorMigrationCapsTypeFromString(*capStr);
|
||||||
|
|
||||||
|
if (cap < 0) {
|
||||||
|
VIR_DEBUG("Unknown migration capability: '%s'", *capStr);
|
||||||
|
} else {
|
||||||
|
ignore_value(virBitmapSetBit(priv->migrationCaps, cap));
|
||||||
|
VIR_DEBUG("Found migration capability: '%s'", *capStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT)) {
|
||||||
|
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
rc = qemuMonitorSetMigrationCapability(priv->mon,
|
||||||
|
QEMU_MONITOR_MIGRATION_CAPS_EVENTS,
|
||||||
|
true);
|
||||||
|
|
||||||
|
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (rc < 0) {
|
||||||
|
virResetLastError();
|
||||||
|
VIR_DEBUG("Cannot enable migration events; clearing capability");
|
||||||
|
virQEMUCapsClear(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Migration events capability must always be enabled, clearing it from
|
||||||
|
* migration capabilities bitmap makes sure it won't be touched anywhere
|
||||||
|
* else.
|
||||||
|
*/
|
||||||
|
ignore_value(virBitmapClearBit(priv->migrationCaps,
|
||||||
|
QEMU_MONITOR_MIGRATION_CAPS_EVENTS));
|
||||||
|
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
virStringListFree(caps);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
@ -79,4 +79,9 @@ qemuMigrationParamsReset(virQEMUDriverPtr driver,
|
|||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
int asyncJob);
|
int asyncJob);
|
||||||
|
|
||||||
|
int
|
||||||
|
qemuMigrationCapsCheck(virQEMUDriverPtr driver,
|
||||||
|
virDomainObjPtr vm,
|
||||||
|
int asyncJob);
|
||||||
|
|
||||||
#endif /* __QEMU_MIGRATION_PARAMS_H__ */
|
#endif /* __QEMU_MIGRATION_PARAMS_H__ */
|
||||||
|
@ -1840,7 +1840,7 @@ qemuConnectMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm, int asyncJob,
|
|||||||
if (qemuProcessInitMonitor(driver, vm, asyncJob) < 0)
|
if (qemuProcessInitMonitor(driver, vm, asyncJob) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (qemuDomainCheckMigrationCapabilities(driver, vm, asyncJob) < 0)
|
if (qemuMigrationCapsCheck(driver, vm, asyncJob) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user