#include "qemu/cutils.h"
#include "monitor/monitor.h"
#include "sysemu/sysemu.h"
+#include "qemu/config-file.h"
+#include "qemu/uuid.h"
#include "qmp-commands.h"
#include "sysemu/char.h"
#include "ui/qemu-spice.h"
#include "qom/qom-qobject.h"
#include "qapi/qmp/qerror.h"
#include "qapi/qmp/qobject.h"
-#include "qapi/qmp-input-visitor.h"
+#include "qapi/qobject-input-visitor.h"
#include "hw/boards.h"
#include "qom/object_interfaces.h"
#include "hw/mem/pc-dimm.h"
VersionInfo *qmp_query_version(Error **errp)
{
VersionInfo *info = g_new0(VersionInfo, 1);
- const char *version = QEMU_VERSION;
- const char *tmp;
- int err;
info->qemu = g_new0(VersionTriple, 1);
- err = qemu_strtoll(version, &tmp, 10, &info->qemu->major);
- assert(err == 0);
- tmp++;
-
- err = qemu_strtoll(tmp, &tmp, 10, &info->qemu->minor);
- assert(err == 0);
- tmp++;
-
- err = qemu_strtoll(tmp, &tmp, 10, &info->qemu->micro);
- assert(err == 0);
+ 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;
UuidInfo *qmp_query_uuid(Error **errp)
{
UuidInfo *info = g_malloc0(sizeof(*info));
- char uuid[64];
-
- snprintf(uuid, sizeof(uuid), UUID_FMT, qemu_uuid[0], qemu_uuid[1],
- qemu_uuid[2], qemu_uuid[3], qemu_uuid[4], qemu_uuid[5],
- qemu_uuid[6], qemu_uuid[7], qemu_uuid[8], qemu_uuid[9],
- qemu_uuid[10], qemu_uuid[11], qemu_uuid[12], qemu_uuid[13],
- qemu_uuid[14], qemu_uuid[15]);
- info->UUID = g_strdup(uuid);
+ info->UUID = qemu_uuid_unparse_strdup(&qemu_uuid);
return info;
}
void qmp_quit(Error **errp)
{
no_shutdown = 0;
- qemu_system_shutdown_request();
+ qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_QMP);
}
void qmp_stop(Error **errp)
void qmp_system_reset(Error **errp)
{
- qemu_system_reset_request();
+ qemu_system_reset_request(SHUTDOWN_CAUSE_HOST_QMP);
}
void qmp_system_powerdown(Error **erp)
}
/* Continuing after completed migration. Images have been inactivated to
- * allow the destination to take control. Need to get control back now. */
- if (runstate_check(RUN_STATE_FINISH_MIGRATE) ||
- runstate_check(RUN_STATE_POSTMIGRATE))
- {
- bdrv_invalidate_cache_all(&local_err);
- if (local_err) {
- error_propagate(errp, local_err);
- return;
- }
+ * allow the destination to take control. Need to get control back now.
+ *
+ * If there are no inactive block nodes (e.g. because the VM was just
+ * paused rather than completing a migration), bdrv_inactivate_all() simply
+ * doesn't do anything. */
+ bdrv_invalidate_cache_all(&local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
}
if (runstate_check(RUN_STATE_INMIGRATE)) {
if (strcmp(device, "vnc") == 0) {
qmp_change_vnc(target, has_arg, arg, errp);
} else {
- qmp_blockdev_change_medium(device, target, has_arg, arg, false, 0,
- errp);
+ qmp_blockdev_change_medium(true, device, false, NULL, target,
+ has_arg, arg, false, 0, errp);
}
}
klass = object_class_dynamic_cast(klass, TYPE_DEVICE);
if (klass == NULL) {
- error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "name", TYPE_DEVICE);
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename", TYPE_DEVICE);
return NULL;
}
if (object_class_is_abstract(klass)) {
- error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "name",
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename",
"non-abstract device type");
return NULL;
}
- if (DEVICE_CLASS(klass)->cannot_destroy_with_object_finalize_yet) {
- error_setg(errp, "Can't list properties of device '%s'", typename);
- return NULL;
- }
-
obj = object_new(typename);
object_property_iter_init(&iter, obj);
return arch_query_cpu_definitions(errp);
}
+CpuModelExpansionInfo *qmp_query_cpu_model_expansion(CpuModelExpansionType type,
+ CpuModelInfo *model,
+ Error **errp)
+{
+ return arch_query_cpu_model_expansion(type, model, errp);
+}
+
+CpuModelCompareInfo *qmp_query_cpu_model_comparison(CpuModelInfo *modela,
+ CpuModelInfo *modelb,
+ Error **errp)
+{
+ return arch_query_cpu_model_comparison(modela, modelb, errp);
+}
+
+CpuModelBaselineInfo *qmp_query_cpu_model_baseline(CpuModelInfo *modela,
+ CpuModelInfo *modelb,
+ Error **errp)
+{
+ return arch_query_cpu_model_baseline(modela, modelb, errp);
+}
+
void qmp_add_client(const char *protocol, const char *fdname,
bool has_skipauth, bool skipauth, bool has_tls, bool tls,
Error **errp)
{
- CharDriverState *s;
+ Chardev *s;
int fd;
fd = monitor_get_fd(cur_mon, fdname, errp);
void qmp_object_add(const char *type, const char *id,
bool has_props, QObject *props, Error **errp)
{
- const QDict *pdict = NULL;
+ QDict *pdict;
Visitor *v;
Object *obj;
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, "props", "dict");
return;
}
+ QINCREF(pdict);
+ } else {
+ pdict = qdict_new();
}
- v = qmp_input_visitor_new(props, true);
+ v = qobject_input_visitor_new(QOBJECT(pdict));
obj = user_creatable_add_type(type, id, pdict, v, errp);
visit_free(v);
if (obj) {
object_unref(obj);
}
+ QDECREF(pdict);
}
void qmp_object_del(const char *id, Error **errp)