#include "qemu/osdep.h"
#include "qemu-common.h"
-#include "qemu-version.h"
#include "qemu/cutils.h"
#include "qemu/option.h"
#include "monitor/monitor.h"
#include "ui/qemu-spice.h"
#include "ui/vnc.h"
#include "sysemu/kvm.h"
+#include "sysemu/runstate.h"
#include "sysemu/arch_init.h"
#include "sysemu/blockdev.h"
#include "sysemu/block-backend.h"
#include "qapi/error.h"
-#include "qapi/qapi-commands-block-core.h"
+#include "qapi/qapi-commands-acpi.h"
+#include "qapi/qapi-commands-block.h"
+#include "qapi/qapi-commands-control.h"
#include "qapi/qapi-commands-machine.h"
#include "qapi/qapi-commands-misc.h"
#include "qapi/qapi-commands-ui.h"
#include "qapi/qmp/qerror.h"
-#include "hw/boards.h"
#include "hw/mem/memory-device.h"
#include "hw/acpi/acpi_dev_interface.h"
return info;
}
-VersionInfo *qmp_query_version(Error **errp)
-{
- VersionInfo *info = g_new0(VersionInfo, 1);
-
- info->qemu = g_new0(VersionTriple, 1);
- info->qemu->major = QEMU_VERSION_MAJOR;
- info->qemu->minor = QEMU_VERSION_MINOR;
- info->qemu->micro = QEMU_VERSION_MICRO;
- info->package = g_strdup(QEMU_PKGVERSION);
-
- return info;
-}
-
KvmInfo *qmp_query_kvm(Error **errp)
{
KvmInfo *info = g_malloc0(sizeof(*info));
qemu_system_reset_request(SHUTDOWN_CAUSE_HOST_QMP_SYSTEM_RESET);
}
-void qmp_system_powerdown(Error **erp)
+void qmp_system_powerdown(Error **errp)
{
qemu_system_powerdown_request();
}
if (!qemu_using_spice(errp)) {
return;
}
- rc = qemu_spice_set_passwd(password, fail_if_connected,
+ 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");
/* 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,
if (!qemu_using_spice(errp)) {
return;
}
- rc = qemu_spice_set_pw_expire(when);
- if (rc != 0) {
- error_setg(errp, QERR_SET_PASSWD_FAILED);
- }
- return;
- }
-
- if (strcmp(protocol, "vnc") == 0) {
+ rc = qemu_spice.set_pw_expire(when);
+ } 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");
}
}
Chardev *s;
int fd;
- fd = monitor_get_fd(cur_mon, fdname, errp);
+ fd = monitor_get_fd(monitor_cur(), fdname, errp);
if (fd < 0) {
return;
}
}
skipauth = has_skipauth ? skipauth : false;
tls = has_tls ? tls : false;
- if (qemu_spice_display_add_client(fd, skipauth, tls) < 0) {
+ if (qemu_spice.display_add_client(fd, skipauth, tls) < 0) {
error_setg(errp, "spice failed to add client");
close(fd);
}
MemoryInfo *qmp_query_memory_size_summary(Error **errp)
{
MemoryInfo *mem_info = g_malloc0(sizeof(MemoryInfo));
+ MachineState *ms = MACHINE(qdev_get_machine());
- mem_info->base_memory = ram_size;
+ mem_info->base_memory = ms->ram_size;
mem_info->plugged_memory = get_plugged_memory_size();
mem_info->has_plugged_memory =