Skip to contentSkip to conversation

migration: qmp_migrate(): keep working after syntax error

PATCH In review Luiz Capitulino 2 participants 2 messages Jan 2, 2014 – Jan 3, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 migration: qmp_migrate(): keep working after syntax error

If a user or QMP client enter a bad syntax for the migrate command in QMP/HMP, then the migrate command will never succeed from that point on.

For example, if you enter:

(qemu) migrate tcp;0:4444
migrate: Parameter 'uri' expects a valid migration protocol

Then the migrate command will always fail from now on:

(qemu) migrate tcp:0:4444
migrate: There's a migration process in progress

The problem is that qmp_migrate() sets the migration status to MIG_STATE_SETUP and doesn't reset it on syntax error. This bug was introduced by commit 29ae8a4133082e16970c9d4be09f4b6a15034617.

---
 migration.c | 1 +
 1 file changed, 1 insertion(+)
migration.c +1 -0
index 2b1ab20..557195a 100644
@@ -437,6 +437,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
 #endif
     } else {
         error_set(errp, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol");
+        s->state = MIG_STATE_ERROR;
         return;
     }
 
Signature · 1 line
1.8.1.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 29 lines · Luiz Capitulino

If a user or QMP client enter a bad syntax for the migrate command in QMP/HMP, then the migrate command will never succeed from that point on.

For example, if you enter:

(qemu) migrate tcp;0:4444
migrate: Parameter 'uri' expects a valid migration protocol

Then the migrate command will always fail from now on:

(qemu) migrate tcp:0:4444
migrate: There's a migration process in progress

The problem is that qmp_migrate() sets the migration status to MIG_STATE_SETUP and doesn't reset it on syntax error. This bug was introduced by commit 29ae8a4133082e16970c9d4be09f4b6a15034617.

---
  migration.c | 1 +
  1 file changed, 1 insertion(+)
migration.c +0 -0
index 2b1ab20..557195a 100644

migration.c void qmp_migrate(const char *uri, bool has_blk, bool blk, · line 443

Quoted 7 lines
migration.c +1 -0
@@ -437,6 +437,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
  #endif
      } else {
          error_set(errp, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol");
+        s->state = MIG_STATE_ERROR;
          return;
      }