9ae3a8
From e7ea7509ab95b71445d98b7c76cc74e1e1304779 Mon Sep 17 00:00:00 2001
9ae3a8
From: Amit Shah <amit.shah@redhat.com>
9ae3a8
Date: Fri, 11 Apr 2014 09:28:47 +0200
9ae3a8
Subject: [PATCH 02/13] migration: qmp_migrate(): keep working after syntax error
9ae3a8
9ae3a8
RH-Author: Amit Shah <amit.shah@redhat.com>
9ae3a8
Message-id: <717d7d24efbff7fe32d70c506edea41ea00d1edc.1397208304.git.amit.shah@redhat.com>
9ae3a8
Patchwork-id: 58439
9ae3a8
O-Subject: [RHEL7.0.z qemu-kvm PATCH 1/1] migration: qmp_migrate(): keep working after syntax error
9ae3a8
Bugzilla: 1086598
9ae3a8
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
9ae3a8
RH-Acked-by: Amos Kong <akong@redhat.com>
9ae3a8
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
9ae3a8
9ae3a8
From: Luiz Capitulino <lcapitulino@redhat.com>
9ae3a8
9ae3a8
If a user or QMP client enter a bad syntax for the migrate
9ae3a8
command in QMP/HMP, then the migrate command will never succeed
9ae3a8
from that point on.
9ae3a8
9ae3a8
For example, if you enter:
9ae3a8
9ae3a8
(qemu) migrate tcp;0:4444
9ae3a8
migrate: Parameter 'uri' expects a valid migration protocol
9ae3a8
9ae3a8
Then the migrate command will always fail from now on:
9ae3a8
9ae3a8
(qemu) migrate tcp:0:4444
9ae3a8
migrate: There's a migration process in progress
9ae3a8
9ae3a8
The problem is that qmp_migrate() sets the migration status to
9ae3a8
MIG_STATE_SETUP and doesn't reset it on syntax error. This bug
9ae3a8
was introduced by commit 29ae8a4133082e16970c9d4be09f4b6a15034617.
9ae3a8
9ae3a8
Bugzilla: 1086598
9ae3a8
9ae3a8
Reviewed-by: Michael R. Hines <mrhines@us.ibm.com>
9ae3a8
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
9ae3a8
(cherry picked from commit c950114286ea358a93ce632db0421945e1008395)
9ae3a8
Signed-off-by: Amit Shah <amit.shah@redhat.com>
9ae3a8
---
9ae3a8
 migration.c | 1 +
9ae3a8
 1 file changed, 1 insertion(+)
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 migration.c |    1 +
9ae3a8
 1 files changed, 1 insertions(+), 0 deletions(-)
9ae3a8
9ae3a8
diff --git a/migration.c b/migration.c
9ae3a8
index 93de654..7efbd25 100644
9ae3a8
--- a/migration.c
9ae3a8
+++ b/migration.c
9ae3a8
@@ -457,6 +457,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
9ae3a8
 #endif
9ae3a8
     } else {
9ae3a8
         error_set(errp, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol");
9ae3a8
+        s->state = MIG_STATE_ERROR;
9ae3a8
         return;
9ae3a8
     }
9ae3a8
 
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8