]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Fix get blkiodevtune for a disk that has been hot unplugged
authorLuyao Huang <lhuang@redhat.com>
Fri, 14 Nov 2014 03:21:10 +0000 (11:21 +0800)
committerJohn Ferlan <jferlan@redhat.com>
Fri, 14 Nov 2014 22:30:55 +0000 (17:30 -0500)
https://bugzilla.redhat.com/show_bug.cgi?id=1164080

After a disk is hotunplugged a subsequent call to qemuDomainGetBlockIoTune
to get the --config settings of that disk will fail because the disk is no
longer found by qemuDiskPathToAlias causing an unexpected failure.

Since only the --live flag needs to have the disk device pointer, move the
fetch inside the (flags & VIR_DOMAIN_AFFECT_LIVE) condition. This will also
affect the results if no flags are provided or the --current flag is provided.

Signed-off-by: Luyao Huang <lhuang@redhat.com>
src/qemu/qemu_driver.c

index 7e21ffdf24567d9867d92057a4693c6c542b8394..9b19629a02ba11c7785eefba0725cb82e71a5f24 100644 (file)
@@ -17017,11 +17017,10 @@ 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;
         qemuDomainObjEnterMonitor(driver, vm);
         ret = qemuMonitorGetBlockIoThrottle(priv->mon, device, &reply, supportMaxOptions);
         qemuDomainObjExitMonitor(driver, vm);