]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuMonitorSetBlockIoThrottle: Drop 'diskalias' argument
authorPeter Krempa <pkrempa@redhat.com>
Tue, 23 May 2023 13:32:49 +0000 (15:32 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 5 Jun 2023 11:20:13 +0000 (13:20 +0200)
Every caller will pass 'qdevid' as it's populated in the data
mandatorily with qemu-4.2 and onwards due to mandatory -blockdev use.

Thus we can drop compatibility with the old way of matching the disk via
alias.

Signed-off-by: Peter Krempa <pkrempa@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 430b75880b62713e44529d6f90a79ea48b68beb9..56f4cd619715c7bd23b26e1e0f224a8157106423 100644 (file)
@@ -14914,8 +14914,6 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
     virDomainDef *persistentDef = NULL;
     virDomainBlockIoTuneInfo info;
     virDomainBlockIoTuneInfo conf_info;
-    g_autofree char *drivealias = NULL;
-    const char *qdevid = NULL;
     int ret = -1;
     size_t i;
     virDomainDiskDef *conf_disk = NULL;
@@ -15111,13 +15109,6 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
         if (!qemuDomainDiskBlockIoTuneIsSupported(disk))
             goto endjob;
 
-        if (QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) {
-            qdevid = QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName;
-        } else {
-            if (!(drivealias = qemuAliasDiskDriveFromDisk(disk)))
-                goto endjob;
-        }
-
         cur_info = qemuDomainFindGroupBlockIoTune(def, disk, &info);
 
         if (qemuDomainSetBlockIoTuneDefaults(&info, cur_info,
@@ -15167,7 +15158,9 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
             int rc = 0;
 
             qemuDomainObjEnterMonitor(vm);
-            rc = qemuMonitorSetBlockIoThrottle(priv->mon, drivealias, qdevid, &info);
+            rc = qemuMonitorSetBlockIoThrottle(priv->mon,
+                                               QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName,
+                                               &info);
             qemuDomainObjExitMonitor(vm);
 
             if (rc < 0)
index 972df572a7b5301a87c78223cf2a713a5cabca92..806aecb29d692d64556fa0cb696d18d5cbe5d54b 100644 (file)
@@ -517,7 +517,7 @@ qemuDomainChangeMediaBlockdev(virDomainObj *vm,
     if (rc == 0 &&
         !virStorageSourceIsEmpty(newsrc) &&
         qemuDiskConfigBlkdeviotuneEnabled(disk)) {
-        rc = qemuMonitorSetBlockIoThrottle(priv->mon, NULL,
+        rc = qemuMonitorSetBlockIoThrottle(priv->mon,
                                            diskPriv->qomName,
                                            &disk->blkdeviotune);
     }
@@ -734,7 +734,7 @@ qemuDomainAttachDiskGeneric(virDomainObj *vm,
         g_autoptr(GHashTable) blockinfo = NULL;
 
         if (qemuDiskConfigBlkdeviotuneEnabled(disk)) {
-            if (qemuMonitorSetBlockIoThrottle(priv->mon, NULL, diskPriv->qomName,
+            if (qemuMonitorSetBlockIoThrottle(priv->mon, diskPriv->qomName,
                                               &disk->blkdeviotune) < 0)
                 VIR_WARN("failed to set blkdeviotune for '%s' of '%s'", disk->dst, vm->def->name);
         }
index 5faf64a4ecda926214bd4de14b0f0ada74b11116..73a019e732636b26f44814159e533616b2530f70 100644 (file)
@@ -2973,16 +2973,14 @@ qemuMonitorJobComplete(qemuMonitor *mon,
 
 int
 qemuMonitorSetBlockIoThrottle(qemuMonitor *mon,
-                              const char *drivealias,
                               const char *qomid,
                               virDomainBlockIoTuneInfo *info)
 {
-    VIR_DEBUG("drivealias=%s, qomid=%s, info=%p",
-              NULLSTR(drivealias), NULLSTR(qomid), info);
+    VIR_DEBUG("qomid=%s, info=%p", NULLSTR(qomid), info);
 
     QEMU_CHECK_MONITOR(mon);
 
-    return qemuMonitorJSONSetBlockIoThrottle(mon, drivealias, qomid, info);
+    return qemuMonitorJSONSetBlockIoThrottle(mon, qomid, info);
 }
 
 
index 6006a451a3eacbf713d840b2be34ce06941d2085..8f1bfc702a78898cb4182009ef0c727e7e6f64c1 100644 (file)
@@ -1052,7 +1052,6 @@ int qemuMonitorOpenGraphics(qemuMonitor *mon,
                             bool skipauth);
 
 int qemuMonitorSetBlockIoThrottle(qemuMonitor *mon,
-                                  const char *drivealias,
                                   const char *qomid,
                                   virDomainBlockIoTuneInfo *info);
 
index 900cb43e749ccce3af5d9862289e83d8ab0e9bb8..2ece33a651a6485052ade76877360af98b1a7814 100644 (file)
@@ -4596,7 +4596,6 @@ qemuMonitorJSONBlockIoThrottleInfo(virJSONValue *io_throttle,
 #undef GET_THROTTLE_STATS_OPTIONAL
 
 int qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mon,
-                                      const char *drivealias,
                                       const char *qomid,
                                       virDomainBlockIoTuneInfo *info)
 {
@@ -4604,8 +4603,7 @@ int qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mon,
     g_autoptr(virJSONValue) result = NULL;
 
     if (!(cmd = qemuMonitorJSONMakeCommand("block_set_io_throttle",
-                                           "S:device", drivealias,
-                                           "S:id", qomid,
+                                           "s:id", qomid,
                                            "U:bps", info->total_bytes_sec,
                                            "U:bps_rd", info->read_bytes_sec,
                                            "U:bps_wr", info->write_bytes_sec,
index 3f77ab0ab39fabf24cc64c6a07d6168d4c098954..802f6e7b44b149b377d87ed3d4c3a67080cbba8f 100644 (file)
@@ -401,7 +401,6 @@ qemuMonitorJSONOpenGraphics(qemuMonitor *mon,
 
 int
 qemuMonitorJSONSetBlockIoThrottle(qemuMonitor *mon,
-                                  const char *drivealias,
                                   const char *qomid,
                                   virDomainBlockIoTuneInfo *info);
 
index de18fd7a3d93c38fffc91fc9ac553819508883d6..a4a4a17a9b7dfc80d6a332c4d4d7991ffbde86c5 100644 (file)
@@ -7307,13 +7307,6 @@ qemuProcessSetupDiskThrottling(virDomainObj *vm,
 
     for (i = 0; i < vm->def->ndisks; i++) {
         virDomainDiskDef *disk = vm->def->disks[i];
-        qemuDomainDiskPrivate *diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
-        g_autofree char *drivealias = NULL;
-
-        if (!QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) {
-            if (!(drivealias = qemuAliasDiskDriveFromDisk(disk)))
-                goto cleanup;
-        }
 
         /* Setting throttling for empty drives fails */
         if (virStorageSourceIsEmpty(disk->src))
@@ -7322,8 +7315,9 @@ qemuProcessSetupDiskThrottling(virDomainObj *vm,
         if (!qemuDiskConfigBlkdeviotuneEnabled(disk))
             continue;
 
-        if (qemuMonitorSetBlockIoThrottle(qemuDomainGetMonitor(vm), drivealias,
-                                          diskPriv->qomName, &disk->blkdeviotune) < 0)
+        if (qemuMonitorSetBlockIoThrottle(qemuDomainGetMonitor(vm),
+                                          QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName,
+                                          &disk->blkdeviotune) < 0)
             goto cleanup;
     }
 
index ba12aae5b74e7fa1128df9829053d55f9f834af9..7e79b2e7579911ad0976fbdc06dbd230e564c07f 100644 (file)
@@ -1904,7 +1904,7 @@ testQemuMonitorJSONqemuMonitorJSONSetBlockIoThrottle(const void *opaque)
         goto cleanup;
 
     if (qemuMonitorJSONSetBlockIoThrottle(qemuMonitorTestGetMonitor(test),
-                                          NULL, "drive-virtio-disk1", &info) < 0)
+                                          "drive-virtio-disk1", &info) < 0)
         goto cleanup;
 
     ret = 0;