aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
Diffstat (limited to 'migration')
-rw-r--r--migration/migration.c21
-rw-r--r--migration/savevm.c2
2 files changed, 16 insertions, 7 deletions
diff --git a/migration/migration.c b/migration/migration.c
index 12dbf5b343..721d010fde 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -992,6 +992,20 @@ void qmp_migrate_incoming(const char *uri, Error **errp)
once = false;
}
+bool migration_is_blocked(Error **errp)
+{
+ if (qemu_savevm_state_blocked(errp)) {
+ return true;
+ }
+
+ if (migration_blockers) {
+ *errp = error_copy(migration_blockers->data);
+ return true;
+ }
+
+ return false;
+}
+
void qmp_migrate(const char *uri, bool has_blk, bool blk,
bool has_inc, bool inc, bool has_detach, bool detach,
Error **errp)
@@ -1014,12 +1028,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
return;
}
- if (qemu_savevm_state_blocked(errp)) {
- return;
- }
-
- if (migration_blockers) {
- *errp = error_copy(migration_blockers->data);
+ if (migration_is_blocked(errp)) {
return;
}
diff --git a/migration/savevm.c b/migration/savevm.c
index 8546fdfae1..f8450fd0e9 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1170,7 +1170,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp)
MigrationState *ms = migrate_init(&params);
ms->to_dst_file = f;
- if (qemu_savevm_state_blocked(errp)) {
+ if (migration_is_blocked(errp)) {
return -EINVAL;
}