summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Denemark <jdenemar@redhat.com>2011-06-27 11:25:19 +0200
committerJiri Denemark <jdenemar@redhat.com>2011-06-28 14:21:50 +0200
commitad7b327690a85d9cf802d53f2c9f4f61db0171ee (patch)
treeb8db9093f44413a2d117ece69c2609f9c3662bd4
parentnwfilter: Return error message about unresolvable variables (diff)
downloadlibvirt-ad7b327690a85d9cf802d53f2c9f4f61db0171ee.tar.gz
libvirt-ad7b327690a85d9cf802d53f2c9f4f61db0171ee.tar.bz2
libvirt-ad7b327690a85d9cf802d53f2c9f4f61db0171ee.zip
qemu: Fix update device for CURRENT + FORCE flags
When CURRENT and FORCE flags were used together, UpdateDeviceFlags did nothing because it failed to transform CURRENT into either LIVE or CONFIG.
-rw-r--r--src/qemu/qemu_driver.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8fcc266f9..8b65c2646 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4789,12 +4789,15 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
virDomainDeviceDefPtr dev = NULL;
bool force = (flags & VIR_DOMAIN_DEVICE_MODIFY_FORCE) != 0;
int ret = -1;
+ unsigned int affect;
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
VIR_DOMAIN_AFFECT_CONFIG |
(action == QEMU_DEVICE_UPDATE ?
VIR_DOMAIN_DEVICE_MODIFY_FORCE : 0), -1);
+ affect = flags & (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG);
+
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) {
@@ -4809,10 +4812,10 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
goto cleanup;
if (virDomainObjIsActive(vm)) {
- if (flags == VIR_DOMAIN_AFFECT_CURRENT)
+ if (affect == VIR_DOMAIN_AFFECT_CURRENT)
flags |= VIR_DOMAIN_AFFECT_LIVE;
} else {
- if (flags == VIR_DOMAIN_AFFECT_CURRENT)
+ if (affect == VIR_DOMAIN_AFFECT_CURRENT)
flags |= VIR_DOMAIN_AFFECT_CONFIG;
/* check consistency between flags and the vm state */
if (flags & VIR_DOMAIN_AFFECT_LIVE) {