diff mbox

[v5,4/4] migration: Fail migration blocker for --only-migratable

Message ID 1484236354-9640-5-git-send-email-ashijeetacharya@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ashijeet Acharya Jan. 12, 2017, 3:52 p.m. UTC
migrate_add_blocker should rightly fail if the '--only-migratable'
option was specified and the device in use should not be able to
perform the action which results in an unmigratable VM.

Make migrate_add_blocker return -EACCES in this case.

Signed-off-by: Ashijeet Acharya <ashijeetacharya@gmail.com>
---
 migration/migration.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox

Patch

diff --git a/migration/migration.c b/migration/migration.c
index cca820e..054048d 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1113,6 +1113,14 @@  static GSList *migration_blockers;
 
 int migrate_add_blocker(Error *reason, Error **errp)
 {
+    if (only_migratable) {
+        error_propagate(errp, reason);
+        error_prepend(errp, "disallowing migration blocker "
+                          "(--only_migratable) for: ");
+        error_free(reason);
+        return -EACCES;
+    }
+
     if (migration_is_idle(NULL)) {
         migration_blockers = g_slist_prepend(migration_blockers, reason);
         return 0;