|
|
c401cc |
From fd15ef11527807e3e80333585dc908f1c414bc06 Mon Sep 17 00:00:00 2001
|
|
|
c401cc |
Message-Id: <fd15ef11527807e3e80333585dc908f1c414bc06@dist-git>
|
|
|
c401cc |
From: Michal Privoznik <mprivozn@redhat.com>
|
|
|
c401cc |
Date: Mon, 17 Mar 2014 15:48:30 +0100
|
|
|
c401cc |
Subject: [PATCH] qemu: Introduce qemuDomainDefCheckABIStability
|
|
|
c401cc |
|
|
|
c401cc |
https://bugzilla.redhat.com/show_bug.cgi?id=994364
|
|
|
c401cc |
https://bugzilla.redhat.com/show_bug.cgi?id=1076503
|
|
|
c401cc |
|
|
|
c401cc |
Whenever we check for ABI stability, we have new xml (e.g. provided by
|
|
|
c401cc |
user, or obtained from snapshot, whatever) which we compare to old xml
|
|
|
c401cc |
and see if ABI won't break. However, if the new xml was produced via
|
|
|
c401cc |
virDomainGetXMLDesc(..., VIR_DOMAIN_XML_MIGRATABLE) it lacks some
|
|
|
c401cc |
devices, e.g. 'pci-root' controller. Hence, the ABI stability check
|
|
|
c401cc |
fails even though it is stable. Moreover, we can't simply fix
|
|
|
c401cc |
virDomainDefCheckABIStability because removing the correct devices is
|
|
|
c401cc |
task for the driver. For instance, qemu driver wants to remove the usb
|
|
|
c401cc |
controller too, while LXC driver doesn't. That's why we need special
|
|
|
c401cc |
qemu wrapper over virDomainDefCheckABIStability which removes the
|
|
|
c401cc |
correct devices from domain XML, produces MIGRATABLE xml and calls the
|
|
|
c401cc |
check ABI stability function.
|
|
|
c401cc |
|
|
|
c401cc |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
c401cc |
(cherry picked from commit 7d704812b9c50cd3804dd1e7f9e2ea3e75fdc847)
|
|
|
c401cc |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
c401cc |
---
|
|
|
c401cc |
src/qemu/qemu_domain.c | 22 ++++++++++++++++++++++
|
|
|
c401cc |
src/qemu/qemu_domain.h | 3 +++
|
|
|
c401cc |
src/qemu/qemu_driver.c | 10 ++--------
|
|
|
c401cc |
src/qemu/qemu_migration.c | 4 ++--
|
|
|
c401cc |
4 files changed, 29 insertions(+), 10 deletions(-)
|
|
|
c401cc |
|
|
|
c401cc |
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
|
|
c401cc |
index 7f4d17d..0b57b6a 100644
|
|
|
c401cc |
--- a/src/qemu/qemu_domain.c
|
|
|
c401cc |
+++ b/src/qemu/qemu_domain.c
|
|
|
c401cc |
@@ -2327,3 +2327,25 @@ qemuDomainUpdateDeviceList(virQEMUDriverPtr driver,
|
|
|
c401cc |
priv->qemuDevices = aliases;
|
|
|
c401cc |
return 0;
|
|
|
c401cc |
}
|
|
|
c401cc |
+
|
|
|
c401cc |
+bool
|
|
|
c401cc |
+qemuDomainDefCheckABIStability(virQEMUDriverPtr driver,
|
|
|
c401cc |
+ virDomainDefPtr src,
|
|
|
c401cc |
+ virDomainDefPtr dst)
|
|
|
c401cc |
+{
|
|
|
c401cc |
+ virDomainDefPtr migratableDefSrc = NULL;
|
|
|
c401cc |
+ virDomainDefPtr migratableDefDst = NULL;
|
|
|
c401cc |
+ const int flags = VIR_DOMAIN_XML_SECURE | VIR_DOMAIN_XML_UPDATE_CPU | VIR_DOMAIN_XML_MIGRATABLE;
|
|
|
c401cc |
+ bool ret = false;
|
|
|
c401cc |
+
|
|
|
c401cc |
+ if (!(migratableDefSrc = qemuDomainDefCopy(driver, src, flags)) ||
|
|
|
c401cc |
+ !(migratableDefDst = qemuDomainDefCopy(driver, dst, flags)))
|
|
|
c401cc |
+ goto cleanup;
|
|
|
c401cc |
+
|
|
|
c401cc |
+ ret = virDomainDefCheckABIStability(migratableDefSrc, migratableDefDst);
|
|
|
c401cc |
+
|
|
|
c401cc |
+cleanup:
|
|
|
c401cc |
+ virDomainDefFree(migratableDefSrc);
|
|
|
c401cc |
+ virDomainDefFree(migratableDefDst);
|
|
|
c401cc |
+ return ret;
|
|
|
c401cc |
+}
|
|
|
c401cc |
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
|
|
|
c401cc |
index 9735761..91e9ade 100644
|
|
|
c401cc |
--- a/src/qemu/qemu_domain.h
|
|
|
c401cc |
+++ b/src/qemu/qemu_domain.h
|
|
|
c401cc |
@@ -370,4 +370,7 @@ extern virDomainDefParserConfig virQEMUDriverDomainDefParserConfig;
|
|
|
c401cc |
int qemuDomainUpdateDeviceList(virQEMUDriverPtr driver,
|
|
|
c401cc |
virDomainObjPtr vm);
|
|
|
c401cc |
|
|
|
c401cc |
+bool qemuDomainDefCheckABIStability(virQEMUDriverPtr driver,
|
|
|
c401cc |
+ virDomainDefPtr src,
|
|
|
c401cc |
+ virDomainDefPtr dst);
|
|
|
c401cc |
#endif /* __QEMU_DOMAIN_H__ */
|
|
|
c401cc |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
c401cc |
index cc6c133..89be90c 100644
|
|
|
c401cc |
--- a/src/qemu/qemu_driver.c
|
|
|
c401cc |
+++ b/src/qemu/qemu_driver.c
|
|
|
c401cc |
@@ -3090,7 +3090,7 @@ qemuDomainSaveInternal(virQEMUDriverPtr driver, virDomainPtr dom,
|
|
|
c401cc |
VIR_DOMAIN_XML_INACTIVE))) {
|
|
|
c401cc |
goto endjob;
|
|
|
c401cc |
}
|
|
|
c401cc |
- if (!virDomainDefCheckABIStability(vm->def, def)) {
|
|
|
c401cc |
+ if (!qemuDomainDefCheckABIStability(driver, vm->def, def)) {
|
|
|
c401cc |
virDomainDefFree(def);
|
|
|
c401cc |
goto endjob;
|
|
|
c401cc |
}
|
|
|
c401cc |
@@ -13839,7 +13839,6 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
|
|
|
c401cc |
qemuDomainObjPrivatePtr priv;
|
|
|
c401cc |
int rc;
|
|
|
c401cc |
virDomainDefPtr config = NULL;
|
|
|
c401cc |
- virDomainDefPtr migratableDef = NULL;
|
|
|
c401cc |
virQEMUDriverConfigPtr cfg = NULL;
|
|
|
c401cc |
virCapsPtr caps = NULL;
|
|
|
c401cc |
|
|
|
c401cc |
@@ -13956,11 +13955,7 @@ static int qemuDomainRevertToSnapshot(virDomainSnapshotPtr snapshot,
|
|
|
c401cc |
/* Transitions 5, 6, 8, 9 */
|
|
|
c401cc |
/* Check for ABI compatibility. We need to do this check against
|
|
|
c401cc |
* the migratable XML or it will always fail otherwise */
|
|
|
c401cc |
- if (!(migratableDef = qemuDomainDefCopy(driver, vm->def,
|
|
|
c401cc |
- VIR_DOMAIN_XML_MIGRATABLE)))
|
|
|
c401cc |
- goto cleanup;
|
|
|
c401cc |
-
|
|
|
c401cc |
- if (config && !virDomainDefCheckABIStability(migratableDef, config)) {
|
|
|
c401cc |
+ if (config && !qemuDomainDefCheckABIStability(driver, vm->def, config)) {
|
|
|
c401cc |
virErrorPtr err = virGetLastError();
|
|
|
c401cc |
|
|
|
c401cc |
if (!(flags & VIR_DOMAIN_SNAPSHOT_REVERT_FORCE)) {
|
|
|
c401cc |
@@ -14165,7 +14160,6 @@ cleanup:
|
|
|
c401cc |
}
|
|
|
c401cc |
if (vm)
|
|
|
c401cc |
virObjectUnlock(vm);
|
|
|
c401cc |
- virDomainDefFree(migratableDef);
|
|
|
c401cc |
virObjectUnref(caps);
|
|
|
c401cc |
virObjectUnref(cfg);
|
|
|
c401cc |
|
|
|
c401cc |
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
|
|
|
c401cc |
index 03ae9e4..deacb66 100644
|
|
|
c401cc |
--- a/src/qemu/qemu_migration.c
|
|
|
c401cc |
+++ b/src/qemu/qemu_migration.c
|
|
|
c401cc |
@@ -2088,7 +2088,7 @@ static char
|
|
|
c401cc |
VIR_DOMAIN_XML_INACTIVE)))
|
|
|
c401cc |
goto cleanup;
|
|
|
c401cc |
|
|
|
c401cc |
- if (!virDomainDefCheckABIStability(vm->def, def))
|
|
|
c401cc |
+ if (!qemuDomainDefCheckABIStability(driver, vm->def, def))
|
|
|
c401cc |
goto cleanup;
|
|
|
c401cc |
|
|
|
c401cc |
rv = qemuDomainDefFormatLive(driver, def, false, true);
|
|
|
c401cc |
@@ -2297,7 +2297,7 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
|
|
|
c401cc |
if (!newdef)
|
|
|
c401cc |
goto cleanup;
|
|
|
c401cc |
|
|
|
c401cc |
- if (!virDomainDefCheckABIStability(*def, newdef)) {
|
|
|
c401cc |
+ if (!qemuDomainDefCheckABIStability(driver, *def, newdef)) {
|
|
|
c401cc |
virDomainDefFree(newdef);
|
|
|
c401cc |
goto cleanup;
|
|
|
c401cc |
}
|
|
|
c401cc |
--
|
|
|
c401cc |
1.9.0
|
|
|
c401cc |
|