{"maximum", VSH_OT_BOOL, 0, N_("set maximum limit on next boot")},
{"config", VSH_OT_BOOL, 0, N_("affect next boot")},
{"live", VSH_OT_BOOL, 0, N_("affect running domain")},
+ {"current", VSH_OT_BOOL, 0, N_("affect current domain")},
{NULL, 0, 0, NULL}
};
int maximum = vshCommandOptBool(cmd, "maximum");
int config = vshCommandOptBool(cmd, "config");
int live = vshCommandOptBool(cmd, "live");
- int flags = ((maximum ? VIR_DOMAIN_VCPU_MAXIMUM : 0) |
- (config ? VIR_DOMAIN_AFFECT_CONFIG : 0) |
- (live ? VIR_DOMAIN_AFFECT_LIVE : 0));
+ int current = vshCommandOptBool(cmd, "current");
+ int flags = 0;
+
+ if (current) {
+ if (live || config) {
+ vshError(ctl, "%s", _("--current must be specified exclusively"));
+ return false;
+ }
+ flags = VIR_DOMAIN_AFFECT_CURRENT;
+ } else {
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
+ /* neither option is specified */
+ if (!live && !config && !maximum)
+ flags = -1;
+ }
if (!vshConnectionUsability(ctl, ctl->conn))
return false;
goto cleanup;
}
- if (!flags) {
+ if (flags == -1) {
if (virDomainSetVcpus(dom, count) != 0) {
ret = false;
}
if (maximum) {
vshDebug(ctl, VSH_ERR_DEBUG, "--maximum flag was given\n");
+ flags |= VIR_DOMAIN_VCPU_MAXIMUM;
+
/* If neither the --config nor --live flags were given, OR
if just the --live flag was given, we need to error out
warning the user that the --maximum flag can only be used
on hypervisor.
=item B<setvcpus> I<domain-id> I<count> optional I<--maximum> I<--config>
-I<--live>
+I<--live> I<--current>
Change the number of virtual CPUs active in a guest domain. By default,
this command works on active guest domains. To change the settings for an
takes place immediately. Both the I<--config> and I<--live> flags may be
specified together if supported by the hypervisor.
-When neither the I<--config> nor I<--live> flags are given, the I<--live>
+If I<--current> is specified, affect the current guest state.
+
+When no flags are given, the I<--live>
flag is assumed and the guest domain must be active. In this situation it
is up to the hypervisor whether the I<--config> flag is also assumed, and
therefore whether the XML configuration is adjusted to make the change