mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2017-07-18-v2' into staging
QAPI patches for 2017-07-18 # gpg: Signature made Mon 24 Jul 2017 12:40:56 BST # gpg: using RSA key 0x3870B400EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-qapi-2017-07-18-v2: migration: Use JSON null instead of "" to reset parameter to default migration: Unshare MigrationParameters struct for now migration: Add TODO comments on duplication of QAPI_CLONE() migration: Clean up around tls_creds, tls_hostname hmp: Clean up and simplify hmp_migrate_set_parameter() block: Use JSON null instead of "" to disable backing file tests/test-qobject-input-visitor: Drop redundant test qapi: Introduce a first class 'null' type qapi: Use QNull for a more regular visit_type_null() qapi: Separate type QNull from QObject Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
+14
@@ -3887,6 +3887,7 @@ void qmp_blockdev_add(BlockdevOptions *options, Error **errp)
|
||||
QObject *obj;
|
||||
Visitor *v = qobject_output_visitor_new(&obj);
|
||||
QDict *qdict;
|
||||
const QDictEntry *ent;
|
||||
Error *local_err = NULL;
|
||||
|
||||
visit_type_BlockdevOptions(v, NULL, &options, &local_err);
|
||||
@@ -3900,6 +3901,19 @@ void qmp_blockdev_add(BlockdevOptions *options, Error **errp)
|
||||
|
||||
qdict_flatten(qdict);
|
||||
|
||||
/*
|
||||
* Rewrite "backing": null to "backing": ""
|
||||
* TODO Rewrite "" to null instead, and perhaps not even here
|
||||
*/
|
||||
for (ent = qdict_first(qdict); ent; ent = qdict_next(qdict, ent)) {
|
||||
char *dot = strrchr(ent->key, '.');
|
||||
|
||||
if (!strcmp(dot ? dot + 1 : ent->key, "backing")
|
||||
&& qobject_type(ent->value) == QTYPE_QNULL) {
|
||||
qdict_put(qdict, ent->key, qstring_new());
|
||||
}
|
||||
}
|
||||
|
||||
if (!qdict_get_try_str(qdict, "node-name")) {
|
||||
error_setg(errp, "'node-name' must be specified for the root node");
|
||||
goto fail;
|
||||
|
||||
@@ -282,6 +282,7 @@ The following types are predefined, and map to C as follows:
|
||||
size uint64_t like uint64_t, except StringInputVisitor
|
||||
accepts size suffixes
|
||||
bool bool JSON true or false
|
||||
null QNull * JSON null
|
||||
any QObject * any JSON value
|
||||
QType QType JSON string matching enum QType values
|
||||
|
||||
@@ -536,10 +537,11 @@ can only express a choice between types represented differently in
|
||||
JSON. If a branch is typed as the 'bool' built-in, the alternate
|
||||
accepts true and false; if it is typed as any of the various numeric
|
||||
built-ins, it accepts a JSON number; if it is typed as a 'str'
|
||||
built-in or named enum type, it accepts a JSON string; and if it is
|
||||
typed as a complex type (struct or union), it accepts a JSON object.
|
||||
Two different complex types, for instance, aren't permitted, because
|
||||
both are represented as a JSON object.
|
||||
built-in or named enum type, it accepts a JSON string; if it is typed
|
||||
as the 'null' built-in, it accepts JSON null; and if it is typed as a
|
||||
complex type (struct or union), it accepts a JSON object. Two
|
||||
different complex types, for instance, aren't permitted, because both
|
||||
are represented as a JSON object.
|
||||
|
||||
The example alternate declaration above allows using both of the
|
||||
following example objects:
|
||||
|
||||
@@ -313,12 +313,14 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
|
||||
monitor_printf(mon, "%s: %" PRId64 "\n",
|
||||
MigrationParameter_lookup[MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT],
|
||||
params->cpu_throttle_increment);
|
||||
assert(params->has_tls_creds);
|
||||
monitor_printf(mon, "%s: '%s'\n",
|
||||
MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_CREDS],
|
||||
params->has_tls_creds ? params->tls_creds : "");
|
||||
params->tls_creds);
|
||||
assert(params->has_tls_hostname);
|
||||
monitor_printf(mon, "%s: '%s'\n",
|
||||
MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_HOSTNAME],
|
||||
params->has_tls_hostname ? params->tls_hostname : "");
|
||||
params->tls_hostname);
|
||||
assert(params->has_max_bandwidth);
|
||||
monitor_printf(mon, "%s: %" PRId64 " bytes/second\n",
|
||||
MigrationParameter_lookup[MIGRATION_PARAMETER_MAX_BANDWIDTH],
|
||||
@@ -1554,90 +1556,79 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
|
||||
const char *param = qdict_get_str(qdict, "parameter");
|
||||
const char *valuestr = qdict_get_str(qdict, "value");
|
||||
Visitor *v = string_input_visitor_new(valuestr);
|
||||
MigrateSetParameters *p = g_new0(MigrateSetParameters, 1);
|
||||
uint64_t valuebw = 0;
|
||||
int64_t valueint = 0;
|
||||
bool valuebool = false;
|
||||
Error *err = NULL;
|
||||
bool use_int_value = false;
|
||||
int i, ret;
|
||||
|
||||
for (i = 0; i < MIGRATION_PARAMETER__MAX; i++) {
|
||||
if (strcmp(param, MigrationParameter_lookup[i]) == 0) {
|
||||
MigrationParameters p = { 0 };
|
||||
switch (i) {
|
||||
case MIGRATION_PARAMETER_COMPRESS_LEVEL:
|
||||
p.has_compress_level = true;
|
||||
use_int_value = true;
|
||||
p->has_compress_level = true;
|
||||
visit_type_int(v, param, &p->compress_level, &err);
|
||||
break;
|
||||
case MIGRATION_PARAMETER_COMPRESS_THREADS:
|
||||
p.has_compress_threads = true;
|
||||
use_int_value = true;
|
||||
p->has_compress_threads = true;
|
||||
visit_type_int(v, param, &p->compress_threads, &err);
|
||||
break;
|
||||
case MIGRATION_PARAMETER_DECOMPRESS_THREADS:
|
||||
p.has_decompress_threads = true;
|
||||
use_int_value = true;
|
||||
p->has_decompress_threads = true;
|
||||
visit_type_int(v, param, &p->decompress_threads, &err);
|
||||
break;
|
||||
case MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL:
|
||||
p.has_cpu_throttle_initial = true;
|
||||
use_int_value = true;
|
||||
p->has_cpu_throttle_initial = true;
|
||||
visit_type_int(v, param, &p->cpu_throttle_initial, &err);
|
||||
break;
|
||||
case MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT:
|
||||
p.has_cpu_throttle_increment = true;
|
||||
use_int_value = true;
|
||||
p->has_cpu_throttle_increment = true;
|
||||
visit_type_int(v, param, &p->cpu_throttle_increment, &err);
|
||||
break;
|
||||
case MIGRATION_PARAMETER_TLS_CREDS:
|
||||
p.has_tls_creds = true;
|
||||
p.tls_creds = (char *) valuestr;
|
||||
p->has_tls_creds = true;
|
||||
p->tls_creds = g_new0(StrOrNull, 1);
|
||||
p->tls_creds->type = QTYPE_QSTRING;
|
||||
visit_type_str(v, param, &p->tls_creds->u.s, &err);
|
||||
break;
|
||||
case MIGRATION_PARAMETER_TLS_HOSTNAME:
|
||||
p.has_tls_hostname = true;
|
||||
p.tls_hostname = (char *) valuestr;
|
||||
p->has_tls_hostname = true;
|
||||
p->tls_hostname = g_new0(StrOrNull, 1);
|
||||
p->tls_hostname->type = QTYPE_QSTRING;
|
||||
visit_type_str(v, param, &p->tls_hostname->u.s, &err);
|
||||
break;
|
||||
case MIGRATION_PARAMETER_MAX_BANDWIDTH:
|
||||
p.has_max_bandwidth = true;
|
||||
p->has_max_bandwidth = true;
|
||||
/*
|
||||
* Can't use visit_type_size() here, because it
|
||||
* defaults to Bytes rather than Mebibytes.
|
||||
*/
|
||||
ret = qemu_strtosz_MiB(valuestr, NULL, &valuebw);
|
||||
if (ret < 0 || valuebw > INT64_MAX
|
||||
|| (size_t)valuebw != valuebw) {
|
||||
error_setg(&err, "Invalid size %s", valuestr);
|
||||
goto cleanup;
|
||||
break;
|
||||
}
|
||||
p.max_bandwidth = valuebw;
|
||||
p->max_bandwidth = valuebw;
|
||||
break;
|
||||
case MIGRATION_PARAMETER_DOWNTIME_LIMIT:
|
||||
p.has_downtime_limit = true;
|
||||
use_int_value = true;
|
||||
p->has_downtime_limit = true;
|
||||
visit_type_int(v, param, &p->downtime_limit, &err);
|
||||
break;
|
||||
case MIGRATION_PARAMETER_X_CHECKPOINT_DELAY:
|
||||
p.has_x_checkpoint_delay = true;
|
||||
use_int_value = true;
|
||||
p->has_x_checkpoint_delay = true;
|
||||
visit_type_int(v, param, &p->x_checkpoint_delay, &err);
|
||||
break;
|
||||
case MIGRATION_PARAMETER_BLOCK_INCREMENTAL:
|
||||
p.has_block_incremental = true;
|
||||
visit_type_bool(v, param, &valuebool, &err);
|
||||
if (err) {
|
||||
goto cleanup;
|
||||
}
|
||||
p.block_incremental = valuebool;
|
||||
p->has_block_incremental = true;
|
||||
visit_type_bool(v, param, &p->block_incremental, &err);
|
||||
break;
|
||||
}
|
||||
|
||||
if (use_int_value) {
|
||||
visit_type_int(v, param, &valueint, &err);
|
||||
if (err) {
|
||||
goto cleanup;
|
||||
}
|
||||
/* Set all integers; only one has_FOO will be set, and
|
||||
* the code ignores the remaining values */
|
||||
p.compress_level = valueint;
|
||||
p.compress_threads = valueint;
|
||||
p.decompress_threads = valueint;
|
||||
p.cpu_throttle_initial = valueint;
|
||||
p.cpu_throttle_increment = valueint;
|
||||
p.downtime_limit = valueint;
|
||||
p.x_checkpoint_delay = valueint;
|
||||
if (err) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
qmp_migrate_set_parameters(&p, &err);
|
||||
qmp_migrate_set_parameters(p, &err);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1647,6 +1638,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
|
||||
}
|
||||
|
||||
cleanup:
|
||||
qapi_free_MigrateSetParameters(p);
|
||||
visit_free(v);
|
||||
if (err) {
|
||||
error_report_err(err);
|
||||
|
||||
+3
-1
@@ -297,12 +297,14 @@ static void prop_get_fdt(Object *obj, Visitor *v, const char *name,
|
||||
void *opaque, Error **errp)
|
||||
{
|
||||
sPAPRDRConnector *drc = SPAPR_DR_CONNECTOR(obj);
|
||||
QNull *null = NULL;
|
||||
Error *err = NULL;
|
||||
int fdt_offset_next, fdt_offset, fdt_depth;
|
||||
void *fdt;
|
||||
|
||||
if (!drc->fdt) {
|
||||
visit_type_null(v, NULL, errp);
|
||||
visit_type_null(v, NULL, &null, errp);
|
||||
QDECREF(null);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,11 +93,15 @@ static inline QType qobject_type(const QObject *obj)
|
||||
return obj->type;
|
||||
}
|
||||
|
||||
extern QObject qnull_;
|
||||
struct QNull {
|
||||
QObject base;
|
||||
};
|
||||
|
||||
static inline QObject *qnull(void)
|
||||
extern QNull qnull_;
|
||||
|
||||
static inline QNull *qnull(void)
|
||||
{
|
||||
qobject_incref(&qnull_);
|
||||
QINCREF(&qnull_);
|
||||
return &qnull_;
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,8 @@ struct Visitor
|
||||
Error **errp);
|
||||
|
||||
/* Must be set to visit explicit null values. */
|
||||
void (*type_null)(Visitor *v, const char *name, Error **errp);
|
||||
void (*type_null)(Visitor *v, const char *name, QNull **obj,
|
||||
Error **errp);
|
||||
|
||||
/* Must be set for input visitors to visit structs, optional otherwise.
|
||||
The core takes care of the return type in the public interface. */
|
||||
|
||||
@@ -618,10 +618,10 @@ void visit_type_any(Visitor *v, const char *name, QObject **obj, Error **errp);
|
||||
* @name expresses the relationship of the null value to its parent
|
||||
* container; see the general description of @name above.
|
||||
*
|
||||
* Unlike all other visit_type_* functions, no obj parameter is
|
||||
* needed; rather, this is a witness that an explicit null value is
|
||||
* expected rather than any other type.
|
||||
* @obj must be non-NULL. Input visitors set *@obj to the value;
|
||||
* other visitors ignore *@obj.
|
||||
*/
|
||||
void visit_type_null(Visitor *v, const char *name, Error **errp);
|
||||
void visit_type_null(Visitor *v, const char *name, QNull **obj,
|
||||
Error **errp);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -89,6 +89,7 @@ typedef struct QEMUSGList QEMUSGList;
|
||||
typedef struct QEMUTimer QEMUTimer;
|
||||
typedef struct QEMUTimerListGroup QEMUTimerListGroup;
|
||||
typedef struct QObject QObject;
|
||||
typedef struct QNull QNull;
|
||||
typedef struct RAMBlock RAMBlock;
|
||||
typedef struct Range Range;
|
||||
typedef struct SerialState SerialState;
|
||||
|
||||
+87
-9
@@ -433,6 +433,7 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp)
|
||||
MigrationParameters *params;
|
||||
MigrationState *s = migrate_get_current();
|
||||
|
||||
/* TODO use QAPI_CLONE() instead of duplicating it inline */
|
||||
params = g_malloc0(sizeof(*params));
|
||||
params->has_compress_level = true;
|
||||
params->compress_level = s->parameters.compress_level;
|
||||
@@ -444,9 +445,9 @@ MigrationParameters *qmp_query_migrate_parameters(Error **errp)
|
||||
params->cpu_throttle_initial = s->parameters.cpu_throttle_initial;
|
||||
params->has_cpu_throttle_increment = true;
|
||||
params->cpu_throttle_increment = s->parameters.cpu_throttle_increment;
|
||||
params->has_tls_creds = !!s->parameters.tls_creds;
|
||||
params->has_tls_creds = true;
|
||||
params->tls_creds = g_strdup(s->parameters.tls_creds);
|
||||
params->has_tls_hostname = !!s->parameters.tls_hostname;
|
||||
params->has_tls_hostname = true;
|
||||
params->tls_hostname = g_strdup(s->parameters.tls_hostname);
|
||||
params->has_max_bandwidth = true;
|
||||
params->max_bandwidth = s->parameters.max_bandwidth;
|
||||
@@ -741,10 +742,66 @@ static bool migrate_params_check(MigrationParameters *params, Error **errp)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void migrate_params_apply(MigrationParameters *params)
|
||||
static void migrate_params_test_apply(MigrateSetParameters *params,
|
||||
MigrationParameters *dest)
|
||||
{
|
||||
*dest = migrate_get_current()->parameters;
|
||||
|
||||
/* TODO use QAPI_CLONE() instead of duplicating it inline */
|
||||
|
||||
if (params->has_compress_level) {
|
||||
dest->compress_level = params->compress_level;
|
||||
}
|
||||
|
||||
if (params->has_compress_threads) {
|
||||
dest->compress_threads = params->compress_threads;
|
||||
}
|
||||
|
||||
if (params->has_decompress_threads) {
|
||||
dest->decompress_threads = params->decompress_threads;
|
||||
}
|
||||
|
||||
if (params->has_cpu_throttle_initial) {
|
||||
dest->cpu_throttle_initial = params->cpu_throttle_initial;
|
||||
}
|
||||
|
||||
if (params->has_cpu_throttle_increment) {
|
||||
dest->cpu_throttle_increment = params->cpu_throttle_increment;
|
||||
}
|
||||
|
||||
if (params->has_tls_creds) {
|
||||
assert(params->tls_creds->type == QTYPE_QSTRING);
|
||||
dest->tls_creds = g_strdup(params->tls_creds->u.s);
|
||||
}
|
||||
|
||||
if (params->has_tls_hostname) {
|
||||
assert(params->tls_hostname->type == QTYPE_QSTRING);
|
||||
dest->tls_hostname = g_strdup(params->tls_hostname->u.s);
|
||||
}
|
||||
|
||||
if (params->has_max_bandwidth) {
|
||||
dest->max_bandwidth = params->max_bandwidth;
|
||||
}
|
||||
|
||||
if (params->has_downtime_limit) {
|
||||
dest->downtime_limit = params->downtime_limit;
|
||||
}
|
||||
|
||||
if (params->has_x_checkpoint_delay) {
|
||||
dest->x_checkpoint_delay = params->x_checkpoint_delay;
|
||||
}
|
||||
|
||||
if (params->has_block_incremental) {
|
||||
dest->block_incremental = params->block_incremental;
|
||||
}
|
||||
}
|
||||
|
||||
static void migrate_params_apply(MigrateSetParameters *params)
|
||||
{
|
||||
MigrationState *s = migrate_get_current();
|
||||
|
||||
/* TODO use QAPI_CLONE() instead of duplicating it inline */
|
||||
|
||||
if (params->has_compress_level) {
|
||||
s->parameters.compress_level = params->compress_level;
|
||||
}
|
||||
@@ -767,12 +824,14 @@ static void migrate_params_apply(MigrationParameters *params)
|
||||
|
||||
if (params->has_tls_creds) {
|
||||
g_free(s->parameters.tls_creds);
|
||||
s->parameters.tls_creds = g_strdup(params->tls_creds);
|
||||
assert(params->tls_creds->type == QTYPE_QSTRING);
|
||||
s->parameters.tls_creds = g_strdup(params->tls_creds->u.s);
|
||||
}
|
||||
|
||||
if (params->has_tls_hostname) {
|
||||
g_free(s->parameters.tls_hostname);
|
||||
s->parameters.tls_hostname = g_strdup(params->tls_hostname);
|
||||
assert(params->tls_hostname->type == QTYPE_QSTRING);
|
||||
s->parameters.tls_hostname = g_strdup(params->tls_hostname->u.s);
|
||||
}
|
||||
|
||||
if (params->has_max_bandwidth) {
|
||||
@@ -799,9 +858,28 @@ static void migrate_params_apply(MigrationParameters *params)
|
||||
}
|
||||
}
|
||||
|
||||
void qmp_migrate_set_parameters(MigrationParameters *params, Error **errp)
|
||||
void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp)
|
||||
{
|
||||
if (!migrate_params_check(params, errp)) {
|
||||
MigrationParameters tmp;
|
||||
|
||||
/* TODO Rewrite "" to null instead */
|
||||
if (params->has_tls_creds
|
||||
&& params->tls_creds->type == QTYPE_QNULL) {
|
||||
QDECREF(params->tls_creds->u.n);
|
||||
params->tls_creds->type = QTYPE_QSTRING;
|
||||
params->tls_creds->u.s = strdup("");
|
||||
}
|
||||
/* TODO Rewrite "" to null instead */
|
||||
if (params->has_tls_hostname
|
||||
&& params->tls_hostname->type == QTYPE_QNULL) {
|
||||
QDECREF(params->tls_hostname->u.n);
|
||||
params->tls_hostname->type = QTYPE_QSTRING;
|
||||
params->tls_hostname->u.s = strdup("");
|
||||
}
|
||||
|
||||
migrate_params_test_apply(params, &tmp);
|
||||
|
||||
if (!migrate_params_check(&tmp, errp)) {
|
||||
/* Invalid parameter */
|
||||
return;
|
||||
}
|
||||
@@ -1237,7 +1315,7 @@ int64_t qmp_query_migrate_cache_size(Error **errp)
|
||||
|
||||
void qmp_migrate_set_speed(int64_t value, Error **errp)
|
||||
{
|
||||
MigrationParameters p = {
|
||||
MigrateSetParameters p = {
|
||||
.has_max_bandwidth = true,
|
||||
.max_bandwidth = value,
|
||||
};
|
||||
@@ -1257,7 +1335,7 @@ void qmp_migrate_set_downtime(double value, Error **errp)
|
||||
value *= 1000; /* Convert to milliseconds */
|
||||
value = MAX(0, MIN(INT64_MAX, value));
|
||||
|
||||
MigrationParameters p = {
|
||||
MigrateSetParameters p = {
|
||||
.has_downtime_limit = true,
|
||||
.downtime_limit = value,
|
||||
};
|
||||
|
||||
+96
-12
@@ -115,6 +115,22 @@
|
||||
##
|
||||
{ 'command': 'qmp_capabilities' }
|
||||
|
||||
##
|
||||
# @StrOrNull:
|
||||
#
|
||||
# This is a string value or the explicit lack of a string (null
|
||||
# pointer in C). Intended for cases when 'optional absent' already
|
||||
# has a different meaning.
|
||||
#
|
||||
# @s: the string value
|
||||
# @n: no string value
|
||||
#
|
||||
# Since: 2.10
|
||||
##
|
||||
{ 'alternate': 'StrOrNull',
|
||||
'data': { 's': 'str',
|
||||
'n': 'null' } }
|
||||
|
||||
##
|
||||
# @LostTickPolicy:
|
||||
#
|
||||
@@ -1034,6 +1050,77 @@
|
||||
'tls-creds', 'tls-hostname', 'max-bandwidth',
|
||||
'downtime-limit', 'x-checkpoint-delay', 'block-incremental' ] }
|
||||
|
||||
##
|
||||
# @MigrateSetParameters:
|
||||
#
|
||||
# @compress-level: compression level
|
||||
#
|
||||
# @compress-threads: compression thread count
|
||||
#
|
||||
# @decompress-threads: decompression thread count
|
||||
#
|
||||
# @cpu-throttle-initial: Initial percentage of time guest cpus are
|
||||
# throttled when migration auto-converge is activated.
|
||||
# The default value is 20. (Since 2.7)
|
||||
#
|
||||
# @cpu-throttle-increment: throttle percentage increase each time
|
||||
# auto-converge detects that migration is not making
|
||||
# progress. The default value is 10. (Since 2.7)
|
||||
#
|
||||
# @tls-creds: ID of the 'tls-creds' object that provides credentials
|
||||
# for establishing a TLS connection over the migration data
|
||||
# channel. On the outgoing side of the migration, the credentials
|
||||
# must be for a 'client' endpoint, while for the incoming side the
|
||||
# credentials must be for a 'server' endpoint. Setting this
|
||||
# to a non-empty string enables TLS for all migrations.
|
||||
# An empty string means that QEMU will use plain text mode for
|
||||
# migration, rather than TLS (Since 2.9)
|
||||
# Previously (since 2.7), this was reported by omitting
|
||||
# tls-creds instead.
|
||||
#
|
||||
# @tls-hostname: hostname of the target host for the migration. This
|
||||
# is required when using x509 based TLS credentials and the
|
||||
# migration URI does not already include a hostname. For
|
||||
# example if using fd: or exec: based migration, the
|
||||
# hostname must be provided so that the server's x509
|
||||
# certificate identity can be validated. (Since 2.7)
|
||||
# An empty string means that QEMU will use the hostname
|
||||
# associated with the migration URI, if any. (Since 2.9)
|
||||
# Previously (since 2.7), this was reported by omitting
|
||||
# tls-hostname instead.
|
||||
#
|
||||
# @max-bandwidth: to set maximum speed for migration. maximum speed in
|
||||
# bytes per second. (Since 2.8)
|
||||
#
|
||||
# @downtime-limit: set maximum tolerated downtime for migration. maximum
|
||||
# downtime in milliseconds (Since 2.8)
|
||||
#
|
||||
# @x-checkpoint-delay: the delay time between two COLO checkpoints. (Since 2.8)
|
||||
#
|
||||
# @block-incremental: Affects how much storage is migrated when the
|
||||
# block migration capability is enabled. When false, the entire
|
||||
# storage backing chain is migrated into a flattened image at
|
||||
# the destination; when true, only the active qcow2 layer is
|
||||
# migrated and the destination must already have access to the
|
||||
# same backing chain as was used on the source. (since 2.10)
|
||||
#
|
||||
# Since: 2.4
|
||||
##
|
||||
# TODO either fuse back into MigrationParameters, or make
|
||||
# MigrationParameters members mandatory
|
||||
{ 'struct': 'MigrateSetParameters',
|
||||
'data': { '*compress-level': 'int',
|
||||
'*compress-threads': 'int',
|
||||
'*decompress-threads': 'int',
|
||||
'*cpu-throttle-initial': 'int',
|
||||
'*cpu-throttle-increment': 'int',
|
||||
'*tls-creds': 'StrOrNull',
|
||||
'*tls-hostname': 'StrOrNull',
|
||||
'*max-bandwidth': 'int',
|
||||
'*downtime-limit': 'int',
|
||||
'*x-checkpoint-delay': 'int',
|
||||
'*block-incremental': 'bool' } }
|
||||
|
||||
##
|
||||
# @migrate-set-parameters:
|
||||
#
|
||||
@@ -1048,15 +1135,12 @@
|
||||
#
|
||||
##
|
||||
{ 'command': 'migrate-set-parameters', 'boxed': true,
|
||||
'data': 'MigrationParameters' }
|
||||
'data': 'MigrateSetParameters' }
|
||||
|
||||
##
|
||||
# @MigrationParameters:
|
||||
#
|
||||
# Optional members can be omitted on input ('migrate-set-parameters')
|
||||
# but most members will always be present on output
|
||||
# ('query-migrate-parameters'), with the exception of tls-creds and
|
||||
# tls-hostname.
|
||||
# The optional members aren't actually optional.
|
||||
#
|
||||
# @compress-level: compression level
|
||||
#
|
||||
@@ -1065,22 +1149,21 @@
|
||||
# @decompress-threads: decompression thread count
|
||||
#
|
||||
# @cpu-throttle-initial: Initial percentage of time guest cpus are
|
||||
# throttledwhen migration auto-converge is activated.
|
||||
# The default value is 20. (Since 2.7)
|
||||
# throttled when migration auto-converge is activated.
|
||||
# (Since 2.7)
|
||||
#
|
||||
# @cpu-throttle-increment: throttle percentage increase each time
|
||||
# auto-converge detects that migration is not making
|
||||
# progress. The default value is 10. (Since 2.7)
|
||||
# progress. (Since 2.7)
|
||||
#
|
||||
# @tls-creds: ID of the 'tls-creds' object that provides credentials
|
||||
# for establishing a TLS connection over the migration data
|
||||
# channel. On the outgoing side of the migration, the credentials
|
||||
# must be for a 'client' endpoint, while for the incoming side the
|
||||
# credentials must be for a 'server' endpoint. Setting this
|
||||
# will enable TLS for all migrations. The default is unset,
|
||||
# resulting in unsecured migration at the QEMU level. (Since 2.7)
|
||||
# credentials must be for a 'server' endpoint.
|
||||
# An empty string means that QEMU will use plain text mode for
|
||||
# migration, rather than TLS (Since 2.9)
|
||||
# migration, rather than TLS (Since 2.7)
|
||||
# Note: 2.8 reports this by omitting tls-creds instead.
|
||||
#
|
||||
# @tls-hostname: hostname of the target host for the migration. This
|
||||
# is required when using x509 based TLS credentials and the
|
||||
@@ -1090,6 +1173,7 @@
|
||||
# certificate identity can be validated. (Since 2.7)
|
||||
# An empty string means that QEMU will use the hostname
|
||||
# associated with the migration URI, if any. (Since 2.9)
|
||||
# Note: 2.8 reports this by omitting tls-hostname instead.
|
||||
#
|
||||
# @max-bandwidth: to set maximum speed for migration. maximum speed in
|
||||
# bytes per second. (Since 2.8)
|
||||
|
||||
+22
-7
@@ -2273,15 +2273,14 @@
|
||||
# besides their data source and an optional backing file.
|
||||
#
|
||||
# @backing: reference to or definition of the backing file block
|
||||
# device (if missing, taken from the image file content). It is
|
||||
# allowed to pass an empty string here in order to disable the
|
||||
# default backing file.
|
||||
# device, null disables the backing file entirely.
|
||||
# Defaults to the backing file stored the image file.
|
||||
#
|
||||
# Since: 2.9
|
||||
##
|
||||
{ 'struct': 'BlockdevOptionsGenericCOWFormat',
|
||||
'base': 'BlockdevOptionsGenericFormat',
|
||||
'data': { '*backing': 'BlockdevRef' } }
|
||||
'data': { '*backing': 'BlockdevRefOrNull' } }
|
||||
|
||||
##
|
||||
# @Qcow2OverlapCheckMode:
|
||||
@@ -3120,9 +3119,7 @@
|
||||
# Reference to a block device.
|
||||
#
|
||||
# @definition: defines a new block device inline
|
||||
# @reference: references the ID of an existing block device. An
|
||||
# empty string means that no block device should be
|
||||
# referenced.
|
||||
# @reference: references the ID of an existing block device
|
||||
#
|
||||
# Since: 2.9
|
||||
##
|
||||
@@ -3130,6 +3127,24 @@
|
||||
'data': { 'definition': 'BlockdevOptions',
|
||||
'reference': 'str' } }
|
||||
|
||||
##
|
||||
# @BlockdevRefOrNull:
|
||||
#
|
||||
# Reference to a block device.
|
||||
#
|
||||
# @definition: defines a new block device inline
|
||||
# @reference: references the ID of an existing block device.
|
||||
# An empty string means that no block device should
|
||||
# be referenced. Deprecated; use null instead.
|
||||
# @null: No block device should be referenced (since 2.10)
|
||||
#
|
||||
# Since: 2.9
|
||||
##
|
||||
{ 'alternate': 'BlockdevRefOrNull',
|
||||
'data': { 'definition': 'BlockdevOptions',
|
||||
'reference': 'str',
|
||||
'null': 'null' } }
|
||||
|
||||
##
|
||||
# @blockdev-add:
|
||||
#
|
||||
|
||||
@@ -127,12 +127,13 @@ static void qapi_clone_type_number(Visitor *v, const char *name, double *obj,
|
||||
/* Value was already cloned by g_memdup() */
|
||||
}
|
||||
|
||||
static void qapi_clone_type_null(Visitor *v, const char *name, Error **errp)
|
||||
static void qapi_clone_type_null(Visitor *v, const char *name, QNull **obj,
|
||||
Error **errp)
|
||||
{
|
||||
QapiCloneVisitor *qcv = to_qcv(v);
|
||||
|
||||
assert(qcv->depth);
|
||||
/* Nothing to do */
|
||||
*obj = qnull();
|
||||
}
|
||||
|
||||
static void qapi_clone_free(Visitor *v)
|
||||
|
||||
@@ -103,8 +103,12 @@ static void qapi_dealloc_type_anything(Visitor *v, const char *name,
|
||||
}
|
||||
}
|
||||
|
||||
static void qapi_dealloc_type_null(Visitor *v, const char *name, Error **errp)
|
||||
static void qapi_dealloc_type_null(Visitor *v, const char *name,
|
||||
QNull **obj, Error **errp)
|
||||
{
|
||||
if (obj) {
|
||||
QDECREF(*obj);
|
||||
}
|
||||
}
|
||||
|
||||
static void qapi_dealloc_free(Visitor *v)
|
||||
|
||||
@@ -325,10 +325,11 @@ void visit_type_any(Visitor *v, const char *name, QObject **obj, Error **errp)
|
||||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_null(Visitor *v, const char *name, Error **errp)
|
||||
void visit_type_null(Visitor *v, const char *name, QNull **obj,
|
||||
Error **errp)
|
||||
{
|
||||
trace_visit_type_null(v, name);
|
||||
v->type_null(v, name, errp);
|
||||
trace_visit_type_null(v, name, obj);
|
||||
v->type_null(v, name, obj, errp);
|
||||
}
|
||||
|
||||
static void output_type_enum(Visitor *v, const char *name, int *obj,
|
||||
|
||||
@@ -587,11 +587,13 @@ static void qobject_input_type_any(Visitor *v, const char *name, QObject **obj,
|
||||
*obj = qobj;
|
||||
}
|
||||
|
||||
static void qobject_input_type_null(Visitor *v, const char *name, Error **errp)
|
||||
static void qobject_input_type_null(Visitor *v, const char *name,
|
||||
QNull **obj, Error **errp)
|
||||
{
|
||||
QObjectInputVisitor *qiv = to_qiv(v);
|
||||
QObject *qobj = qobject_input_get_object(qiv, name, true, errp);
|
||||
|
||||
*obj = NULL;
|
||||
if (!qobj) {
|
||||
return;
|
||||
}
|
||||
@@ -599,7 +601,9 @@ static void qobject_input_type_null(Visitor *v, const char *name, Error **errp)
|
||||
if (qobject_type(qobj) != QTYPE_QNULL) {
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE,
|
||||
full_name(qiv, name), "null");
|
||||
return;
|
||||
}
|
||||
*obj = qnull();
|
||||
}
|
||||
|
||||
static void qobject_input_type_size_keyval(Visitor *v, const char *name,
|
||||
|
||||
@@ -187,10 +187,11 @@ static void qobject_output_type_any(Visitor *v, const char *name,
|
||||
qobject_output_add_obj(qov, name, *obj);
|
||||
}
|
||||
|
||||
static void qobject_output_type_null(Visitor *v, const char *name, Error **errp)
|
||||
static void qobject_output_type_null(Visitor *v, const char *name,
|
||||
QNull **obj, Error **errp)
|
||||
{
|
||||
QObjectOutputVisitor *qov = to_qov(v);
|
||||
qobject_output_add_obj(qov, name, qnull());
|
||||
qobject_output_add(qov, name, qnull());
|
||||
}
|
||||
|
||||
/* Finish building, and return the root object.
|
||||
|
||||
@@ -326,14 +326,20 @@ static void parse_type_number(Visitor *v, const char *name, double *obj,
|
||||
*obj = val;
|
||||
}
|
||||
|
||||
static void parse_type_null(Visitor *v, const char *name, Error **errp)
|
||||
static void parse_type_null(Visitor *v, const char *name, QNull **obj,
|
||||
Error **errp)
|
||||
{
|
||||
StringInputVisitor *siv = to_siv(v);
|
||||
|
||||
*obj = NULL;
|
||||
|
||||
if (!siv->string || siv->string[0]) {
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
"null");
|
||||
return;
|
||||
}
|
||||
|
||||
*obj = qnull();
|
||||
}
|
||||
|
||||
static void string_input_free(Visitor *v)
|
||||
|
||||
@@ -256,7 +256,8 @@ static void print_type_number(Visitor *v, const char *name, double *obj,
|
||||
string_output_set(sov, g_strdup_printf("%f", *obj));
|
||||
}
|
||||
|
||||
static void print_type_null(Visitor *v, const char *name, Error **errp)
|
||||
static void print_type_null(Visitor *v, const char *name, QNull **obj,
|
||||
Error **errp)
|
||||
{
|
||||
StringOutputVisitor *sov = to_sov(v);
|
||||
char *out;
|
||||
|
||||
+1
-1
@@ -31,4 +31,4 @@ visit_type_bool(void *v, const char *name, bool *obj) "v=%p name=%s obj=%p"
|
||||
visit_type_str(void *v, const char *name, char **obj) "v=%p name=%s obj=%p"
|
||||
visit_type_number(void *v, const char *name, double *obj) "v=%p name=%s obj=%p"
|
||||
visit_type_any(void *v, const char *name, void *obj) "v=%p name=%s obj=%p"
|
||||
visit_type_null(void *v, const char *name) "v=%p name=%s"
|
||||
visit_type_null(void *v, const char *name, void *obj) "v=%p name=%s obj=%p"
|
||||
|
||||
@@ -445,7 +445,7 @@ static QObject *parse_keyword(JSONParserContext *ctxt)
|
||||
} else if (!strcmp(token->str, "false")) {
|
||||
return QOBJECT(qbool_from_bool(false));
|
||||
} else if (!strcmp(token->str, "null")) {
|
||||
return qnull();
|
||||
return QOBJECT(qnull());
|
||||
}
|
||||
parse_error(ctxt, token, "invalid keyword '%s'", token->str);
|
||||
return NULL;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user