From 172b8304352b1945e328394e61290a24446280dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 20 Nov 2020 22:09:48 +0400 Subject: [PATCH] virsh: add --disk informations to guestinfo command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau Signed-off-by: Michal Privoznik Reviewed-by: Michal Privoznik Tested-by: Han Han --- docs/manpages/virsh.rst | 13 ++++++++++++- tools/virsh-domain.c | 6 ++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 86deaa486d..9ef6b68422 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -2679,6 +2679,7 @@ guestinfo :: guestinfo domain [--user] [--os] [--timezone] [--hostname] [--filesystem] + [--disks] Print information about the guest from the point of view of the guest agent. Note that this command requires a guest agent to be configured and running in @@ -2689,7 +2690,7 @@ are supported by the guest agent. You can limit the types of information that are returned by specifying one or more flags. If a requested information type is not supported, the processes will provide an exit code of 1. Available information types flags are *--user*, *--os*, -*--timezone*, *--hostname*, and *--filesystem*. +*--timezone*, *--hostname*, *--filesystem* and *--disks*. Note that depending on the hypervisor type and the version of the guest agent running within the domain, not all of the following information may be @@ -2746,6 +2747,16 @@ returned: * ``fs..disk..serial`` - the serial number of disk * ``fs..disk..device`` - the device node of disk +*--disks* returns: + +* ``disks.count`` - the number of disks defined on this domain +* ``disks..name`` - device node (Linux) or device UNC (Windows) +* ``disks..partition`` - whether this is a partition or disk +* ``disks..dependencies.count`` - the number of device dependencies +* ``disks..dependencies..name`` - a dependency name +* ``disks..alias`` - the device alias of the disk (e.g. sda) +* ``disks..guest_alias`` - optional alias assigned to the disk + guestvcpus ---------- diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 7203403b31..655bac3315 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -14209,6 +14209,10 @@ static const vshCmdOptDef opts_guestinfo[] = { .type = VSH_OT_BOOL, .help = N_("report filesystem information"), }, + {.name = "disks", + .type = VSH_OT_BOOL, + .help = N_("report disks information"), + }, {.name = NULL} }; @@ -14232,6 +14236,8 @@ cmdGuestInfo(vshControl *ctl, const vshCmd *cmd) types |= VIR_DOMAIN_GUEST_INFO_HOSTNAME; if (vshCommandOptBool(cmd, "filesystem")) types |= VIR_DOMAIN_GUEST_INFO_FILESYSTEM; + if (vshCommandOptBool(cmd, "disks")) + types |= VIR_DOMAIN_GUEST_INFO_DISKS; if (!(dom = virshCommandOptDomain(ctl, cmd, NULL))) return false;