[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 18/30] migration: Move migrate_cap_set() to options.c
From: |
Juan Quintela |
Subject: |
[PULL 18/30] migration: Move migrate_cap_set() to options.c |
Date: |
Mon, 24 Apr 2023 15:27:18 +0200 |
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
migration/migration.c | 20 --------------------
migration/options.c | 21 +++++++++++++++++++++
migration/options.h | 1 +
3 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index b198f4acf5..ddd3fc361f 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1666,26 +1666,6 @@ void migrate_set_state(int *state, int old_state, int
new_state)
}
}
-static bool migrate_cap_set(int cap, bool value, Error **errp)
-{
- MigrationState *s = migrate_get_current();
- bool new_caps[MIGRATION_CAPABILITY__MAX];
-
- if (migration_is_running(s->state)) {
- error_setg(errp, QERR_MIGRATION_ACTIVE);
- return false;
- }
-
- memcpy(new_caps, s->capabilities, sizeof(new_caps));
- new_caps[cap] = value;
-
- if (!migrate_caps_check(s->capabilities, new_caps, errp)) {
- return false;
- }
- s->capabilities[cap] = value;
- return true;
-}
-
static void migrate_set_block_incremental(MigrationState *s, bool value)
{
s->parameters.block_incremental = value;
diff --git a/migration/options.c b/migration/options.c
index 4cbe77e35a..f3b2d6e482 100644
--- a/migration/options.c
+++ b/migration/options.c
@@ -14,6 +14,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-migration.h"
+#include "qapi/qmp/qerror.h"
#include "sysemu/runstate.h"
#include "migration.h"
#include "ram.h"
@@ -392,6 +393,26 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps,
Error **errp)
return true;
}
+bool migrate_cap_set(int cap, bool value, Error **errp)
+{
+ MigrationState *s = migrate_get_current();
+ bool new_caps[MIGRATION_CAPABILITY__MAX];
+
+ if (migration_is_running(s->state)) {
+ error_setg(errp, QERR_MIGRATION_ACTIVE);
+ return false;
+ }
+
+ memcpy(new_caps, s->capabilities, sizeof(new_caps));
+ new_caps[cap] = value;
+
+ if (!migrate_caps_check(s->capabilities, new_caps, errp)) {
+ return false;
+ }
+ s->capabilities[cap] = value;
+ return true;
+}
+
MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp)
{
MigrationCapabilityStatusList *head = NULL, **tail = &head;
diff --git a/migration/options.h b/migration/options.h
index e779f14161..5979e4ff90 100644
--- a/migration/options.h
+++ b/migration/options.h
@@ -41,5 +41,6 @@ bool migrate_zero_copy_send(void);
/* capabilities helpers */
bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp);
+bool migrate_cap_set(int cap, bool value, Error **errp);
#endif
--
2.39.2
- [PULL 20/30] migration: Use migrate_max_postcopy_bandwidth(), (continued)
- [PULL 20/30] migration: Use migrate_max_postcopy_bandwidth(), Juan Quintela, 2023/04/24
- [PULL 15/30] migration: Move migrate_caps_check() to options.c, Juan Quintela, 2023/04/24
- [PULL 08/30] migration: Move migrate_use_events() to options.c, Juan Quintela, 2023/04/24
- [PULL 22/30] migration: Create migrate_throttle_trigger_threshold(), Juan Quintela, 2023/04/24
- [PULL 25/30] migration: Move migrate_announce_params() to option.c, Juan Quintela, 2023/04/24
- [PULL 24/30] migration: Create migrate_max_cpu_throttle(), Juan Quintela, 2023/04/24
- [PULL 26/30] migration: Create migrate_cpu_throttle_initial() to option.c, Juan Quintela, 2023/04/24
- [PULL 27/30] migration: Create migrate_cpu_throttle_increment() function, Juan Quintela, 2023/04/24
- [PULL 28/30] migration: Create migrate_cpu_throttle_tailslow() function, Juan Quintela, 2023/04/24
- [PULL 16/30] migration: Move qmp_query_migrate_capabilities() to options.c, Juan Quintela, 2023/04/24
- [PULL 18/30] migration: Move migrate_cap_set() to options.c,
Juan Quintela <=
- [PULL 19/30] migration: Move parameters functions to option.c, Juan Quintela, 2023/04/24
- [PULL 21/30] migration: Move migrate_use_block_incremental() to option.c, Juan Quintela, 2023/04/24
- [PULL 23/30] migration: Create migrate_checkpoint_delay(), Juan Quintela, 2023/04/24
- [PULL 29/30] migration: Move migrate_postcopy() to options.c, Juan Quintela, 2023/04/24
- [PULL 30/30] migration: Create migrate_max_bandwidth() function, Juan Quintela, 2023/04/24