Bug 698521

Summary: virsh freecell command help and man pages should be more clear
Product: Red Hat Enterprise Linux 6 Reporter: Min Zhan <mzhan>
Component: libvirtAssignee: Dave Allan <dallan>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: 6.1CC: dallan, dyuan, eblake, llim, mhideo, mjenner, moshiro, mshao, mzhan, pkrempa, rwu, ydu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.9.10-7.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 06:27:15 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 727267, 747123, 747667, 756082    

Description Min Zhan 2011-04-21 06:18:49 UTC
Description of problem:
According to BZ 693963 Comment 14, virsh freecell command help page and man page should be more clear.

Version-Release number of selected component (if applicable):
libvirt-0.8.7-18.el6.x86_64

How reproducible:
Always

Steps to Reproduce:

From BZ 693963 Comment 14,

(In reply to comment #13)
> Test in below environment:
> libvirt-0.8.7-18.el6.x86_64
> 
> # man virsh
> ...
>  freecell optional { --cellno cellno | --all }
>      Prints the available amount of memory on the machine or within a
>      NUMA cell if cellno is provided.  If --all is provided instead of
>      --cellno, then show the information on all NUMA cells.

I'm not sure how to make the man page any clearer, other than maybe:

freecell [{ [--cellno] cellno | --all }]

That is, there are three commands, the last with three spellings:

freecell            => total
freecell --all      => breakdown of all NUMA nodes
freecell --cellno 0 => single NUMA node
freecell 0          => single NUMA node
freecell --cellno=0 => single NUMA node

> 
>   OPTIONS
>     --cellno <number>  NUMA cell number

Hmm, this line in 'virsh help freecell' could be improved to show [--cellno]
rather than --cellno.

> 
> # virsh freecell --cellno
> error: expected syntax: --cellno <number>

Correct behavior.  --cellno requires an argument to go with the option.

> 
> # virsh freecell  foo000
> error: cell number has to be a number

Correct behavior.  Without either --cellno or --all, the first operand is
mapped to the first argument that takes an option, so this is equivalent to
freecell --cellno foo000, and foo000 is not a number.

> 
> According to above test and bug description, I notice ’man virsh‘ make a
> distinction between I<--cellno> and B<cellno>,But I wonder the cellno should be
> B<cellno> in the setentence 'if cellno is provided'. 

Possibly, but at this point, it's just documentation wording, and we're awfully
late.  We've already done what we hope to be the final spin for snap5; can we
instead spawn a new bug targetted for 6.2 that recommends further improvements
for virsh help (properly documenting that --cellno is optional) and man virsh
(tweaking the sentence), now that the real bug for 6.1 (the regression in
'freecell 0') has been fixed?
  
Actual results:
As above

Expected results:

According to BZ 693963,

1. # virsh help freecell 
...
--cellno <number>  NUMA cell number

> this line in 'virsh help freecell' could be improved to show [--cellno]
rather than --cellno.

2. # man virsh
...
1) freecell optional { --cellno cellno | --all }
> this line should make sure --cellno is optional for cellno

2) ’man virsh‘ make a distinction between I<--cellno> and B<cellno>,But I wonder the cellno should be B<cellno> in the setentence 'if cellno is provided'. 

Additional info:

Comment 6 Eric Blake 2012-03-23 03:46:47 UTC
Upstream commit ready to be backported.

commit 350e6c5e66c0cbc14551a25a6ec1d77e3158a9ed
Author: Dave Allan <dallan>
Date:   Thu Mar 22 16:49:07 2012 -0400

    Clarify virsh freecell manpage entry

There's no way to make 'virsh help freecell' show the {} without radically altering virsh.c to enforce mutual exclusion; that is a syntactic notion only possible in the hand-written virsh.pod, so I think there's nothing further to do here.

Comment 10 yanbing du 2012-03-28 05:55:46 UTC
Test with libvirt-0.9.10-8.el6.x86_64, and bug can be VERIFIED.
# man virsh
 freecell [{ [--cellno] cellno | --all }]
           Prints the available amount of memory on the machine or within a
           NUMA cell.  The freecell command can provide one of three different
           displays of available memory on the machine depending on the
           options specified.  With no options, it displays the total free
           memory on the machine.  With the --all option, it displays the free
           memory in each cell and the total free memory on the machine.
           Finally, with a numeric argument or with --cellno plus a cell
           number it will display the free memory for the specified cell only.

# virsh help freecell
  NAME
    freecell - NUMA free memory

  SYNOPSIS
    freecell [--cellno <number>] [--all]

  DESCRIPTION
    display available free memory for the NUMA cell.

  OPTIONS
    --cellno <number>  NUMA cell number
    --all            show free memory for all NUMA cells

Comment 12 errata-xmlrpc 2012-06-20 06:27:15 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2012-0748.html