mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-09 09:14:57 +00:00
virsh: cpu-stats: Remove unneeded flags
virDomainGetCPUStats doesn't support flags so there's no need to carry the 'flags' variable around. Additionally since the API is poorly designed I doubt that it will be extended.
This commit is contained in:
parent
57177f1abd
commit
a2e80549a2
@ -7264,7 +7264,6 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd)
|
|||||||
int max_id, cpu = 0, show_count = -1, nparams = 0, stats_per_cpu;
|
int max_id, cpu = 0, show_count = -1, nparams = 0, stats_per_cpu;
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
bool show_total = false, show_per_cpu = false;
|
bool show_total = false, show_per_cpu = false;
|
||||||
unsigned int flags = 0;
|
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
@ -7303,7 +7302,7 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd)
|
|||||||
goto do_show_total;
|
goto do_show_total;
|
||||||
|
|
||||||
/* get number of cpus on the node */
|
/* get number of cpus on the node */
|
||||||
if ((max_id = virDomainGetCPUStats(dom, NULL, 0, 0, 0, flags)) < 0)
|
if ((max_id = virDomainGetCPUStats(dom, NULL, 0, 0, 0, 0)) < 0)
|
||||||
goto failed_stats;
|
goto failed_stats;
|
||||||
if (show_count < 0 || show_count > max_id) {
|
if (show_count < 0 || show_count > max_id) {
|
||||||
if (show_count > max_id)
|
if (show_count > max_id)
|
||||||
@ -7312,7 +7311,7 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* get percpu information */
|
/* get percpu information */
|
||||||
if ((nparams = virDomainGetCPUStats(dom, NULL, 0, 0, 1, flags)) < 0)
|
if ((nparams = virDomainGetCPUStats(dom, NULL, 0, 0, 1, 0)) < 0)
|
||||||
goto failed_stats;
|
goto failed_stats;
|
||||||
|
|
||||||
if (!nparams) {
|
if (!nparams) {
|
||||||
@ -7328,7 +7327,7 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd)
|
|||||||
while (show_count) {
|
while (show_count) {
|
||||||
int ncpus = MIN(show_count, 128);
|
int ncpus = MIN(show_count, 128);
|
||||||
|
|
||||||
if (virDomainGetCPUStats(dom, params, nparams, cpu, ncpus, flags) < 0)
|
if (virDomainGetCPUStats(dom, params, nparams, cpu, ncpus, 0) < 0)
|
||||||
goto failed_stats;
|
goto failed_stats;
|
||||||
|
|
||||||
for (i = 0; i < ncpus; i++) {
|
for (i = 0; i < ncpus; i++) {
|
||||||
@ -7352,7 +7351,7 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd)
|
|||||||
|
|
||||||
do_show_total:
|
do_show_total:
|
||||||
/* get supported num of parameter for total statistics */
|
/* get supported num of parameter for total statistics */
|
||||||
if ((nparams = virDomainGetCPUStats(dom, NULL, 0, -1, 1, flags)) < 0)
|
if ((nparams = virDomainGetCPUStats(dom, NULL, 0, -1, 1, 0)) < 0)
|
||||||
goto failed_stats;
|
goto failed_stats;
|
||||||
|
|
||||||
if (!nparams) {
|
if (!nparams) {
|
||||||
@ -7365,7 +7364,7 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd)
|
|||||||
|
|
||||||
/* passing start_cpu == -1 gives us domain's total status */
|
/* passing start_cpu == -1 gives us domain's total status */
|
||||||
if ((stats_per_cpu = virDomainGetCPUStats(dom, params, nparams,
|
if ((stats_per_cpu = virDomainGetCPUStats(dom, params, nparams,
|
||||||
-1, 1, flags)) < 0)
|
-1, 1, 0)) < 0)
|
||||||
goto failed_stats;
|
goto failed_stats;
|
||||||
|
|
||||||
vshPrint(ctl, _("Total:\n"));
|
vshPrint(ctl, _("Total:\n"));
|
||||||
|
Loading…
Reference in New Issue
Block a user