aboutsummaryrefslogtreecommitdiff
path: root/monitor
diff options
context:
space:
mode:
Diffstat (limited to 'monitor')
-rw-r--r--monitor/misc.c12
-rw-r--r--monitor/qmp-cmds.c38
2 files changed, 21 insertions, 29 deletions
diff --git a/monitor/misc.c b/monitor/misc.c
index 398211a034..7ffe6f7a84 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -441,13 +441,13 @@ void qmp_client_migrate_info(const char *protocol, const char *hostname,
has_port ? port : -1,
has_tls_port ? tls_port : -1,
cert_subject)) {
- error_setg(errp, QERR_UNDEFINED_ERROR);
+ error_setg(errp, "Could not set up display for migration");
return;
}
return;
}
- error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "protocol", "spice");
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "protocol", "'spice'");
}
static void hmp_logfile(Monitor *mon, const QDict *qdict)
@@ -1232,7 +1232,7 @@ void qmp_getfd(const char *fdname, Error **errp)
fd = qemu_chr_fe_get_msgfd(&cur_mon->chr);
if (fd == -1) {
- error_setg(errp, QERR_FD_NOT_SUPPLIED);
+ error_setg(errp, "No file descriptor supplied via SCM_RIGHTS");
return;
}
@@ -1286,7 +1286,7 @@ void qmp_closefd(const char *fdname, Error **errp)
}
qemu_mutex_unlock(&cur_mon->mon_lock);
- error_setg(errp, QERR_FD_NOT_FOUND, fdname);
+ error_setg(errp, "File descriptor named '%s' not found", fdname);
}
int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp)
@@ -1357,7 +1357,7 @@ AddfdInfo *qmp_add_fd(bool has_fdset_id, int64_t fdset_id, bool has_opaque,
fd = qemu_chr_fe_get_msgfd(&mon->chr);
if (fd == -1) {
- error_setg(errp, QERR_FD_NOT_SUPPLIED);
+ error_setg(errp, "No file descriptor supplied via SCM_RIGHTS");
goto error;
}
@@ -1410,7 +1410,7 @@ error:
} else {
snprintf(fd_str, sizeof(fd_str), "fdset-id:%" PRId64, fdset_id);
}
- error_setg(errp, QERR_FD_NOT_FOUND, fd_str);
+ error_setg(errp, "File descriptor named '%s' not found", fd_str);
}
FdsetInfoList *qmp_query_fdsets(Error **errp)
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
index a08143b323..ffbf948d55 100644
--- a/monitor/qmp-cmds.c
+++ b/monitor/qmp-cmds.c
@@ -199,13 +199,7 @@ void qmp_set_password(const char *protocol, const char *password,
}
rc = qemu_spice.set_passwd(password, fail_if_connected,
disconnect_if_connected);
- if (rc != 0) {
- error_setg(errp, QERR_SET_PASSWD_FAILED);
- }
- return;
- }
-
- if (strcmp(protocol, "vnc") == 0) {
+ } else if (strcmp(protocol, "vnc") == 0) {
if (fail_if_connected || disconnect_if_connected) {
/* vnc supports "connected=keep" only */
error_setg(errp, QERR_INVALID_PARAMETER, "connected");
@@ -214,13 +208,15 @@ void qmp_set_password(const char *protocol, const char *password,
/* Note that setting an empty password will not disable login through
* this interface. */
rc = vnc_display_password(NULL, password);
- if (rc < 0) {
- error_setg(errp, QERR_SET_PASSWD_FAILED);
- }
+ } else {
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "protocol",
+ "'vnc' or 'spice'");
return;
}
- error_setg(errp, QERR_INVALID_PARAMETER, "protocol");
+ if (rc != 0) {
+ error_setg(errp, "Could not set password");
+ }
}
void qmp_expire_password(const char *protocol, const char *whenstr,
@@ -244,28 +240,24 @@ void qmp_expire_password(const char *protocol, const char *whenstr,
return;
}
rc = qemu_spice.set_pw_expire(when);
- if (rc != 0) {
- error_setg(errp, QERR_SET_PASSWD_FAILED);
- }
- return;
- }
-
- if (strcmp(protocol, "vnc") == 0) {
+ } else if (strcmp(protocol, "vnc") == 0) {
rc = vnc_display_pw_expire(NULL, when);
- if (rc != 0) {
- error_setg(errp, QERR_SET_PASSWD_FAILED);
- }
+ } else {
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "protocol",
+ "'vnc' or 'spice'");
return;
}
- error_setg(errp, QERR_INVALID_PARAMETER, "protocol");
+ if (rc != 0) {
+ error_setg(errp, "Could not set password expire time");
+ }
}
#ifdef CONFIG_VNC
void qmp_change_vnc_password(const char *password, Error **errp)
{
if (vnc_display_password(NULL, password) < 0) {
- error_setg(errp, QERR_SET_PASSWD_FAILED);
+ error_setg(errp, "Could not set password");
}
}