[PATCH v2] qemu: Don't lose group_name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Due to our APIs not copying various pointers, we need to carry it
around on the side and just supply it every time it is needed.
Otherwise it will not work with both --live and --config options.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f45972e3c823..4ff6b9d46502 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17194,7 +17194,7 @@ qemuDomainSetBlockIoTuneDefaults(virDomainBlockIoTuneInfoPtr newinfo,
     if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_SIZE_IOPS))
         newinfo->size_iops_sec = oldinfo->size_iops_sec;
     if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_GROUP_NAME))
-        VIR_STEAL_PTR(newinfo->group_name, oldinfo->group_name);
+        VIR_STRDUP(newinfo->group_name, oldinfo->group_name);

     /* The length field is handled a bit differently. If not defined/set,
      * QEMU will default these to 0 or 1 depending on whether something in
@@ -17512,8 +17512,10 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
             ret = -1;
         if (ret < 0)
             goto endjob;
+
+        VIR_FREE(disk->blkdeviotune.group_name);
         disk->blkdeviotune = info;
-        info.group_name = NULL;
+        VIR_STRDUP(disk->blkdeviotune.group_name, info.group_name);

         ret = virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps);
         if (ret < 0)
@@ -17533,10 +17535,14 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
                            path);
             goto endjob;
         }
+
         qemuDomainSetBlockIoTuneDefaults(&info, &conf_disk->blkdeviotune,
                                          set_fields);
+
+        VIR_FREE(conf_disk->blkdeviotune.group_name);
         conf_disk->blkdeviotune = info;
-        info.group_name = NULL;
+        VIR_STRDUP(conf_disk->blkdeviotune.group_name, info.group_name);
+
         ret = virDomainSaveConfig(cfg->configDir, driver->caps, persistentDef);
         if (ret < 0)
             goto endjob;
--
2.11.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux