[libvirt] [PATCH] change blkiotune weight range min from 100 to 10

Martin Kletzander mkletzan at redhat.com
Thu Jul 24 12:03:10 UTC 2014


This reflects the same change made in kernel commit df457f845e (before
v2.6.38-rc7).  On the rare occasion when the user would try setting
the weight to value in range <10, 100) on older kernel, we will error
out with EINVAL properly.  Modifying the error message (adding a hint
for example) would cause weird logs, especially without stacked error
messages (I couldn't resist mentioning it again).

There is no (easy) way of getting the limits from kernel, since it's
not exposed.

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

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 src/lxc/lxc_driver.c   | 4 ++--
 src/qemu/qemu_driver.c | 4 ++--
 tools/virsh-domain.c   | 2 +-
 tools/virsh.pod        | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 05d10b4..a7f4b87 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -2559,7 +2559,7 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
             virTypedParameterPtr param = &params[i];

             if (STREQ(param->field, VIR_DOMAIN_BLKIO_WEIGHT)) {
-                if (params[i].value.ui > 1000 || params[i].value.ui < 100) {
+                if (params[i].value.ui > 1000 || params[i].value.ui < 10) {
                     virReportError(VIR_ERR_INVALID_ARG, "%s",
                                    _("out of blkio weight range."));
                     ret = -1;
@@ -2660,7 +2660,7 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
             virTypedParameterPtr param = &params[i];

             if (STREQ(param->field, VIR_DOMAIN_BLKIO_WEIGHT)) {
-                if (params[i].value.ui > 1000 || params[i].value.ui < 100) {
+                if (params[i].value.ui > 1000 || params[i].value.ui < 10) {
                     virReportError(VIR_ERR_INVALID_ARG, "%s",
                                    _("out of blkio weight range."));
                     ret = -1;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 626d557..eae8ae2 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7819,7 +7819,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
             virTypedParameterPtr param = &params[i];

             if (STREQ(param->field, VIR_DOMAIN_BLKIO_WEIGHT)) {
-                if (params[i].value.ui > 1000 || params[i].value.ui < 100) {
+                if (params[i].value.ui > 1000 || params[i].value.ui < 10) {
                     virReportError(VIR_ERR_INVALID_ARG, "%s",
                                    _("out of blkio weight range."));
                     ret = -1;
@@ -7920,7 +7920,7 @@ qemuDomainSetBlkioParameters(virDomainPtr dom,
             virTypedParameterPtr param = &params[i];

             if (STREQ(param->field, VIR_DOMAIN_BLKIO_WEIGHT)) {
-                if (params[i].value.ui > 1000 || params[i].value.ui < 100) {
+                if (params[i].value.ui > 1000 || params[i].value.ui < 10) {
                     virReportError(VIR_ERR_INVALID_ARG, "%s",
                                    _("out of blkio weight range."));
                     ret = -1;
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index ba47258..c58beaf 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -1255,7 +1255,7 @@ static const vshCmdOptDef opts_blkiotune[] = {
     },
     {.name = "weight",
      .type = VSH_OT_INT,
-     .help = N_("IO Weight in range [100, 1000]")
+     .help = N_("IO Weight in range [10, 1000]")
     },
     {.name = "device-weights",
      .type = VSH_OT_STRING,
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 849ae31..9f3cbee 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -1824,8 +1824,8 @@ Specifying -1 as a value for these limits is interpreted as unlimited.
 [[I<--config>] [I<--live>] | [I<--current>]]

 Display or set the blkio parameters. QEMU/KVM supports I<--weight>.
-I<--weight> is in range [100, 1000]. After kernel 2.6.39, the value
-could be in the range [10, 1000].
+I<--weight> is in range [100, 1000].  Since kernel 2.6.39, the value
+is in the range [10, 1000].

 B<device-weights> is a single string listing one or more device/weight
 pairs, in the format of /path/to/device,weight,/path/to/device,weight.
-- 
2.0.2




More information about the libvir-list mailing list