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

[libvirt] [PATCH v2 0/2] Add error handling to optional arguments in cmdCPUStats



https://bugzilla.redhat.com/show_bug.cgi?id=907732
        
Also added informational message when count value is larger than number
of CPUs present.  Original code commit '31047e2b' quietly changes it and
continues on.
                        
Prior to patch 2/2, no errors were seen for following sequences
                                
virsh cpu-stats guest xyz
virsh cpu-stats guest --start xyz
virsh cpu-stats guest --count xyz
virsh cpu-stats guest --count 99999999999
                                                    
With patch 2/2, the following errors are displayed for the above sequence
                                                            
error: Unable to parse integer parameter for start
error: Unable to parse integer parameter for start
error: Unable to parse integer parameter for CPUs to show
error: Unable to parse integer parameter for CPUs to show

Additionally, the following will be displayed on negative value input:

virsh cpu-stats guest --start -1 
error: Invalid value for start CPU

virsh cpu-stats guest --count -1 
error: Invalid value for number of CPUs to show

Using a --count parameter value larger than the number of vCPUs on the 
system will display the following:

virsh cpu-stats guest --count 8
Only 4 CPUs available to show
CPU0:
cpu_time            10.770466061 seconds
vcpu_time            8.327848192 seconds
...

Diff to v1
 - Split into 2 patches (one for struct defs, one for argument processing)
 - Adjust argument processessing to delineate between bad argument and
   invalid value (eg, negative CPU start number or count)
 - Only display the > # cpus message when too large a value is supplied

John Ferlan (2):
  Remove extraneous comma in info_cpu_stats and opts_cpu_stats
  Add error handling to optional arguments in cmdCPUStats

 tools/virsh-domain.c | 33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

-- 
1.8.1.4


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