diff mbox

virt.kvm_monitor: Future proof migration handling on QMP monitor

Message ID 1345646618-7522-1-git-send-email-lmr@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lucas Meneghel Rodrigues Aug. 22, 2012, 2:43 p.m. UTC
With d46ad35c74, the exception handling for migrations
happening when using a single QMP monitor relies on
an exception class that's going to disappear in future
versions of QEMU, being replaced by the GenericError
class. So let's also handle this exception class.

CC: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
---
 client/virt/kvm_monitor.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Luiz Capitulino Aug. 22, 2012, 4:01 p.m. UTC | #1
On Wed, 22 Aug 2012 11:43:38 -0300
Lucas Meneghel Rodrigues <lmr@redhat.com> wrote:

> With d46ad35c74, the exception handling for migrations
> happening when using a single QMP monitor relies on
> an exception class that's going to disappear in future
> versions of QEMU, being replaced by the GenericError
> class. So let's also handle this exception class.
> 
> CC: Luiz Capitulino <lcapitulino@redhat.com>
> Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
> ---
>  client/virt/kvm_monitor.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/client/virt/kvm_monitor.py b/client/virt/kvm_monitor.py
> index 9d8ed87..932725b 100644
> --- a/client/virt/kvm_monitor.py
> +++ b/client/virt/kvm_monitor.py
> @@ -1155,7 +1155,7 @@ class QMPMonitor(Monitor):
>          try:
>              return self.cmd("migrate", args)
>          except QMPCmdError, e:
> -            if e.data['class'] == 'SockConnectInprogress':
> +            if e.data['class'] in ['SockConnectInprogress', 'GenericError']:
>                  logging.debug("Migrate socket connection still initializing...")
>              else:
>                  raise e

Patch looks correct now. There's only one small detail that I forgot
telling you in the previous email (sorry!).

The SockConnectInprogress shouldn't be returned by qemu. Actually, migration
works most of the time this error is returned. That error was being used to
communicate a special condition in qemu that was handled internally, however,
due to a bug, the error ended up being propagated up and returned as a qmp
response.

This was fixed in qemu.git for 1.2. But this patch made me check this issue
for 1.1 and it seems to exist there too, which means my fix has to be
backported to -stable.

There's no problem keeping this patch as is though.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/client/virt/kvm_monitor.py b/client/virt/kvm_monitor.py
index 9d8ed87..932725b 100644
--- a/client/virt/kvm_monitor.py
+++ b/client/virt/kvm_monitor.py
@@ -1155,7 +1155,7 @@  class QMPMonitor(Monitor):
         try:
             return self.cmd("migrate", args)
         except QMPCmdError, e:
-            if e.data['class'] == 'SockConnectInprogress':
+            if e.data['class'] in ['SockConnectInprogress', 'GenericError']:
                 logging.debug("Migrate socket connection still initializing...")
             else:
                 raise e