[libvirt] [PATCH] tools: make setvcpus --maximum imply --config

Chen Hanxiao posted 1 patch 6 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1495869251-25796-1-git-send-email-chen_han_xiao@126.com
tools/virsh-domain.c | 7 ++++---
tools/virsh.pod      | 9 +++++----
2 files changed, 9 insertions(+), 7 deletions(-)
[libvirt] [PATCH] tools: make setvcpus --maximum imply --config
Posted by Chen Hanxiao 6 years, 10 months ago
From: Chen Hanxiao <chenhanxiao@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@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


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] tools: make setvcpus --maximum imply --config
Posted by Peter Krempa 6 years, 10 months ago
On Sat, May 27, 2017 at 15:14:11 +0800, Chen Hanxiao wrote:
> From: Chen Hanxiao <chenhanxiao@gmail.com>
> 
>  Currently --maximum was possible if and only if
>  --config was specified.
> 
>  This patch makes setvcpus --maximum imply --config.

NACK, some hypervisors may actually allow changing of the maximum in
live config, so this would make it impossible to modify that.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] tools: make setvcpus --maximum imply --config
Posted by Chen Hanxiao 6 years, 10 months ago
Hi,
   Should  we remove this restriction(--maximum MUST be used with --config)?

Regards,
-Chen





在2017年05月29日 13:32,Peter Krempa 写道:
On Sat, May 27, 2017 at 15:14:11 +0800, Chen Hanxiao wrote:
> From: Chen Hanxiao <chenhanxiao@gmail.com>
>
>  Currently --maximum was possible if and only if
>  --config was specified.
>
>  This patch makes setvcpus --maximum imply --config.

NACK, some hypervisors may actually allow changing of the maximum in
live config, so this would make it impossible to modify that.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] tools: make setvcpus --maximum imply --config
Posted by Martin Kletzander 6 years, 10 months ago
On Mon, May 29, 2017 at 02:23:39PM +0800, Chen Hanxiao wrote:
>Hi,
>   Should  we remove this restriction(--maximum MUST be used with --config)?
>
>Regards,
>-Chen
>

It doesn't make much sense to remove it now.  There is no hypervisor
that allows that and we can remove it in the future.  I'm not saying we
can't remove it, but there is no point in doing that.  However, if we
take your approach, where --maximum implies --config, then we need to
keep that promise in future versions.  And, if any hypervisor adds
support for changing the maximum later on, there would be no way how to
call it from virsh as --maximum would have to imply --config forever.

I think that's kinda what Peter was trying to say.

>
>
>
>
>在2017年05月29日 13:32,Peter Krempa 写道:
>On Sat, May 27, 2017 at 15:14:11 +0800, Chen Hanxiao wrote:
>> From: Chen Hanxiao <chenhanxiao@gmail.com>
>>
>>  Currently --maximum was possible if and only if
>>  --config was specified.
>>
>>  This patch makes setvcpus --maximum imply --config.
>
>NACK, some hypervisors may actually allow changing of the maximum in
>live config, so this would make it impossible to modify that.

>--
>libvir-list mailing list
>libvir-list@redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] tools: make setvcpus --maximum imply --config
Posted by Chen Hanxiao 6 years, 10 months ago
Hi,
   Should  we remove this restriction(--maximum MUST be used with --config)?

Regards,
-Chen





在2017年05月29日 13:32,Peter Krempa 写道:
On Sat, May 27, 2017 at 15:14:11 +0800, Chen Hanxiao wrote:
> From: Chen Hanxiao <chenhanxiao@gmail.com>
>
>  Currently --maximum was possible if and only if
>  --config was specified.
>
>  This patch makes setvcpus --maximum imply --config.

NACK, some hypervisors may actually allow changing of the maximum in
live config, so this would make it impossible to modify that.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list