aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2018-03-05 17:49:38 +0800
committerDr. David Alan Gilbert <dgilbert@redhat.com>2018-03-09 17:39:25 +0000
commitdd0ee30caeebbd25a80d8e985f3ee1b9343c05f1 (patch)
treed517a1410d485735cdab75af3875825b7bace8ee
parentef9c5160a18f4d0eee3cbd878fab766b22797269 (diff)
downloadqemu-dd0ee30caeebbd25a80d8e985f3ee1b9343c05f1.zip
qemu-dd0ee30caeebbd25a80d8e985f3ee1b9343c05f1.tar.gz
qemu-dd0ee30caeebbd25a80d8e985f3ee1b9343c05f1.tar.bz2
migration: fix applying wrong capabilities
When setting migration capabilities via QMP/HMP, we'll apply them even if the capability check failed. Fix it. Fixes: 4a84214ebe ("migration: provide migrate_caps_check()", 2017-07-18) Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20180305094938.31374-1-peterx@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
-rw-r--r--migration/migration.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/migration/migration.c b/migration/migration.c
index 62c243d..6a4780e 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -747,13 +747,15 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
{
MigrationState *s = migrate_get_current();
MigrationCapabilityStatusList *cap;
+ bool cap_list[MIGRATION_CAPABILITY__MAX];
if (migration_is_setup_or_active(s->state)) {
error_setg(errp, QERR_MIGRATION_ACTIVE);
return;
}
- if (!migrate_caps_check(s->enabled_capabilities, params, errp)) {
+ memcpy(cap_list, s->enabled_capabilities, sizeof(cap_list));
+ if (!migrate_caps_check(cap_list, params, errp)) {
return;
}