virDomainSetBlockIoTune not simply sets the iotune params given in API
but use current settings for all the omitted params. Unfortunately
it uses current settings for active config when setting inactive
params. Let's fix it.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
src/qemu/qemu_driver.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c41179edb1..f1ee25aebd 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -19115,6 +19115,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
virDomainDefPtr def = NULL;
virDomainDefPtr persistentDef = NULL;
virDomainBlockIoTuneInfo info;
+ virDomainBlockIoTuneInfo conf_info;
g_autofree char *drivealias = NULL;
const char *qdevid = NULL;
int ret = -1;
@@ -19178,6 +19179,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
return -1;
memset(&info, 0, sizeof(info));
+ memset(&conf_info, 0, sizeof(conf_info));
if (!(vm = qemuDomainObjFromDomain(dom)))
return -1;
@@ -19302,6 +19304,9 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
goto endjob;
}
+ conf_info = info;
+ conf_info.group_name = g_strdup(info.group_name);
+
if (def) {
supportMaxOptions = virQEMUCapsGet(priv->qemuCaps,
QEMU_CAPS_DRIVE_IOTUNE_MAX);
@@ -19422,11 +19427,11 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
goto endjob;
}
- if (qemuDomainSetBlockIoTuneDefaults(&info, &conf_disk->blkdeviotune,
+ if (qemuDomainSetBlockIoTuneDefaults(&conf_info,
&conf_disk->blkdeviotune,
set_fields) < 0)
goto endjob;
- if (virDomainDiskSetBlockIOTune(conf_disk, &info) < 0)
+ if (virDomainDiskSetBlockIOTune(conf_disk, &conf_info) < 0)
goto endjob;
if (virDomainDefSave(persistentDef, driver->xmlopt,
@@ -19440,6 +19445,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
cleanup:
VIR_FREE(info.group_name);
+ VIR_FREE(conf_info.group_name);
virDomainObjEndAPI(&vm);
if (eventNparams)
virTypedParamsFree(eventParams, eventNparams);
--
2.23.0