Add migration capabilities
The management can query the current migration capabilities using query-migrate-capabilities QMP command. The user can use 'info migrate_capabilities' HMP command. Currently only XBZRLE capability is available. Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
c03b0aa0ca
commit
bbf6da32b5
@ -1417,6 +1417,8 @@ show CPU statistics
|
||||
show user network stack connection states
|
||||
@item info migrate
|
||||
show migration status
|
||||
@item info migrate_capabilities
|
||||
show current migration capabilities
|
||||
@item info balloon
|
||||
show balloon information
|
||||
@item info qtree
|
||||
|
33
hmp.c
33
hmp.c
@ -131,8 +131,21 @@ void hmp_info_mice(Monitor *mon)
|
||||
void hmp_info_migrate(Monitor *mon)
|
||||
{
|
||||
MigrationInfo *info;
|
||||
MigrationCapabilityStatusList *caps, *cap;
|
||||
|
||||
info = qmp_query_migrate(NULL);
|
||||
caps = qmp_query_migrate_capabilities(NULL);
|
||||
|
||||
/* do not display parameters during setup */
|
||||
if (info->has_status && caps) {
|
||||
monitor_printf(mon, "capabilities: ");
|
||||
for (cap = caps; cap; cap = cap->next) {
|
||||
monitor_printf(mon, "%s: %s ",
|
||||
MigrationCapability_lookup[cap->value->capability],
|
||||
cap->value->state ? "on" : "off");
|
||||
}
|
||||
monitor_printf(mon, "\n");
|
||||
}
|
||||
|
||||
if (info->has_status) {
|
||||
monitor_printf(mon, "Migration status: %s\n", info->status);
|
||||
@ -159,6 +172,26 @@ void hmp_info_migrate(Monitor *mon)
|
||||
}
|
||||
|
||||
qapi_free_MigrationInfo(info);
|
||||
qapi_free_MigrationCapabilityStatusList(caps);
|
||||
}
|
||||
|
||||
void hmp_info_migrate_capabilities(Monitor *mon)
|
||||
{
|
||||
MigrationCapabilityStatusList *caps, *cap;
|
||||
|
||||
caps = qmp_query_migrate_capabilities(NULL);
|
||||
|
||||
if (caps) {
|
||||
monitor_printf(mon, "capabilities: ");
|
||||
for (cap = caps; cap; cap = cap->next) {
|
||||
monitor_printf(mon, "%s: %s ",
|
||||
MigrationCapability_lookup[cap->value->capability],
|
||||
cap->value->state ? "on" : "off");
|
||||
}
|
||||
monitor_printf(mon, "\n");
|
||||
}
|
||||
|
||||
qapi_free_MigrationCapabilityStatusList(caps);
|
||||
}
|
||||
|
||||
void hmp_info_cpus(Monitor *mon)
|
||||
|
1
hmp.h
1
hmp.h
@ -25,6 +25,7 @@ void hmp_info_uuid(Monitor *mon);
|
||||
void hmp_info_chardev(Monitor *mon);
|
||||
void hmp_info_mice(Monitor *mon);
|
||||
void hmp_info_migrate(Monitor *mon);
|
||||
void hmp_info_migrate_capabilities(Monitor *mon);
|
||||
void hmp_info_cpus(Monitor *mon);
|
||||
void hmp_info_block(Monitor *mon);
|
||||
void hmp_info_blockstats(Monitor *mon);
|
||||
|
30
migration.c
30
migration.c
@ -113,6 +113,30 @@ uint64_t migrate_max_downtime(void)
|
||||
return max_downtime;
|
||||
}
|
||||
|
||||
MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp)
|
||||
{
|
||||
MigrationCapabilityStatusList *head = NULL;
|
||||
MigrationCapabilityStatusList *caps;
|
||||
MigrationState *s = migrate_get_current();
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MIGRATION_CAPABILITY_MAX; i++) {
|
||||
if (head == NULL) {
|
||||
head = g_malloc0(sizeof(*caps));
|
||||
caps = head;
|
||||
} else {
|
||||
caps->next = g_malloc0(sizeof(*caps));
|
||||
caps = caps->next;
|
||||
}
|
||||
caps->value =
|
||||
g_malloc(sizeof(*caps->value));
|
||||
caps->value->capability = i;
|
||||
caps->value->state = s->enabled_capabilities[i];
|
||||
}
|
||||
|
||||
return head;
|
||||
}
|
||||
|
||||
MigrationInfo *qmp_query_migrate(Error **errp)
|
||||
{
|
||||
MigrationInfo *info = g_malloc0(sizeof(*info));
|
||||
@ -375,10 +399,16 @@ static MigrationState *migrate_init(const MigrationParams *params)
|
||||
{
|
||||
MigrationState *s = migrate_get_current();
|
||||
int64_t bandwidth_limit = s->bandwidth_limit;
|
||||
bool enabled_capabilities[MIGRATION_CAPABILITY_MAX];
|
||||
|
||||
memcpy(enabled_capabilities, s->enabled_capabilities,
|
||||
sizeof(enabled_capabilities));
|
||||
|
||||
memset(s, 0, sizeof(*s));
|
||||
s->bandwidth_limit = bandwidth_limit;
|
||||
s->params = *params;
|
||||
memcpy(s->enabled_capabilities, enabled_capabilities,
|
||||
sizeof(enabled_capabilities));
|
||||
|
||||
s->bandwidth_limit = bandwidth_limit;
|
||||
s->state = MIG_STATE_SETUP;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "notify.h"
|
||||
#include "error.h"
|
||||
#include "vmstate.h"
|
||||
#include "qapi-types.h"
|
||||
|
||||
struct MigrationParams {
|
||||
bool blk;
|
||||
@ -39,6 +40,7 @@ struct MigrationState
|
||||
void *opaque;
|
||||
MigrationParams params;
|
||||
int64_t total_time;
|
||||
bool enabled_capabilities[MIGRATION_CAPABILITY_MAX];
|
||||
};
|
||||
|
||||
void process_incoming_migration(QEMUFile *f);
|
||||
|
@ -2654,6 +2654,13 @@ static mon_cmd_t info_cmds[] = {
|
||||
.help = "show migration status",
|
||||
.mhandler.info = hmp_info_migrate,
|
||||
},
|
||||
{
|
||||
.name = "migrate_capabilities",
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show current migration capabilities",
|
||||
.mhandler.info = hmp_info_migrate_capabilities,
|
||||
},
|
||||
{
|
||||
.name = "balloon",
|
||||
.args_type = "",
|
||||
|
@ -305,6 +305,45 @@
|
||||
##
|
||||
{ 'command': 'query-migrate', 'returns': 'MigrationInfo' }
|
||||
|
||||
##
|
||||
# @MigrationCapability
|
||||
#
|
||||
# Migration capabilities enumeration
|
||||
#
|
||||
# @xbzrle: Migration supports xbzrle (Xor Based Zero Run Length Encoding).
|
||||
# This feature allows us to minimize migration traffic for certain work
|
||||
# loads, by sending compressed difference of the pages
|
||||
#
|
||||
# Since: 1.2
|
||||
##
|
||||
{ 'enum': 'MigrationCapability',
|
||||
'data': ['xbzrle'] }
|
||||
|
||||
##
|
||||
# @MigrationCapabilityStatus
|
||||
#
|
||||
# Migration capability information
|
||||
#
|
||||
# @capability: capability enum
|
||||
#
|
||||
# @state: capability state bool
|
||||
#
|
||||
# Since: 1.2
|
||||
##
|
||||
{ 'type': 'MigrationCapabilityStatus',
|
||||
'data': { 'capability' : 'MigrationCapability', 'state' : 'bool' } }
|
||||
|
||||
##
|
||||
# @query-migrate-capabilities
|
||||
#
|
||||
# Returns information about the current migration capabilities status
|
||||
#
|
||||
# Returns: @MigrationCapabilitiesStatus
|
||||
#
|
||||
# Since: 1.2
|
||||
##
|
||||
{ 'command': 'query-migrate-capabilities', 'returns': ['MigrationCapabilityStatus']}
|
||||
|
||||
##
|
||||
# @MouseInfo:
|
||||
#
|
||||
|
@ -2142,6 +2142,32 @@ EQMP
|
||||
.mhandler.cmd_new = qmp_marshal_input_query_migrate,
|
||||
},
|
||||
|
||||
SQMP
|
||||
query-migrate-capabilities
|
||||
-------
|
||||
|
||||
Query current migration capabilities
|
||||
|
||||
- "capabilities": migration capabilities state
|
||||
- "xbzrle" : XBZRLE state (json-bool)
|
||||
|
||||
Arguments:
|
||||
|
||||
Example:
|
||||
|
||||
-> { "execute": "query-migrate-capabilities" }
|
||||
<- { "return": {
|
||||
"capabilities" : [ { "capability" : "xbzrle", "state" : false } ]
|
||||
}
|
||||
}
|
||||
EQMP
|
||||
|
||||
{
|
||||
.name = "query-migrate-capabilities",
|
||||
.args_type = "",
|
||||
.mhandler.cmd_new = qmp_marshal_input_query_migrate_capabilities,
|
||||
},
|
||||
|
||||
SQMP
|
||||
query-balloon
|
||||
-------------
|
||||
|
Loading…
Reference in New Issue
Block a user