From 98cec052882c9acb5e3b8bc3f8e8a37a2cdb2982 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 4 May 2012 09:43:23 -0600 Subject: [PATCH] qemu: don't modify domain on failed blockiotune If you have a qemu build that lacks the blockio tune monitor command, then this command: $ virsh blkdeviotune rhel6u2 hda --total_bytes_sec 1000 error: Unable to change block I/O throttle error: internal error Unexpected error fails as expected (well, the error message is lousy), but the next dumpxml shows that the domain was modified anyway. Worse, that means if you save the domain then restore it, the restore will likely fail due to throttling being unsupported, even though no throttling should even be active because the monitor command failed in the first place. * src/qemu/qemu_driver.c (qemuDomainSetBlockIoTune): Check for error before making modification permanent. --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a36c348724..2fde15b4a0 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12011,9 +12011,9 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, qemuDomainObjEnterMonitorWithDriver(driver, vm); ret = qemuMonitorSetBlockIoThrottle(priv->mon, device, &info); qemuDomainObjExitMonitorWithDriver(driver, vm); - vm->def->disks[idx]->blkdeviotune = info; if (ret < 0) goto endjob; + vm->def->disks[idx]->blkdeviotune = info; } if (flags & VIR_DOMAIN_AFFECT_CONFIG) { -- GitLab