]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuMonitorSetBlockIoThrottle: Remove booleans controlling used fields
authorPeter Krempa <pkrempa@redhat.com>
Tue, 10 Aug 2021 13:27:29 +0000 (15:27 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 18 Aug 2021 07:57:34 +0000 (09:57 +0200)
All supported QEMU versions have all the fields so we can remove the
booleans controlling which fields are used on the monitor.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_driver.c
src/qemu/qemu_hotplug.c
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_json.c
src/qemu/qemu_monitor_json.h
src/qemu/qemu_process.c
tests/qemumonitorjsontest.c

index 7b7639c51a43f941d7085409526f5c78f6483e26..f31e13889ee7b600b8e5e756b6143c6a8f44580f 100644 (file)
@@ -16179,9 +16179,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
 
             qemuDomainObjEnterMonitor(driver, vm);
             ret = qemuMonitorSetBlockIoThrottle(priv->mon, drivealias, qdevid,
-                                                &info, true,
-                                                set_fields & QEMU_BLOCK_IOTUNE_SET_GROUP_NAME,
-                                                true);
+                                                &info);
             if (qemuDomainObjExitMonitor(driver, vm) < 0)
                 ret = -1;
             if (ret < 0)
index c00e8a78522eec6b53d6eda2e29018236dc7259b..c3c49fe080af29b39d1fc8f5754204e1cc8dec50 100644 (file)
@@ -566,8 +566,7 @@ qemuDomainChangeMediaBlockdev(virQEMUDriver *driver,
         qemuDiskConfigBlkdeviotuneEnabled(disk)) {
         rc = qemuMonitorSetBlockIoThrottle(priv->mon, NULL,
                                            diskPriv->qomName,
-                                           &disk->blkdeviotune,
-                                           true, true, true);
+                                           &disk->blkdeviotune);
     }
 
     if (rc == 0)
@@ -806,8 +805,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver,
         qemuDiskConfigBlkdeviotuneEnabled(disk)) {
         qemuDomainDiskPrivate *diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
         if (qemuMonitorSetBlockIoThrottle(priv->mon, NULL, diskPriv->qomName,
-                                          &disk->blkdeviotune,
-                                          true, true, true) < 0)
+                                          &disk->blkdeviotune) < 0)
             VIR_WARN("failed to set blkdeviotune for '%s' of '%s'", disk->dst, vm->def->name);
     }
 
index 5d7b686136bbc7c9192d3e3de4d6f8c58f40563d..14fb605e92610e9dc7f43c88f08f2d087237243c 100644 (file)
@@ -3333,20 +3333,14 @@ int
 qemuMonitorSetBlockIoThrottle(qemuMonitor *mon,
                               const char *drivealias,
                               const char *qomid,
-                              virDomainBlockIoTuneInfo *info,
-                              bool supportMaxOptions,
-                              bool supportGroupNameOption,
-                              bool supportMaxLengthOptions)
+                              virDomainBlockIoTuneInfo *info)
 {
     VIR_DEBUG("drivealias=%s, qomid=%s, info=%p",
               NULLSTR(drivealias), NULLSTR(qomid), info);
 
     QEMU_CHECK_MONITOR(mon);
 
-    return qemuMonitorJSONSetBlockIoThrottle(mon, drivealias, qomid, info,
-                                             supportMaxOptions,
-                                             supportGroupNameOption,
-                                             supportMaxLengthOptions);
+    return qemuMonitorJSONSetBlockIoThrottle(mon, drivealias, qomid, info);
 }
 
 
