On 02/21/2011 10:33 PM, Gui Jianfeng wrote:
Adding blkiotune command to virsh tool
Signed-off-by: Gui Jianfeng <guijianfeng(a)cn.fujitsu.com>
---
tools/virsh.c | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 127 insertions(+), 0 deletions(-)
+static int
+cmdBlkiotune(vshControl * ctl, const vshCmd * cmd)
+{
+ virDomainPtr dom;
+ int weight;
+ int nparams = 0;
+ unsigned int i = 0;
+ virBlkioParameterPtr params = NULL, temp = NULL;
+ int ret = FALSE;
+ int found;
+
+ if (!vshConnectionUsability(ctl, ctl->conn))
+ return FALSE;
+
+ if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
+ return FALSE;
+
+ weight = vshCommandOptInt(cmd, "weight", &found);
Oh my - more merge resolution (and the compiler didn't catch that we'd
reworked vshCommandOptInt in d03f199).
+ if (found) {
+ nparams++;
+ if (weight < 0) {
+ virDomainFree(dom);
+ vshError(ctl, _("Invalid value of %d for I/O weight"), weight);
+ return FALSE;
Mem leak of dom.
+ if (weight) {
+ temp->value.ui = (unsigned int)weight;
Unnecessary cast.
@@ -10324,6 +10450,7 @@ static const vshCmdDef domManagementCmds[] =
{
{"managedsave", cmdManagedSave, opts_managedsave, info_managedsave},
{"managedsave-remove", cmdManagedSaveRemove, opts_managedsaveremove,
info_managedsaveremove},
{"maxvcpus", cmdMaxvcpus, opts_maxvcpus, info_maxvcpus},
+ {"blkiotune", cmdBlkiotune, opts_blkiotune, info_blkiotune},
Sorted order.
I like documentation closer to the changes, so I squashed 6/6 into this one.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org