[libvirt] [PATCH v2 05/12] qemu: Use qemuDomainsetBlockIoTuneSetDefaults for config

John Ferlan jferlan at redhat.com
Thu Oct 6 22:38:53 UTC 2016


Rather than repeat the lines in the persistent def, use the same helper
to set config values.

This also fixes a bug where config values for *_max and size_iops_sec would
be set back to 0 if a config value was set.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/qemu/qemu_driver.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fcce3f0..a5f7d0c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17336,7 +17336,6 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
     virDomainDefPtr def = NULL;
     virDomainDefPtr persistentDef = NULL;
     virDomainBlockIoTuneInfo info;
-    virDomainBlockIoTuneInfo *oldinfo;
     char *device = NULL;
     int ret = -1;
     size_t i;
@@ -17561,17 +17560,9 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
                            path);
             goto endjob;
         }
-        oldinfo = &conf_disk->blkdeviotune;
-        if (!set_bytes) {
-            info.total_bytes_sec = oldinfo->total_bytes_sec;
-            info.read_bytes_sec = oldinfo->read_bytes_sec;
-            info.write_bytes_sec = oldinfo->write_bytes_sec;
-        }
-        if (!set_iops) {
-            info.total_iops_sec = oldinfo->total_iops_sec;
-            info.read_iops_sec = oldinfo->read_iops_sec;
-            info.write_iops_sec = oldinfo->write_iops_sec;
-        }
+        qemuDomainSetBlockIoTuneSetDefaults(&info, &conf_disk->blkdeviotune,
+                                            set_bytes, set_iops, set_bytes_max,
+                                            set_iops_max, set_size_iops);
         conf_disk->blkdeviotune = info;
         ret = virDomainSaveConfig(cfg->configDir, driver->caps, persistentDef);
         if (ret < 0)
-- 
2.7.4




More information about the libvir-list mailing list