index 05ec228800ce1c63d9d6ab454f64f20ad8ce1d1f..f2659d650e156f525c3895c8dabf197f8f263bd2 100644 (file)
@@ -1112,10 +1112,7 @@ int qemuMonitorOpenGraphics(qemuMonitor *mon,
 int qemuMonitorSetBlockIoThrottle(qemuMonitor *mon,
                                   const char *drivealias,
                                   const char *qomid,
-                                  virDomainBlockIoTuneInfo *info,
-                                  bool supportMaxOptions,
-                                  bool supportGroupNameOption,
-                                  bool supportMaxLengthOptions);
+                                  virDomainBlockIoTuneInfo *info);
 
 int qemuMonitorGetBlockIoThrottle(qemuMonitor *mon,
                                   const char *drivealias,
index 7727d1e7fb76f5c9c049998485beb8476c7a5a60..8e5af9f79a9ed08bca198e3151c16c157992cd75 100644 (file)
@@ -5423,66 +5423,35 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValue *io_throttle,
 int qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mon,
                                       const char *drivealias,
                                       const char *qomid,
-                                      virDomainBlockIoTuneInfo *info,
-                                      bool supportMaxOptions,
-                                      bool supportGroupNameOption,
-                                      bool supportMaxLengthOptions)
+                                      virDomainBlockIoTuneInfo *info)
 {
     g_autoptr(virJSONValue) cmd = NULL;
     g_autoptr(virJSONValue) result = NULL;
-    g_autoptr(virJSONValue) args = NULL;
-
-    if (!(cmd = qemuMonitorJSONMakeCommand("block_set_io_throttle", NULL)))
-        return -1;
-
-    if (virJSONValueObjectCreate(&args,
-                                 "S:device", drivealias,
-                                 "S:id", qomid,
-                                 "U:bps", info->total_bytes_sec,
-                                 "U:bps_rd", info->read_bytes_sec,
-                                 "U:bps_wr", info->write_bytes_sec,
-                                 "U:iops", info->total_iops_sec,
-                                 "U:iops_rd", info->read_iops_sec,
-                                 "U:iops_wr", info->write_iops_sec,
-                                 NULL) < 0)
-        return -1;
-
-    if (supportMaxOptions &&
-        virJSONValueObjectAdd(args,
-                              "U:bps_max", info->total_bytes_sec_max,
-                              "U:bps_rd_max", info->read_bytes_sec_max,
-                              "U:bps_wr_max", info->write_bytes_sec_max,
-                              "U:iops_max", info->total_iops_sec_max,
-                              "U:iops_rd_max", info->read_iops_sec_max,
-                              "U:iops_wr_max", info->write_iops_sec_max,
-                              "U:iops_size", info->size_iops_sec,
-                              NULL) < 0)
-        return -1;
 
-    if (supportGroupNameOption &&
-        virJSONValueObjectAdd(args,
-                              "S:group", info->group_name,
-                              NULL) < 0)
-        return -1;
-
-    if (supportMaxLengthOptions &&
-        virJSONValueObjectAdd(args,
-                              "P:bps_max_length",
-                              info->total_bytes_sec_max_length,
-                              "P:bps_rd_max_length",
-                              info->read_bytes_sec_max_length,
-                              "P:bps_wr_max_length",
-                              info->write_bytes_sec_max_length,
-                              "P:iops_max_length",
-                              info->total_iops_sec_max_length,
-                              "P:iops_rd_max_length",
-                              info->read_iops_sec_max_length,
-                              "P:iops_wr_max_length",
-                              info->write_iops_sec_max_length,
-                              NULL) < 0)
-        return -1;
-
-    if (virJSONValueObjectAppend(cmd, "arguments", &args) < 0)
+    if (!(cmd = qemuMonitorJSONMakeCommand("block_set_io_throttle",
+                                           "S:device", drivealias,
+                                           "S:id", qomid,
+                                           "U:bps", info->total_bytes_sec,
+                                           "U:bps_rd", info->read_bytes_sec,
+                                           "U:bps_wr", info->write_bytes_sec,
+                                           "U:iops", info->total_iops_sec,
+                                           "U:iops_rd", info->read_iops_sec,
+                                           "U:iops_wr", info->write_iops_sec,
+                                           "U:bps_max", info->total_bytes_sec_max,
+                                           "U:bps_rd_max", info->read_bytes_sec_max,
+                                           "U:bps_wr_max", info->write_bytes_sec_max,
+                                           "U:iops_max", info->total_iops_sec_max,
+                                           "U:iops_rd_max", info->read_iops_sec_max,
+                                           "U:iops_wr_max", info->write_iops_sec_max,
+                                           "U:iops_size", info->size_iops_sec,
+                                           "S:group", info->group_name,
+                                           "P:bps_max_length", info->total_bytes_sec_max_length,
+                                           "P:bps_rd_max_length", info->read_bytes_sec_max_length,
+                                           "P:bps_wr_max_length", info->write_bytes_sec_max_length,
+                                           "P:iops_max_length", info->total_iops_sec_max_length,
+                                           "P:iops_rd_max_length", info->read_iops_sec_max_length,
+                                           "P:iops_wr_max_length", info->write_iops_sec_max_length,
+                                           NULL)))
         return -1;
 
     if (qemuMonitorJSONCommand(mon, cmd, &result) < 0)
index 01a3ba25f10490ce4eafd5263194ee528b15073a..fbeab2bf6d820ec5f7ecbade549c899928a96cab 100644 (file)
@@ -361,10 +361,7 @@ int qemuMonitorJSONOpenGraphics(qemuMonitor *mon,
 int qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mon,
                                       const char *drivealias,
                                       const char *qomid,
-                                      virDomainBlockIoTuneInfo *info,
-                                      bool supportMaxOptions,
-                                      bool supportGroupNameOption,
-                                      bool supportMaxLengthOptions);
+                                      virDomainBlockIoTuneInfo *info);
 
 int qemuMonitorJSONGetBlockIoThrottle(qemuMonitor *mon,
                                       const char *drivealias,
index cfc853b4e4119fb786502901fe939597954d58ce..77da9992f4e382e650f29261f2c6ebeaa9d61b83 100644 (file)
@@ -6888,8 +6888,7 @@ qemuProcessSetupDiskThrottlingBlockdev(virQEMUDriver *driver,
             continue;
 
         if (qemuMonitorSetBlockIoThrottle(qemuDomainGetMonitor(vm), NULL,
-                                          diskPriv->qomName, &disk->blkdeviotune,
-                                          true, true, true) < 0)
+                                          diskPriv->qomName, &disk->blkdeviotune) < 0)
             goto cleanup;
     }
 
index 2122d9d9999c2709fabfeec9935e07e3573fe473..6d7ecb0ab1eb931971cb755049b0de8ba826ef04 100644 (file)
@@ -1962,8 +1962,7 @@ testQemuMonitorJSONqemuMonitorJSONSetBlockIoThrottle(const void *opaque)
         goto cleanup;
 
     if (qemuMonitorJSONSetBlockIoThrottle(qemuMonitorTestGetMonitor(test),
-                                          "drive-virtio-disk1", NULL, &info, true,
-                                          true, true) < 0)
+                                          "drive-virtio-disk1", NULL, &info) < 0)
         goto cleanup;
 
     ret = 0;