mbox series

[0/2] Clarify error messages pertaining to 'node-name'

Message ID 20210301233607.748412-1-ckuehl@redhat.com (mailing list archive)
Headers show
Series Clarify error messages pertaining to 'node-name' | expand

Message

Connor Kuehl March 1, 2021, 11:36 p.m. UTC
Some error messages contain ambiguous representations of the 'node-name'
parameter. This can be particularly confusing when exchanging QMP
messages (C = client, S = server):

C: {"execute": "block_resize", "arguments": { "device": "my_file", "size": 26843545600 }}
S: {"error": {"class": "GenericError", "desc": "Cannot find device=my_file nor node_name="}}
                                                                               ^^^^^^^^^

This error message suggests one could send a message with a key called
'node_name':

C: {"execute": "block_resize", "arguments": { "node_name": "my_file", "size": 26843545600 }}
                                               ^^^^^^^^^

but using the underscore is actually incorrect, the parameter should be
'node-name':

S: {"error": {"class": "GenericError", "desc": "Parameter 'node_name' is unexpected"}}

This behavior was uncovered in bz1651437[1], but I ended up going down a
rabbit hole looking for other areas where this miscommunication might
occur and changing those accordingly as well.

[1] https://bugzilla.redhat.com/1651437

Connor Kuehl (2):
  block: Clarify error messages pertaining to 'node-name'
  blockdev: Clarify error messages pertaining to 'node-name'

 block.c                    |  8 ++++----
 blockdev.c                 | 13 +++++++------
 tests/qemu-iotests/040     |  4 ++--
 tests/qemu-iotests/249.out |  2 +-
 4 files changed, 14 insertions(+), 13 deletions(-)

Comments

Kevin Wolf March 3, 2021, 9:53 a.m. UTC | #1
Am 02.03.2021 um 00:36 hat Connor Kuehl geschrieben:
> Some error messages contain ambiguous representations of the 'node-name'
> parameter. This can be particularly confusing when exchanging QMP
> messages (C = client, S = server):
> 
> C: {"execute": "block_resize", "arguments": { "device": "my_file", "size": 26843545600 }}
> S: {"error": {"class": "GenericError", "desc": "Cannot find device=my_file nor node_name="}}
>                                                                                ^^^^^^^^^

Arguably, this error message isn't great anyway because of the empty
string node name. We didn't even look for a node name, so why mention it
in the error message?

But your patches are certainly a good improvement already. I would have
merged them, but git grep 'nor node_name=' shows that you missed to
update a few tests, so they fail after the series. I suppose you only
caught the ones that are run by default in 'make check' and missed the
ones that require running the qemu-iotests 'check' script manually.

> This error message suggests one could send a message with a key called
> 'node_name':
> 
> C: {"execute": "block_resize", "arguments": { "node_name": "my_file", "size": 26843545600 }}
>                                                ^^^^^^^^^
> 
> but using the underscore is actually incorrect, the parameter should be
> 'node-name':
> 
> S: {"error": {"class": "GenericError", "desc": "Parameter 'node_name' is unexpected"}}
> 
> This behavior was uncovered in bz1651437[1], but I ended up going down a
> rabbit hole looking for other areas where this miscommunication might
> occur and changing those accordingly as well.
> 
> [1] https://bugzilla.redhat.com/1651437

This is a good explanation for the change you're making. I think it
deserves being committed to the repository in the commit message for
patch 1.

Kevin
Connor Kuehl March 3, 2021, 1:48 p.m. UTC | #2
On 3/3/21 3:53 AM, Kevin Wolf wrote:
> Am 02.03.2021 um 00:36 hat Connor Kuehl geschrieben:
>> Some error messages contain ambiguous representations of the 'node-name'
>> parameter. This can be particularly confusing when exchanging QMP
>> messages (C = client, S = server):
>>
>> C: {"execute": "block_resize", "arguments": { "device": "my_file", "size": 26843545600 }}
>> S: {"error": {"class": "GenericError", "desc": "Cannot find device=my_file nor node_name="}}
>>                                                                                 ^^^^^^^^^
> 
> Arguably, this error message isn't great anyway because of the empty
> string node name. We didn't even look for a node name, so why mention it
> in the error message?
> 
> But your patches are certainly a good improvement already. I would have
> merged them, but git grep 'nor node_name=' shows that you missed to
> update a few tests, so they fail after the series. I suppose you only
> caught the ones that are run by default in 'make check' and missed the
> ones that require running the qemu-iotests 'check' script manually.

Ah, good catch! Yes, I was only using `make check`, I'll use the `check` 
script to uncover the other failures and fix them accordingly.

>> [..]
> 
> This is a good explanation for the change you're making. I think it
> deserves being committed to the repository in the commit message for
> patch 1.

I'll move this to patch #1 in the next revision of this series.

Thank you!

Connor