diff options
author | Orit Wasserman <owasserm@redhat.com> | 2012-08-06 21:42:48 +0300 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2012-08-08 13:51:11 +0200 |
commit | 00458433242dbfb6348d8e0bb6d356603d3e0067 (patch) | |
tree | 445d97d2195dfa0658dd41d5e03d9bfa33ce54fb /hmp.c | |
parent | bbf6da32b5bd32018069e4eaeda59a02855903f2 (diff) | |
download | qemu-00458433242dbfb6348d8e0bb6d356603d3e0067.zip qemu-00458433242dbfb6348d8e0bb6d356603d3e0067.tar.gz qemu-00458433242dbfb6348d8e0bb6d356603d3e0067.tar.bz2 |
Add migrate-set-capabilities
The management can enable/disable a capability for the next migration by using
migrate-set-capabilities QMP command.
The user can use migrate_set_capability HMP command.
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 'hmp.c')
-rw-r--r-- | hmp.c | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -770,6 +770,38 @@ void hmp_migrate_set_speed(Monitor *mon, const QDict *qdict) qmp_migrate_set_speed(value, NULL); } +void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict) +{ + const char *cap = qdict_get_str(qdict, "capability"); + bool state = qdict_get_bool(qdict, "state"); + Error *err = NULL; + MigrationCapabilityStatusList *caps = g_malloc0(sizeof(*caps)); + int i; + + for (i = 0; i < MIGRATION_CAPABILITY_MAX; i++) { + if (strcmp(cap, MigrationCapability_lookup[i]) == 0) { + caps->value = g_malloc0(sizeof(*caps->value)); + caps->value->capability = i; + caps->value->state = state; + caps->next = NULL; + qmp_migrate_set_capabilities(caps, &err); + break; + } + } + + if (i == MIGRATION_CAPABILITY_MAX) { + error_set(&err, QERR_INVALID_PARAMETER, cap); + } + + qapi_free_MigrationCapabilityStatusList(caps); + + if (err) { + monitor_printf(mon, "migrate_set_parameter: %s\n", + error_get_pretty(err)); + error_free(err); + } +} + void hmp_set_password(Monitor *mon, const QDict *qdict) { const char *protocol = qdict_get_str(qdict, "protocol"); |