Re: [PATCHv5 8/9] add new command numatune to virsh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/20/2011 01:35 AM, Hu Tao wrote:
> add new command numatune to virsh to get/set numa parameters
> ---
>  tools/virsh.c   |  159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tools/virsh.pod |   19 +++++++
>  2 files changed, 178 insertions(+), 0 deletions(-)
> 

> +            if (mode) {
> +                /* Accept string or integer, in case server
> +                 * understands newer integer than what strings we were
> +                 * compiled with */
> +                if ((temp->value.i =
> +                    virDomainNumatuneMemModeTypeFromString(mode)) < 0) {
> +                    vshError(ctl, "%s %s", _("Invalid mode"), mode);
> +                    goto cleanup;
> +                }

Oops - we didn't finish the code to implement that comment.

> +++ b/tools/virsh.pod
> @@ -832,6 +832,25 @@ migrated to another host.
>  
>  Get the maximum migration bandwidth (in Mbps) for a domain.
>  
> +=item B<numatune> I<domain> [I<mode>] [I<nodeset>]

I just realized that <mode> of 0 and <nodeset> of 0 are both valid, so I
guess your approach in v3 of listing I<--mode> B<mode> instead of my
shorter I<mode> in v4 is correct after all.

diff --git i/tools/virsh.c w/tools/virsh.c
index 4264307..0cf51e4 100644
--- i/tools/virsh.c
+++ w/tools/virsh.c
@@ -5252,8 +5252,9 @@ cmdNumatune(vshControl * ctl, const vshCmd * cmd)
                  * understands newer integer than what strings we were
                  * compiled with */
                 if ((temp->value.i =
-                    virDomainNumatuneMemModeTypeFromString(mode)) < 0) {
-                    vshError(ctl, "%s %s", _("Invalid mode"), mode);
+                    virDomainNumatuneMemModeTypeFromString(mode)) < 0 &&
+                    virStrToLong_i(mode, NULL, 0, &temp->value.i) < 0) {
+                    vshError(ctl, _("Invalid mode: %s"), mode);
                     goto cleanup;
                 }
                 if (!virStrcpy(temp->field, VIR_DOMAIN_NUMA_MODE,
diff --git i/tools/virsh.pod w/tools/virsh.pod
index 2367673..3b669b5 100644
--- i/tools/virsh.pod
+++ w/tools/virsh.pod
@@ -832,7 +832,7 @@ migrated to another host.

 Get the maximum migration bandwidth (in Mbps) for a domain.

-=item B<numatune> I<domain> [I<mode>] [I<nodeset>]
+=item B<numatune> I<domain> [I<--mode> B<mode>] [I<--nodeset> B<nodeset>]
 [[I<--config>] [I<--live>] | [I<--current>]]

 Set or get a domain's numa parameters, corresponding to the <numatune>

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]