aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2023-03-01 23:18:02 +0100
committerJuan Quintela <quintela@redhat.com>2023-04-24 15:01:46 +0200
commit45c1de13f09b1fd4ea26f54e6da12aae52f34cb8 (patch)
tree99063b436f350d4783ec31d32fb18dadf756c814
parent4d0c6b695bf5252402ebf967f83baebfd2f4b91e (diff)
migration: Move qmp_migrate_set_capabilities() to options.c
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
-rw-r--r--migration/migration.c26
-rw-r--r--migration/options.c26
2 files changed, 26 insertions, 26 deletions
diff --git a/migration/migration.c b/migration/migration.c
index 0004c163a6..b198f4acf5 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1222,32 +1222,6 @@ MigrationInfo *qmp_query_migrate(Error **errp)
return info;
}
-void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
- Error **errp)
-{
- MigrationState *s = migrate_get_current();
- MigrationCapabilityStatusList *cap;
- bool new_caps[MIGRATION_CAPABILITY__MAX];
-
- if (migration_is_running(s->state)) {
- error_setg(errp, QERR_MIGRATION_ACTIVE);
- return;
- }
-
- memcpy(new_caps, s->capabilities, sizeof(new_caps));
- for (cap = params; cap; cap = cap->next) {
- new_caps[cap->value->capability] = cap->value->state;
- }
-
- if (!migrate_caps_check(s->capabilities, new_caps, errp)) {
- return;
- }
-
- for (cap = params; cap; cap = cap->next) {
- s->capabilities[cap->value->capability] = cap->value->state;
- }
-}
-
/*
* Check whether the parameters are valid. Error will be put into errp
* (if provided). Return true if valid, otherwise false.
diff --git a/migration/options.c b/migration/options.c
index ff621bdeb3..4cbe77e35a 100644
--- a/migration/options.c
+++ b/migration/options.c
@@ -413,3 +413,29 @@ MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp)
return head;
}
+
+void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
+ Error **errp)
+{
+ MigrationState *s = migrate_get_current();
+ MigrationCapabilityStatusList *cap;
+ bool new_caps[MIGRATION_CAPABILITY__MAX];
+
+ if (migration_is_running(s->state)) {
+ error_setg(errp, QERR_MIGRATION_ACTIVE);
+ return;
+ }
+
+ memcpy(new_caps, s->capabilities, sizeof(new_caps));
+ for (cap = params; cap; cap = cap->next) {
+ new_caps[cap->value->capability] = cap->value->state;
+ }
+
+ if (!migrate_caps_check(s->capabilities, new_caps, errp)) {
+ return;
+ }
+
+ for (cap = params; cap; cap = cap->next) {
+ s->capabilities[cap->value->capability] = cap->value->state;
+ }
+}