mirror of
https://github.com/libvirt/libvirt.git
synced 2026-09-03 20:53:04 -05:00
virsh: schedinfo --set invalid=value would simply ignore the option
For example, virsh -c test:///default schedinfo 1 --set P=k would mistakenly exit successfully, giving no indication that it had failed to set the scheduling parameter "P". * tools/virsh.c (cmdSchedinfo): Diagnose an invalid --set j=k option, rather than silently ignoring it. * tests/virsh-schedinfo: New test for the above. * tests/Makefile.am (test_scripts): Add it. Reported by Jintao Yang in http://bugzilla.redhat.com/586632
This commit is contained in:
@@ -1594,6 +1594,16 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd)
|
||||
ret = virDomainGetSchedulerParameters(dom, params, &nparams);
|
||||
if (ret == -1)
|
||||
goto cleanup;
|
||||
} else {
|
||||
/* See if we've tried to --set var=val. If so, the fact that
|
||||
we reach this point (with update == 0) means that "var" did
|
||||
not match any of the settable parameters. Report the error. */
|
||||
char *var_value_pair = vshCommandOptString(cmd, "set", NULL);
|
||||
if (var_value_pair) {
|
||||
vshError(ctl, _("invalid scheduler option: %s"),
|
||||
var_value_pair);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
ret_val = TRUE;
|
||||
|
||||
Reference in New Issue
Block a user