aboutsummaryrefslogtreecommitdiff
path: root/migration/options.c
diff options
context:
space:
mode:
Diffstat (limited to 'migration/options.c')
-rw-r--r--migration/options.c21
1 files changed, 21 insertions, 0 deletions
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;