aboutsummaryrefslogtreecommitdiff
path: root/migration.c
diff options
context:
space:
mode:
authorOrit Wasserman <owasserm@redhat.com>2012-08-06 21:42:47 +0300
committerJuan Quintela <quintela@redhat.com>2012-08-08 13:51:11 +0200
commitbbf6da32b5bd32018069e4eaeda59a02855903f2 (patch)
tree3227c7b4aaf70e1284b20550f16237a493e72ee6 /migration.c
parentc03b0aa0ca93480e92dc356e58538df0835fe621 (diff)
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>
Diffstat (limited to 'migration.c')
-rw-r--r--migration.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/migration.c b/migration.c
index 8db1b433f0..fb620ac0f8 100644
--- a/migration.c
+++ b/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;