summaryrefslogtreecommitdiffstats
path: root/backends
diff options
context:
space:
mode:
authorMarkus Armbruster2022-10-12 17:37:59 +0200
committerMarkus Armbruster2022-10-27 07:56:56 +0200
commitff924448849f4fca48df15ecad67dc93854392e5 (patch)
tree73797ff424969e0b3d5a42d57dbdd40d64aaba9f /backends
parentqom: Improve error messages when property has no getter or setter (diff)
downloadqemu-ff924448849f4fca48df15ecad67dc93854392e5.tar.gz
qemu-ff924448849f4fca48df15ecad67dc93854392e5.tar.xz
qemu-ff924448849f4fca48df15ecad67dc93854392e5.zip
backends: Improve error messages when property can no longer be set
When you try to set virtio-rng property "filename" after the backend has been completed with user_creatable_complete(), the error message blames "insufficient permission": $ qemu-system-x86_64 -S -display none -nodefaults -monitor stdio -object rng-random,id=rng0 -device virtio-rng,id=vrng0,rng=rng0 QEMU 7.1.50 monitor - type 'help' for more information (qemu) qom-set /objects/rng0 filename /dev/random 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 'filename' can no longer be set Same for cryptodev-vhost-user property "chardev", rng-egd property "chardev", and vhost-user-backend property "chardev". Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20221012153801.2604340-3-armbru@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> [Commit message tidied up]
Diffstat (limited to 'backends')
-rw-r--r--backends/cryptodev-vhost-user.c2
-rw-r--r--backends/rng-egd.c2
-rw-r--r--backends/rng-random.c2
-rw-r--r--backends/vhost-user.c2
4 files changed, 4 insertions, 4 deletions
diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c
index 5443a59153..f9c5867e38 100644
--- a/backends/cryptodev-vhost-user.c
+++ b/backends/cryptodev-vhost-user.c
@@ -339,7 +339,7 @@ static void cryptodev_vhost_user_set_chardev(Object *obj,
CRYPTODEV_BACKEND_VHOST_USER(obj);
if (s->opened) {
- error_setg(errp, QERR_PERMISSION_DENIED);
+ error_setg(errp, "Property 'chardev' can no longer be set");
} else {
g_free(s->chr_name);
s->chr_name = g_strdup(value);
diff --git a/backends/rng-egd.c b/backends/rng-egd.c
index 4de142b9dc..684c3cf3d6 100644
--- a/backends/rng-egd.c
+++ b/backends/rng-egd.c
@@ -116,7 +116,7 @@ static void rng_egd_set_chardev(Object *obj, const char *value, Error **errp)
RngEgd *s = RNG_EGD(b);
if (b->opened) {
- error_setg(errp, QERR_PERMISSION_DENIED);
+ error_setg(errp, "Property 'chardev' can no longer be set");
} else {
g_free(s->chr_name);
s->chr_name = g_strdup(value);
diff --git a/backends/rng-random.c b/backends/rng-random.c
index 7add272edd..80eb5be138 100644
--- a/backends/rng-random.c
+++ b/backends/rng-random.c
@@ -96,7 +96,7 @@ static void rng_random_set_filename(Object *obj, const char *filename,
RngRandom *s = RNG_RANDOM(obj);
if (b->opened) {
- error_setg(errp, QERR_PERMISSION_DENIED);
+ error_setg(errp, "Property 'filename' can no longer be set");
return;
}
diff --git a/backends/vhost-user.c b/backends/vhost-user.c
index 10b39992d2..5dedb2d987 100644
--- a/backends/vhost-user.c
+++ b/backends/vhost-user.c
@@ -141,7 +141,7 @@ static void set_chardev(Object *obj, const char *value, Error **errp)
Chardev *chr;
if (b->completed) {
- error_setg(errp, QERR_PERMISSION_DENIED);
+ error_setg(errp, "Property 'chardev' can no longer be set");
return;
}