On 11/13/2014 10:21 PM, Luyao Huang wrote:
It would help to put the bz link in here:
https://bugzilla.redhat.com/show_bug.cgi?id=1164080
When we try to get a hot-unplug disk blkdevio settings via
qemuDomainGetBlockIoTune, libvirt will output a cannot find
device error.Move the check after confirm vm is running.
"Technically" speaking you're not moving the check after confirming the
vm is running because it is already after that via the call to
virDomainLiveConfigHelperMethod which calls virDomainObjIsActive before
determining how to set *flags.
You're moving the check to only when it's desired to get something from
the active vm (e.g., when the vm is running or the --live flag was
used). Since the 'device' is only ever used within that call - it's
safe/right to move it.
I updated the bug report with some other details regarding expectations.
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
src/qemu/qemu_driver.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 411179d..c717c76 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17031,12 +17031,11 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
goto endjob;
}
- device = qemuDiskPathToAlias(vm, disk, NULL);
- if (!device) {
- goto endjob;
- }
-
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
+ device = qemuDiskPathToAlias(vm, disk, NULL);
+ if (!device) {
+ goto endjob;
+ }
mkletzan's recent changes remove the unnecessary brackets.
I'll clean this up and push shortly
John
qemuDomainObjEnterMonitor(driver, vm);
ret = qemuMonitorGetBlockIoThrottle(priv->mon, device, &reply,
supportMaxOptions);
qemuDomainObjExitMonitor(driver, vm);