From 4452c8f1b0a9e953615d15d02ada49c1834c72d5 Mon Sep 17 00:00:00 2001 Message-ID: <4452c8f1b0a9e953615d15d02ada49c1834c72d5.1747908717.git.jdenemar@redhat.com> From: Martin Kletzander Date: Tue, 25 Feb 2025 15:22:35 +0100 Subject: [PATCH] virsh: Add support for VIR_DOMAIN_GUEST_INFO_LOAD Resolves: https://issues.redhat.com/browse/RHEL-71883 Signed-off-by: Martin Kletzander Reviewed-by: Peter Krempa (cherry picked from commit 71e75ce09203aa2489803426ae368d1693ee925b) https://issues.redhat.com/browse/RHEL-88447 Signed-off-by: Martin Kletzander --- docs/manpages/virsh.rst | 8 +++++++- tools/virsh-domain.c | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index aea920b7a7..2bb1313a48 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -2927,7 +2927,7 @@ Success is always reported in this case. You can limit the types of information that are returned by specifying one or more flags. Available information types flags are *--user*, *--os*, -*--timezone*, *--hostname*, *--filesystem*, *--disk* and *--interface*. +*--timezone*, *--hostname*, *--filesystem*, *--disk*, *--interface* and *--load*. If an explicitly requested information type is not supported by the guest agent at that point, the processes will provide an exit code of 1. @@ -3006,6 +3006,12 @@ returned: * ``if..addr..addr`` - the IP address of addr * ``if..addr..prefix`` - the prefix of IP address of addr +*--load* returns: +* ``load.1m`` - average load in guest for last 1 minute +* ``load.5m`` - average load in guest for last 5 minutes +* ``load.15m`` - average load in guest for last 15 minutes + + guestvcpus ---------- diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index e4923284af..0f30a65fd9 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -13066,6 +13066,10 @@ static const vshCmdOptDef opts_guestinfo[] = { .type = VSH_OT_BOOL, .help = N_("report interface information"), }, + {.name = "load", + .type = VSH_OT_BOOL, + .help = N_("report load averages information"), + }, {.name = NULL} }; @@ -13093,6 +13097,8 @@ cmdGuestInfo(vshControl *ctl, const vshCmd *cmd) types |= VIR_DOMAIN_GUEST_INFO_DISKS; if (vshCommandOptBool(cmd, "interface")) types |= VIR_DOMAIN_GUEST_INFO_INTERFACES; + if (vshCommandOptBool(cmd, "load")) + types |= VIR_DOMAIN_GUEST_INFO_LOAD; if (!(dom = virshCommandOptDomain(ctl, cmd, NULL))) return false; -- 2.49.0