OSDN Git Service

qom: Improve error messages when property has no getter or setter
authorMarkus Armbruster <armbru@redhat.com>
Wed, 12 Oct 2022 15:37:58 +0000 (17:37 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Thu, 27 Oct 2022 05:54:45 +0000 (07:54 +0200)
commit3f7febc93785bf0e622072b01f846d2acbcd9c0b
tree99fecb8db9b01b99bb7ab8a9c9704ae1f720be63
parent344744e148e6e865f5a57e745b02a87e5ea534ad
qom: Improve error messages when property has no getter or setter

When you try to set a property that has no setter, the error message
blames "insufficient permission":

    $ qemu-system-x86_64 -S -display none -nodefaults -monitor stdio
    QEMU 7.1.50 monitor - type 'help' for more information
    (qemu) qom-set /machine type q35
    Error: Insufficient permission to perform this operation

This implies it could work with "sufficient permission".  It can't.
Change the error message to:

    Error: Property 'pc-i440fx-7.2-machine.type' is not writable

Do the same for getting a property that has no getter.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20221012153801.2604340-2-armbru@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
qom/object.c