On Fri, 2016-04-15 at 03:28 -0400, Nitesh Konkar wrote: > Signed-off-by: Nitesh Konkar <nitkon12@xxxxxxxxxxxxxxxxxx> > --- > # virsh cpu-stats --domain 40 --start 159 > CPU159: > cpu_time 0.000000000 seconds > vcpu_time 0.000000000 seconds > > # virsh cpu-stats --domain 40 --start 160 > Start cpu 160 larger than maximum of 159. > > tools/virsh-domain.c | 6 ++++++ > 1 files changed, 6 insertions(+) > > diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c > index 800829e..3d6b626 100644 > --- a/tools/virsh-domain.c > +++ b/tools/virsh-domain.c > @@ -7357,6 +7357,12 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd) > /* get number of cpus on the node */ > if ((max_id = virDomainGetCPUStats(dom, NULL, 0, 0, 0, 0)) < 0) > goto failed_stats; > + > + if (cpu >= max_id) { > + vshPrint(ctl, "Start cpu %d larger than maximum of %d.", cpu, max_id - 1); > + goto cleanup; > + } > + > if (show_count < 0 || show_count > max_id) { > if (show_count > max_id) > vshPrint(ctl, _("Only %d CPUs available to show\n"), max_id); I've tweaked the error message a bit, switched from vshPrint() to vshError() and pushed the patch. Cheers. -- Andrea Bolognani Software Engineer - Virtualization Team -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list