qemu: Use qemuDomainCheckABIStability where needed

Most places which want to check ABI stability for an active domain need
to call this API rather than the original
qemuDomainDefCheckABIStability. The only exception is in snapshots where
we need to decide what to do depending on the saved image data.

https://bugzilla.redhat.com/show_bug.cgi?id=1460952

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Jiri Denemark 2017-06-14 14:56:21 +02:00
parent 063b2b8788
commit f0a3fe1b0a
2 changed files with 42 additions and 31 deletions

View File

@ -3340,7 +3340,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE))) {
goto endjob;
}
if (!qemuDomainDefCheckABIStability(driver, vm->def, def)) {
if (!qemuDomainCheckABIStability(driver, vm, def)) {
virDomainDefFree(def);
goto endjob;
}
@ -15412,19 +15412,29 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
* to have finer control. */
if (virDomainObjIsActive(vm)) {
/* Transitions 5, 6, 8, 9 */
/* Check for ABI compatibility. We need to do this check against
* the migratable XML or it will always fail otherwise */
if (config) {
bool compatible;
/* Replace the CPU in config and put the original one in priv
* once we're done.
* once we're done. When we have the updated CPU def in the
* cookie, we don't want to replace the CPU in migratable def
* when doing ABI checks to make sure the current CPU exactly
* matches the one used at the time the snapshot was taken.
*/
if (cookie && cookie->cpu && config->cpu) {
origCPU = config->cpu;
if (!(config->cpu = virCPUDefCopy(cookie->cpu)))
goto endjob;
compatible = qemuDomainDefCheckABIStability(driver, vm->def,
config);
} else {
compatible = qemuDomainCheckABIStability(driver, vm, config);
}
/* Check for ABI compatibility. We need to do this check against
* the migratable XML or it will always fail otherwise */
if (config &&
!qemuDomainDefCheckABIStability(driver, vm->def, config)) {
if (!compatible) {
virErrorPtr err = virGetLastError();
if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_FORCE)) {
@ -15446,6 +15456,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
qemuDomainEventQueue(driver, event);
goto load;
}
}
priv = vm->privateData;
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {

View File

@ -2059,7 +2059,7 @@ qemuMigrationBeginPhase(virQEMUDriverPtr driver,
VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)))
goto cleanup;
if (!qemuDomainDefCheckABIStability(driver, vm->def, def))
if (!qemuDomainCheckABIStability(driver, vm, def))
goto cleanup;
rv = qemuDomainDefFormatLive(driver, def, NULL, false, true);