qemu: Resolve Coverity DEADCODE.
reported here: http://www.redhat.com/archives/libvir-list/2014-November/msg00327.html I could have just remove bool supportMaxOptions variable, but if I had do this, we could not check anymore if the nparams variable is superior to QEMU_NB_BLOCK_IO_TUNE_PARAM_MAX. v2: change following this proposal: http://www.redhat.com/archives/libvir-list/2014-November/msg00379.html
This commit is contained in:
parent
5fb007b035
commit
6c1347ec06
@ -17003,14 +17003,16 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
|
|||||||
&persistentDef) < 0)
|
&persistentDef) < 0)
|
||||||
goto endjob;
|
goto endjob;
|
||||||
|
|
||||||
|
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
||||||
|
/* If the VM is running, we can check if the current VM can use
|
||||||
|
* optional parameters or not. We didn't made this check sooner
|
||||||
|
* because we need vm->privateData which need
|
||||||
|
* virDomainLiveConfigHelperMethod to do so. */
|
||||||
|
priv = vm->privateData;
|
||||||
|
supportMaxOptions = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
if ((*nparams) == 0) {
|
if ((*nparams) == 0) {
|
||||||
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
|
||||||
priv = vm->privateData;
|
|
||||||
/* If the VM is running, we can check if the current VM can use
|
|
||||||
* optional parameters or not. We didn't made this check sooner
|
|
||||||
* because we need the VM data to do so. */
|
|
||||||
supportMaxOptions = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX);
|
|
||||||
}
|
|
||||||
*nparams = supportMaxOptions ?
|
*nparams = supportMaxOptions ?
|
||||||
QEMU_NB_BLOCK_IO_TUNE_PARAM_MAX : QEMU_NB_BLOCK_IO_TUNE_PARAM;
|
QEMU_NB_BLOCK_IO_TUNE_PARAM_MAX : QEMU_NB_BLOCK_IO_TUNE_PARAM;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
@ -17023,7 +17025,6 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
|
||||||
priv = vm->privateData;
|
|
||||||
qemuDomainObjEnterMonitor(driver, vm);
|
qemuDomainObjEnterMonitor(driver, vm);
|
||||||
ret = qemuMonitorGetBlockIoThrottle(priv->mon, device, &reply, supportMaxOptions);
|
ret = qemuMonitorGetBlockIoThrottle(priv->mon, device, &reply, supportMaxOptions);
|
||||||
qemuDomainObjExitMonitor(driver, vm);
|
qemuDomainObjExitMonitor(driver, vm);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user