cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
- int count = 0;
+ unsigned int count = 0;
bool ret = false;
bool maximum = vshCommandOptBool(cmd, "maximum");
bool config = vshCommandOptBool(cmd, "config");
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
return false;
- if (vshCommandOptInt(ctl, cmd, "count", &count) < 0 || count <= 0)
+ if (vshCommandOptUInt(ctl, cmd, "count", &count) < 0)
goto cleanup;
+ if (count == 0) {
+ vshError(ctl, _("Can't set 0 processors for a VM"));
+ goto cleanup;
+ }
+
/* none of the options were specified */
if (!current && flags == 0) {
if (virDomainSetVcpus(dom, count) != 0)