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

Ani Sinha ani at anisinha.ca
Mon Oct 18 04:31:49 UTC 2021


Error messages must conform to spec as specified here:
https://www.libvirt.org/coding-style.html#error-message-format

This change encloses format specifiers in quotes and unbreaks error messages.

Fixes: 8eadf82fb5 ("conf: introduce option to enable/disable pci hotplug on pci-root controller")
Fixes: 7300ccc9b3 ("conf: introduce support for acpi-bridge-hotplug feature")

Signed-off-by: Ani Sinha <ani at anisinha.ca>
---
 src/conf/domain_conf.c                                      | 6 ++----
 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 +-
 4 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6fcf86ba58..d5de07d13d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -17557,8 +17557,7 @@ virDomainFeaturesPCIDefParse(virDomainDef *def,
         feature = virDomainPCITypeFromString((const char *)node->name);
         if (feature < 0) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("unsupported PCI feature: %s"),
-                           node->name);
+                           _("unsupported PCI feature: '%s'"), node->name);
             return -1;
         }
 
@@ -21833,8 +21832,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDef *src,
             case VIR_DOMAIN_PCI_ACPI_BRIDGE_HOTPLUG:
                 if (src->pci_features[i] != dst->pci_features[i]) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                                   _("State of PCI feature '%s' differs: "
-                                     "source: '%s', destination: '%s'"),
+                                   _("State of PCI feature '%s' differs: source: '%s', destination: '%s'"),
                                    virDomainPCITypeToString(i),
                                    virTristateSwitchTypeToString(src->pci_features[i]),
                                    virTristateSwitchTypeToString(dst->pci_features[i]));
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




More information about the libvir-list mailing list