summary refs log tree commit diff stats
path: root/qga/commands.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2024-05-14 12:58:27 +0200
committerMarkus Armbruster <armbru@redhat.com>2024-05-27 12:59:10 +0200
commitcec07c79a41827689f9b9ea7be47fd1ae17a1242 (patch)
treeffe48988c0579ef62734b591756e922e3b12fabc /qga/commands.c
parentecfc9890c41541fb08ce07a6ff26e7bd14f74967 (diff)
downloadfocaccia-qemu-cec07c79a41827689f9b9ea7be47fd1ae17a1242.tar.gz
focaccia-qemu-cec07c79a41827689f9b9ea7be47fd1ae17a1242.zip
qga: Shorten several error messages
Some, but not all error messages are of the form

    Guest agent command failed, error was '<actual error message>'

For instance, command guest-exec can fail with an error message like

    Guest agent command failed, error was 'Failed to execute child process “/bin/invalid-cmd42” (No such file or directory)'

Shorten this to just just the actual error message.  The guest-exec
example becomes

    Failed to execute child process “/bin/invalid-cmd42” (No such file or directory)

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240514105829.729342-3-armbru@redhat.com>
[Superfluous #include "qapi/qmp/qerror.h" deleted]
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Diffstat (limited to 'qga/commands.c')
-rw-r--r--qga/commands.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/qga/commands.c b/qga/commands.c
index 88c1c99fe5..5a5fad31f8 100644
--- a/qga/commands.c
+++ b/qga/commands.c
@@ -15,7 +15,6 @@
 #include "guest-agent-core.h"
 #include "qga-qapi-commands.h"
 #include "qapi/error.h"
-#include "qapi/qmp/qerror.h"
 #include "qemu/base64.h"
 #include "qemu/cutils.h"
 #include "commands-common.h"
@@ -475,7 +474,7 @@ GuestExec *qmp_guest_exec(const char *path,
             guest_exec_task_setup, &has_merge, &pid, input_data ? &in_fd : NULL,
             has_output ? &out_fd : NULL, has_output ? &err_fd : NULL, &gerr);
     if (!ret) {
-        error_setg(errp, QERR_QGA_COMMAND_FAILED, gerr->message);
+        error_setg(errp, "%s", gerr->message);
         g_error_free(gerr);
         goto done;
     }
@@ -586,8 +585,7 @@ GuestTimezone *qmp_guest_get_timezone(Error **errp)
     info = g_new0(GuestTimezone, 1);
     tz = g_time_zone_new_local();
     if (tz == NULL) {
-        error_setg(errp, QERR_QGA_COMMAND_FAILED,
-                   "Couldn't retrieve local timezone");
+        error_setg(errp, "Couldn't retrieve local timezone");
         goto error;
     }