提交 f72f0642 编写于 作者: J John Ferlan

qemu_driver: Resolve Coverity COPY_PASTE_ERROR

In qemuDomainSetBlkioParameters(), Coverity points out that the calls
to qemuDomainParseBlkioDeviceStr() are slightly different and points
out there may be a cut-n-paste error.

In the first call (AFFECT_LIVE), the second parameter is "param->field";
however, for the second call (AFFECT_CONFIG), the second parameter is
"params->field".  It seems the "param->field" is correct especially since
each path as a setting of "param" to "&params[i]".  Furthermore, there
were a few more instances of using "params[i]" instead of "param->"
which I cleaned up.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 b635b7a1
...@@ -7826,7 +7826,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom, ...@@ -7826,7 +7826,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
virTypedParameterPtr param = &params[i]; virTypedParameterPtr param = &params[i];
if (STREQ(param->field, VIR_DOMAIN_BLKIO_WEIGHT)) { if (STREQ(param->field, VIR_DOMAIN_BLKIO_WEIGHT)) {
if (virCgroupSetBlkioWeight(priv->cgroup, params[i].value.ui) < 0) if (virCgroupSetBlkioWeight(priv->cgroup, param->value.ui) < 0)
ret = -1; ret = -1;
} else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT) || } else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT) ||
STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS) || STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS) ||
...@@ -7837,7 +7837,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom, ...@@ -7837,7 +7837,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
virBlkioDevicePtr devices = NULL; virBlkioDevicePtr devices = NULL;
size_t j; size_t j;
if (qemuDomainParseBlkioDeviceStr(params[i].value.s, if (qemuDomainParseBlkioDeviceStr(param->value.s,
param->field, param->field,
&devices, &devices,
&ndevices) < 0) { &ndevices) < 0) {
...@@ -7920,7 +7920,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom, ...@@ -7920,7 +7920,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
virTypedParameterPtr param = &params[i]; virTypedParameterPtr param = &params[i];
if (STREQ(param->field, VIR_DOMAIN_BLKIO_WEIGHT)) { if (STREQ(param->field, VIR_DOMAIN_BLKIO_WEIGHT)) {
persistentDef->blkio.weight = params[i].value.ui; persistentDef->blkio.weight = param->value.ui;
} else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT) || } else if (STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT) ||
STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS) || STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS) ||
STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS) || STREQ(param->field, VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS) ||
...@@ -7929,8 +7929,8 @@ qemuDomainSetBlkioParameters(virDomainPtr dom, ...@@ -7929,8 +7929,8 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
virBlkioDevicePtr devices = NULL; virBlkioDevicePtr devices = NULL;
size_t ndevices; size_t ndevices;
if (qemuDomainParseBlkioDeviceStr(params[i].value.s, if (qemuDomainParseBlkioDeviceStr(param->value.s,
params->field, param->field,
&devices, &devices,
&ndevices) < 0) { &ndevices) < 0) {
ret = -1; ret = -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册