From: Hu Tao Date: Wed, 30 Nov 2011 07:26:25 +0000 (+0800) Subject: virsh: fix setting weight and device-weights at the same time X-Git-Tag: v0.9.8-rc1~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e976db4ea7f0a2e141057a7ca8fe805523ed836;p=thirdparty%2Flibvirt.git virsh: fix setting weight and device-weights at the same time When setting both blkio weight and device-weights at the same time, the weight is lost. Fix it. --- diff --git a/tools/virsh.c b/tools/virsh.c index 1692b4faf2..0fccf885da 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -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; } }