]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: fix setting weight and device-weights at the same time
authorHu Tao <hutao@cn.fujitsu.com>
Wed, 30 Nov 2011 07:26:25 +0000 (15:26 +0800)
committerEric Blake <eblake@redhat.com>
Wed, 30 Nov 2011 19:11:25 +0000 (12:11 -0700)
When setting both blkio weight and device-weights at the same time, the weight
is lost. Fix it.

tools/virsh.c

index 1692b4faf21c44dbcfebc2badd66c70cffc47015..0fccf885da19b3ebcaac629ec1cc6f1249f6137f 100644 (file)
@@ -4788,14 +4788,14 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd)
                 if (!virStrcpy(temp->field, VIR_DOMAIN_BLKIO_WEIGHT,
                                sizeof(temp->field)))
                     goto cleanup;
-            }
-
-            if (device_weight) {
+                weight = 0;
+            } else if (device_weight) {
                 temp->value.s = vshStrdup(ctl, device_weight);
                 temp->type = VIR_TYPED_PARAM_STRING;
                 if (!virStrcpy(temp->field, VIR_DOMAIN_BLKIO_DEVICE_WEIGHT,
                                sizeof(temp->field)))
                     goto cleanup;
+                device_weight = NULL;
             }
         }