[libvirt] [PATCH] qemu: Fix error message when PCI bridge has index <= bus

Commit ff2126225df0 changed the error message to be more detailed about the failure at hand; however, while the new error message claims that "bus must be <= index", the error message is displayed if "idx <= addr->bus", ie. when bus is bigger than or *equal to* index. Change the error message to report the correct constraint, and format it in a way that mirrors the check exactly to make it clearer to people reading the code. The new error message reads "must be index > bus". --- I'm assuming the code, which is pre-existing, is correct here. CC'ing Laine for insights. src/qemu/qemu_domain_address.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 7bd8ee5..650cb2a 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -1598,14 +1598,14 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, break; } - /* check if every PCI bridge controller's ID is greater than + /* check if every PCI bridge controller's index is greater than * the bus it is placed onto */ if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE && idx <= addr->bus) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("PCI controller at index %d (0x%02x) has " - "bus='0x%02x', but bus must be <= index"), + "bus='0x%02x'; must be index > bus"), idx, idx, addr->bus); goto cleanup; } -- 2.5.5

On 05/23/2016 12:00 PM, Andrea Bolognani wrote:
Commit ff2126225df0 changed the error message to be more detailed about the failure at hand; however, while the new error message claims that "bus must be <= index", the error message is displayed if "idx <= addr->bus", ie. when bus is bigger than or *equal to* index.
Change the error message to report the correct constraint, and format it in a way that mirrors the check exactly to make it clearer to people reading the code. The new error message reads "must be index > bus". --- I'm assuming the code, which is pre-existing, is correct here. CC'ing Laine for insights.
src/qemu/qemu_domain_address.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 7bd8ee5..650cb2a 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -1598,14 +1598,14 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, break; }
- /* check if every PCI bridge controller's ID is greater than + /* check if every PCI bridge controller's index is greater than * the bus it is placed onto */ if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE && idx <= addr->bus) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("PCI controller at index %d (0x%02x) has " - "bus='0x%02x', but bus must be <= index"), + "bus='0x%02x'; must be index > bus"),
ACK, but instead of re-ordering it into something that doesn't sound like a natural sentence, you could use "larger than" instead of ">", and word it like this: PCI controller at index %d (0x%02x) has bus='0x%02x', but index must be larger than bus Either way it's going to get the idea across though :-) Also, a BZ was actually filed about this :-O, so I suppose you should reference the BZ number (1339900)
idx, idx, addr->bus); goto cleanup; }

On Thu, 2016-05-26 at 09:51 -0400, Laine Stump wrote:
Commit ff2126225df0 changed the error message to be more detailed about the failure at hand; however, while the new error message claims that "bus must be <= index", the error message is displayed if "idx <= addr->bus", ie. when bus is bigger than or *equal to* index. Change the error message to report the correct constraint, and format it in a way that mirrors the check exactly to make it clearer to people reading the code. The new error message reads "must be index > bus". --- I'm assuming the code, which is pre-existing, is correct here. CC'ing Laine for insights. src/qemu/qemu_domain_address.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 7bd8ee5..650cb2a 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -1598,14 +1598,14 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, break; } - /* check if every PCI bridge controller's ID is greater than + /* check if every PCI bridge controller's index is greater than * the bus it is placed onto */ if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE && idx <= addr->bus) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("PCI controller at index %d (0x%02x) has " - "bus='0x%02x', but bus must be <= index"), + "bus='0x%02x'; must be index > bus"), ACK, but instead of re-ordering it into something that doesn't sound
On 05/23/2016 12:00 PM, Andrea Bolognani wrote: like a natural sentence, you could use "larger than" instead of ">", and word it like this: PCI controller at index %d (0x%02x) has bus='0x%02x', but index must be larger than bus Either way it's going to get the idea across though :-)
I changed the error message according to your suggestion and pushed it.
Also, a BZ was actually filed about this :-O, so I suppose you should reference the BZ number (1339900)
Ján had found that BZ and, seeing as I had already proposed a fix, assigned it to me just this morning :) -- Andrea Bolognani Software Engineer - Virtualization Team
participants (2)
-
Andrea Bolognani
-
Laine Stump