On 03/10/2011 05:21 PM, Eric Blake wrote:
> + weight = vshCommandOptInt(cmd, "weight",
&found);
Oh my - more merge resolution (and the compiler didn't catch that we'd
reworked vshCommandOptInt in d03f199).
...
I like documentation closer to the changes, so I squashed 6/6 into this one.
Oh, I meant to add that I squashed in this to fix the above problems:
diff --git i/tools/virsh.c w/tools/virsh.c
index c0b3d38..a5e9c4f 100644
--- i/tools/virsh.c
+++ w/tools/virsh.c
@@ -3058,12 +3058,11 @@ static int
cmdBlkiotune(vshControl * ctl, const vshCmd * cmd)
{
virDomainPtr dom;
- int weight;
+ int weight = 0;
int nparams = 0;
unsigned int i = 0;
virBlkioParameterPtr params = NULL, temp = NULL;
int ret = FALSE;
- int found;
if (!vshConnectionUsability(ctl, ctl->conn))
return FALSE;
@@ -3071,13 +3070,18 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd)
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return FALSE;
- weight = vshCommandOptInt(cmd, "weight", &found);
- if (found) {
+ if (vshCommandOptInt(cmd, "weight", &weight) < 0) {
+ vshError(ctl, "%s",
+ _("Unable to parse integer parameter"));
+ goto cleanup;
+ }
+
+ if (weight) {
nparams++;
if (weight < 0) {
virDomainFree(dom);
vshError(ctl, _("Invalid value of %d for I/O weight"), weight);
- return FALSE;
+ goto cleanup;
}
}
@@ -3143,7 +3147,7 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd)
temp->type = VIR_DOMAIN_BLKIO_PARAM_UINT;
if (weight) {
- temp->value.ui = (unsigned int)weight;
+ temp->value.ui = weight;
strncpy(temp->field, VIR_DOMAIN_BLKIO_WEIGHT,
sizeof(temp->field));
weight = 0;
@@ -10415,6 +10419,7 @@ static const vshCmdDef domManagementCmds[] = {
{"attach-disk", cmdAttachDisk, opts_attach_disk, info_attach_disk},
{"attach-interface", cmdAttachInterface, opts_attach_interface,
info_attach_interface},
{"autostart", cmdAutostart, opts_autostart, info_autostart},
+ {"blkiotune", cmdBlkiotune, opts_blkiotune, info_blkiotune},
#ifndef WIN32
{"console", cmdConsole, opts_console, info_console},
#endif
@@ -10439,7 +10444,6 @@ 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},
{"memtune", cmdMemtune, opts_memtune, info_memtune},
{"migrate", cmdMigrate, opts_migrate, info_migrate},
{"migrate-setmaxdowntime", cmdMigrateSetMaxDowntime,
opts_migrate_setmaxdowntime, info_migrate_setmaxdowntime},
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org