From: Chen Hanxiao <chenhanxiao(a)gmail.com>
Currently --maximum was possible if and only if
--config was specified.
This patch makes setvcpus --maximum imply --config.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
tools/virsh-domain.c | 7 ++++---
tools/virsh.pod | 9 +++++----
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 5c42021..04ef816 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -6819,8 +6819,8 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
VSH_EXCLUSIVE_OPTIONS_VAR(guest, config);
-
- VSH_REQUIRE_OPTION_VAR(maximum, config);
+ VSH_EXCLUSIVE_OPTIONS_VAR(maximum, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(maximum, current);
if (config)
flags |= VIR_DOMAIN_AFFECT_CONFIG;
@@ -6829,7 +6829,8 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
if (guest)
flags |= VIR_DOMAIN_VCPU_GUEST;
if (maximum)
- flags |= VIR_DOMAIN_VCPU_MAXIMUM;
+ flags |= VIR_DOMAIN_VCPU_MAXIMUM |
+ VIR_DOMAIN_AFFECT_CONFIG;
if (hotpluggable)
flags |= VIR_DOMAIN_VCPU_HOTPLUGGABLE;
diff --git a/tools/virsh.pod b/tools/virsh.pod
index e7c513b..bc8b539 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -2501,10 +2501,11 @@ flag. Vcpus added to live domains supporting vcpu unplug are
automatically
marked as hotpluggable.
The I<--maximum> flag controls the maximum number of virtual cpus that can
-be hot-plugged the next time the domain is booted. As such, it must only be
-used with the I<--config> flag, and not with the I<--live> or the
I<--current>
-flag. Note that it may not be possible to change the maximum vcpu count if
-the processor topology is specified for the guest.
+be hot-plugged the next time the domain is booted. As such, it implies
+I<--config> be set. Also it can be used with the I<--config> flag,
+but not with the I<--live> or the I<--current> flag. Note that it may not
+be possible to change the maximum vcpu count if the processor topology
+is specified for the guest.
=item B<setvcpu> I<domain> I<vcpulist> [I<--enable>] |
[I<--disable>]
[[I<--live>] [I<--config>] | [I<--current>]]
--
2.7.4