[PATCH] i440fx/hotplug: Fix error message format to conform to spec

Ani Sinha posted 1 patch 2 years, 6 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20211021033026.228732-1-ani@anisinha.ca
src/qemu/qemu_validate.c                                    | 6 +++---
.../pc-i440fx-acpi-root-hotplug-disable.x86_64-5.1.0.err    | 2 +-
.../pc-i440fx-acpi-root-hotplug-enable.x86_64-5.1.0.err     | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
[PATCH] i440fx/hotplug: Fix error message format to conform to spec
Posted by Ani Sinha 2 years, 6 months ago
Error messages must conform to spec as specified here:
https://www.libvirt.org/coding-style.html#error-message-format

This change makes some error messages conform to the spec above.

Fixes: 8eadf82fb5 ("conf: introduce option to enable/disable pci hotplug on pci-root controller")

Signed-off-by: Ani Sinha <ani@anisinha.ca>
---
 src/qemu/qemu_validate.c                                    | 6 +++---
 .../pc-i440fx-acpi-root-hotplug-disable.x86_64-5.1.0.err    | 2 +-
 .../pc-i440fx-acpi-root-hotplug-enable.x86_64-5.1.0.err     | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 3045e4b64b..f93b697265 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -3947,7 +3947,7 @@ qemuValidateDomainDeviceDefControllerPCI(const virDomainControllerDef *cont,
         case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
             if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX4_ACPI_ROOT_PCI_HOTPLUG)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                               _("setting the %s property on a '%s' device is not supported by this QEMU binary"),
+                               _("setting the '%s' property on a '%s' device is not supported by this QEMU binary"),
                                "hotplug", "pci-root");
                 return -1;
             }
@@ -3956,8 +3956,8 @@ qemuValidateDomainDeviceDefControllerPCI(const virDomainControllerDef *cont,
         case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT:
             if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCIE_ROOT_PORT_HOTPLUG)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                               _("setting the hotplug property on a '%s' device is not supported by this QEMU binary"),
-                               modelName);
+                               _("setting the '%s' property on a '%s' device is not supported by this QEMU binary"),
+                               "hotplug", modelName);
                 return -1;
             }
             break;
diff --git a/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-disable.x86_64-5.1.0.err b/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-disable.x86_64-5.1.0.err
index b507f1f8bc..55ec41c476 100644
--- a/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-disable.x86_64-5.1.0.err
+++ b/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-disable.x86_64-5.1.0.err
@@ -1 +1 @@
-unsupported configuration: setting the hotplug property on a 'pci-root' device is not supported by this QEMU binary
+unsupported configuration: setting the 'hotplug' property on a 'pci-root' device is not supported by this QEMU binary
diff --git a/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-enable.x86_64-5.1.0.err b/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-enable.x86_64-5.1.0.err
index b507f1f8bc..55ec41c476 100644
--- a/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-enable.x86_64-5.1.0.err
+++ b/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-enable.x86_64-5.1.0.err
@@ -1 +1 @@
-unsupported configuration: setting the hotplug property on a 'pci-root' device is not supported by this QEMU binary
+unsupported configuration: setting the 'hotplug' property on a 'pci-root' device is not supported by this QEMU binary
-- 
2.25.1

Re: [PATCH] i440fx/hotplug: Fix error message format to conform to spec
Posted by Laine Stump 2 years, 6 months ago
On 10/20/21 11:30 PM, Ani Sinha wrote:
> Error messages must conform to spec as specified here:
> https://www.libvirt.org/coding-style.html#error-message-format
> 
> This change makes some error messages conform to the spec above.
> 
> Fixes: 8eadf82fb5 ("conf: introduce option to enable/disable pci hotplug on pci-root controller")
> 
> Signed-off-by: Ani Sinha <ani@anisinha.ca>

Reviewed-by: Laine Stump <laine@redhat.com>

and pushed.

> ---
>   src/qemu/qemu_validate.c                                    | 6 +++---
>   .../pc-i440fx-acpi-root-hotplug-disable.x86_64-5.1.0.err    | 2 +-
>   .../pc-i440fx-acpi-root-hotplug-enable.x86_64-5.1.0.err     | 2 +-
>   3 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
> index 3045e4b64b..f93b697265 100644
> --- a/src/qemu/qemu_validate.c
> +++ b/src/qemu/qemu_validate.c
> @@ -3947,7 +3947,7 @@ qemuValidateDomainDeviceDefControllerPCI(const virDomainControllerDef *cont,
>           case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
>               if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX4_ACPI_ROOT_PCI_HOTPLUG)) {
>                   virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> -                               _("setting the %s property on a '%s' device is not supported by this QEMU binary"),
> +                               _("setting the '%s' property on a '%s' device is not supported by this QEMU binary"),
>                                  "hotplug", "pci-root");
>                   return -1;
>               }
> @@ -3956,8 +3956,8 @@ qemuValidateDomainDeviceDefControllerPCI(const virDomainControllerDef *cont,
>           case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT:
>               if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCIE_ROOT_PORT_HOTPLUG)) {
>                   virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> -                               _("setting the hotplug property on a '%s' device is not supported by this QEMU binary"),
> -                               modelName);
> +                               _("setting the '%s' property on a '%s' device is not supported by this QEMU binary"),
> +                               "hotplug", modelName);
>                   return -1;
>               }
>               break;
> diff --git a/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-disable.x86_64-5.1.0.err b/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-disable.x86_64-5.1.0.err
> index b507f1f8bc..55ec41c476 100644
> --- a/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-disable.x86_64-5.1.0.err
> +++ b/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-disable.x86_64-5.1.0.err
> @@ -1 +1 @@
> -unsupported configuration: setting the hotplug property on a 'pci-root' device is not supported by this QEMU binary
> +unsupported configuration: setting the 'hotplug' property on a 'pci-root' device is not supported by this QEMU binary
> diff --git a/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-enable.x86_64-5.1.0.err b/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-enable.x86_64-5.1.0.err
> index b507f1f8bc..55ec41c476 100644
> --- a/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-enable.x86_64-5.1.0.err
> +++ b/tests/qemuxml2argvdata/pc-i440fx-acpi-root-hotplug-enable.x86_64-5.1.0.err
> @@ -1 +1 @@
> -unsupported configuration: setting the hotplug property on a 'pci-root' device is not supported by this QEMU binary
> +unsupported configuration: setting the 'hotplug' property on a 'pci-root' device is not supported by this QEMU binary
>