]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: command: Don't allow setting 'group_name' alone
authorPeter Krempa <pkrempa@redhat.com>
Fri, 17 Mar 2017 08:26:17 +0000 (09:26 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 17 Mar 2017 10:12:33 +0000 (11:12 +0100)
The disk tuning group parameter is ignored by qemu if no other
throttling options are set. Reject such configuration, since the name
would not be honored after setting parameters via the live tuning API.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1433180

src/qemu/qemu_command.c

index f24b5928cedb8f94d4ed43b5b8d9f54718d6a691..2045c2e7cf95e03cf9932bcc98fda7cbd9dcb593 100644 (file)
@@ -1259,12 +1259,23 @@ qemuCheckDiskConfigBlkdeviotune(virDomainDiskDefPtr disk,
     }
 
     /* block I/O group 2.4 */
-    if (disk->blkdeviotune.group_name &&
-        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_GROUP)) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("the block I/O throttling group parameter is "
-                         "not supported with this QEMU binary"));
-        return -1;
+    if (disk->blkdeviotune.group_name) {
+        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_GROUP)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("the block I/O throttling group parameter is "
+                             "not supported with this QEMU binary"));
+            return -1;
+        }
+
+        /* group_name by itself is ignored by qemu */
+        if (!qemuDiskConfigBlkdeviotuneHasBasic(disk) &&
+            !qemuDiskConfigBlkdeviotuneHasMax(disk) &&
+            !qemuDiskConfigBlkdeviotuneHasMaxLength(disk)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("group_name can be configured only together with "
+                             "settings"));
+            return -1;
+        }
     }
 
     /* block I/O throttling length 2.6 */