[libvirt PATCH] src: use singular form instead of plural, for guest disk info

Daniel P. Berrangé posted 1 patch 3 years, 5 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20201202121221.2464709-1-berrange@redhat.com
There is a newer version of this series
src/libvirt-domain.c   | 14 +++++++-------
src/qemu/qemu_driver.c | 14 +++++++-------
2 files changed, 14 insertions(+), 14 deletions(-)
[libvirt PATCH] src: use singular form instead of plural, for guest disk info
Posted by Daniel P. Berrangé 3 years, 5 months ago
Existing practice with the filesystem fields reported for the
virDomainGetGuestInfo API is to use the singular form for
field names. Ensure the disk info follows this practice.

Fixes

  commit 05a75ca2ce743bc0bb119fb8d532ff84646fafa3
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   Fri Nov 20 22:09:46 2020 +0400

    domain: add disk informations to virDomainGetGuestInfo

  commit 0cb2d9f05d00497a715352f6ea28cf8fb6921731
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   Fri Nov 20 22:09:47 2020 +0400

    qemu_driver: report guest disk informations

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 src/libvirt-domain.c   | 14 +++++++-------
 src/qemu/qemu_driver.c | 14 +++++++-------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 35e95e5395..f5cd43ecea 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -12345,17 +12345,17 @@ virDomainSetVcpu(virDomainPtr domain,
  *  Returns information about the disks within the domain.  The typed
  *  parameter keys are in this format:
  *
- *      "disks.count" - the number of disks defined on this domain
+ *      "disk.count" - the number of disks defined on this domain
  *                      as an unsigned int
- *      "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
+ *      "disk.<num>.name" - device node (Linux) or device UNC (Windows)
+ *      "disk.<num>.partition" - whether this is a partition or disk
+ *      "disk.<num>.dependency.count" - the number of device dependencies
  *                      e.g. for LVs of the LVM this will
  *                      hold the list of PVs, for LUKS encrypted volume this will
  *                      contain the disk where the volume is placed. (Linux)
- *      "disks.<num>.dependencies.<num>.name" - a dependency
- *      "disks.<num>.alias" - the device alias of the disk (e.g. sda)
- *      "disks.<num>.guest_alias" - optional alias assigned to the disk, on Linux
+ *      "disk.<num>.dependency.<num>.name" - a dependency
+ *      "disk.<num>.alias" - the device alias of the disk (e.g. sda)
+ *      "disk.<num>.guest_alias" - optional alias assigned to the disk, on Linux
  *                      this is a name assigned by device mapper
  *
  * VIR_DOMAIN_GUEST_INFO_HOSTNAME:
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8eaa3ce68f..548df6ae68 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -19876,20 +19876,20 @@ qemuAgentDiskInfoFormatParams(qemuAgentDiskInfoPtr *info,
     size_t i, j, ndeps;
 
     if (virTypedParamsAddUInt(params, nparams, maxparams,
-                              "disks.count", ndisks) < 0)
+                              "disk.count", ndisks) < 0)
         return;
 
     for (i = 0; i < ndisks; i++) {
         char param_name[VIR_TYPED_PARAM_FIELD_LENGTH];
 
         g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
-                   "disks.%zu.name", i);
+                   "disk.%zu.name", i);
         if (virTypedParamsAddString(params, nparams, maxparams,
                                     param_name, info[i]->name) < 0)
             return;
 
         g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
-                   "disks.%zu.partition", i);
+                   "disk.%zu.partition", i);
         if (virTypedParamsAddBoolean(params, nparams, maxparams,
                                      param_name, info[i]->partition) < 0)
             return;
@@ -19897,14 +19897,14 @@ qemuAgentDiskInfoFormatParams(qemuAgentDiskInfoPtr *info,
         if (info[i]->dependencies) {
             ndeps = g_strv_length(info[i]->dependencies);
             g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
-                       "disks.%zu.dependencies.count", i);
+                       "disk.%zu.dependency.count", i);
             if (ndeps &&
                 virTypedParamsAddUInt(params, nparams, maxparams,
                                       param_name, ndeps) < 0)
                 return;
             for (j = 0; j < ndeps; j++) {
                 g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
-                           "disks.%zu.dependencies.%zu.name", i, j);
+                           "disk.%zu.dependency.%zu.name", i, j);
                 if (virTypedParamsAddString(params, nparams, maxparams,
                                             param_name, info[i]->dependencies[j]) < 0)
                     return;
@@ -19922,7 +19922,7 @@ qemuAgentDiskInfoFormatParams(qemuAgentDiskInfoPtr *info,
                                              info[i]->address->unit);
             if (diskdef) {
                 g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
-                           "disks.%zu.alias", i);
+                           "disk.%zu.alias", i);
                 if (diskdef->dst &&
                     virTypedParamsAddString(params, nparams, maxparams,
                                             param_name, diskdef->dst) < 0)
@@ -19932,7 +19932,7 @@ qemuAgentDiskInfoFormatParams(qemuAgentDiskInfoPtr *info,
 
         if (info[i]->alias) {
             g_snprintf(param_name, VIR_TYPED_PARAM_FIELD_LENGTH,
-                       "disks.%zu.guest_alias", i);
+                       "disk.%zu.guest_alias", i);
             if (virTypedParamsAddString(params, nparams, maxparams,
                                         param_name, info[i]->alias) < 0)
                 return;
-- 
2.28.0

Re: [libvirt PATCH] src: use singular form instead of plural, for guest disk info
Posted by Peter Krempa 3 years, 5 months ago
On Wed, Dec 02, 2020 at 12:12:21 +0000, Daniel Berrange wrote:
> Existing practice with the filesystem fields reported for the
> virDomainGetGuestInfo API is to use the singular form for
> field names. Ensure the disk info follows this practice.
> 
> Fixes
> 
>   commit 05a75ca2ce743bc0bb119fb8d532ff84646fafa3
>   Author: Marc-André Lureau <marcandre.lureau@redhat.com>
>   Date:   Fri Nov 20 22:09:46 2020 +0400
> 
>     domain: add disk informations to virDomainGetGuestInfo
> 
>   commit 0cb2d9f05d00497a715352f6ea28cf8fb6921731
>   Author: Marc-André Lureau <marcandre.lureau@redhat.com>
>   Date:   Fri Nov 20 22:09:47 2020 +0400
> 
>     qemu_driver: report guest disk informations
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  src/libvirt-domain.c   | 14 +++++++-------
>  src/qemu/qemu_driver.c | 14 +++++++-------
>  2 files changed, 14 insertions(+), 14 deletions(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>