diff options
author | Peter Xu <peterx@redhat.com> | 2017-07-18 11:39:09 +0800 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2017-07-18 17:36:26 +0200 |
commit | 4e4a3d3aa691aee305f07abaf7f0a125baa585c6 (patch) | |
tree | 8c69533aa036d9f05d9021dab60cf4b2d10ede4f /migration | |
parent | 4a84214ebe1695405f58e5c6272d63d6084edfa5 (diff) |
migration: provide migrate_cap_add()
Abstracted from migrate_set_block_enabled() to allocate
MigrationCapabilityStatusList properly.
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <1500349150-13240-10-git-send-email-peterx@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r-- | migration/migration.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/migration/migration.c b/migration/migration.c index 74099b361f..0ebdde18ed 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -842,14 +842,27 @@ void migrate_set_state(int *state, int old_state, int new_state) } } -void migrate_set_block_enabled(bool value, Error **errp) +static MigrationCapabilityStatusList *migrate_cap_add( + MigrationCapabilityStatusList *list, + MigrationCapability index, + bool state) { MigrationCapabilityStatusList *cap; cap = g_new0(MigrationCapabilityStatusList, 1); cap->value = g_new0(MigrationCapabilityStatus, 1); - cap->value->capability = MIGRATION_CAPABILITY_BLOCK; - cap->value->state = value; + cap->value->capability = index; + cap->value->state = state; + cap->next = list; + + return cap; +} + +void migrate_set_block_enabled(bool value, Error **errp) +{ + MigrationCapabilityStatusList *cap; + + cap = migrate_cap_add(NULL, MIGRATION_CAPABILITY_BLOCK, value); qmp_migrate_set_capabilities(cap, errp); qapi_free_MigrationCapabilityStatusList(cap); } |