[libvirt PATCH 9/9] virsh: add --disk informations to guestinfo command

marcandre.lureau@redhat.com posted 9 patches 5 years, 2 months ago
[libvirt PATCH 9/9] virsh: add --disk informations to guestinfo command
Posted by marcandre.lureau@redhat.com 5 years, 2 months ago
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tools/virsh-domain.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index c999458d72..070b8d21fd 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -14219,6 +14219,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}
 };
 
@@ -14242,6 +14246,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;
-- 
2.29.0

Re: [libvirt PATCH 9/9] virsh: add --disk informations to guestinfo command
Posted by Michal Privoznik 5 years, 2 months ago
On 11/20/20 7:09 PM, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   tools/virsh-domain.c | 6 ++++++
>   1 file changed, 6 insertions(+)

Missing manpage addition. How about:

diff --git i/docs/manpages/virsh.rst w/docs/manpages/virsh.rst
index 86deaa486d..9ef6b68422 100644
--- i/docs/manpages/virsh.rst
+++ w/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.<num>.disk.<num>.serial`` - the serial number of disk <num>
  * ``fs.<num>.disk.<num>.device`` - the device node of disk <num>

+*--disks* returns:
+
+* ``disks.count`` - the number of disks defined on this domain
+* ``disks.<num>.name`` - device node (Linux) or device UNC (Windows)
+* ``disks.<num>.partition`` - whether this is a partition or disk
+* ``disks.<num>.dependencies.count`` - the number of device dependencies
+* ``disks.<num>.dependencies.<num>.name`` - a dependency name
+* ``disks.<num>.alias`` - the device alias of the disk (e.g. sda)
+* ``disks.<num>.guest_alias`` - optional alias assigned to the disk
+

  guestvcpus
  ----------


Michal

Re: [libvirt PATCH 9/9] virsh: add --disk informations to guestinfo command
Posted by Marc-André Lureau 5 years, 2 months ago
Hi

On Mon, Nov 30, 2020 at 11:16 PM Michal Privoznik <mprivozn@redhat.com> wrote:
>
> On 11/20/20 7:09 PM, marcandre.lureau@redhat.com wrote:
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >   tools/virsh-domain.c | 6 ++++++
> >   1 file changed, 6 insertions(+)
>
> Missing manpage addition. How about:
>
> diff --git i/docs/manpages/virsh.rst w/docs/manpages/virsh.rst
> index 86deaa486d..9ef6b68422 100644
> --- i/docs/manpages/virsh.rst
> +++ w/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.<num>.disk.<num>.serial`` - the serial number of disk <num>
>   * ``fs.<num>.disk.<num>.device`` - the device node of disk <num>
>
> +*--disks* returns:
> +
> +* ``disks.count`` - the number of disks defined on this domain
> +* ``disks.<num>.name`` - device node (Linux) or device UNC (Windows)
> +* ``disks.<num>.partition`` - whether this is a partition or disk
> +* ``disks.<num>.dependencies.count`` - the number of device dependencies
> +* ``disks.<num>.dependencies.<num>.name`` - a dependency name
> +* ``disks.<num>.alias`` - the device alias of the disk (e.g. sda)
> +* ``disks.<num>.guest_alias`` - optional alias assigned to the disk
> +
>
>   guestvcpus
>   ----------

Looks good, thanks