diff mbox

KVM Test: Remove duplicated _close_sock function calls in kvm_monitor.py

Message ID 1312442375-6704-1-git-send-email-fyang@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Feng Yang Aug. 4, 2011, 7:19 a.m. UTC
From: Feng Yang <fyang@redhat.com>

self._close_sock will be called two times in HumanMonitor.__init__ and
QMPMonitor.__init__ in exception.

Signed-off-by: Feng Yang <fyang@redhat.com>
---
 client/virt/kvm_monitor.py |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

Comments

Lucas Meneghel Rodrigues Aug. 4, 2011, 3:30 p.m. UTC | #1
On Thu, Aug 4, 2011 at 4:19 AM,  <fyang@redhat.com> wrote:
> From: Feng Yang <fyang@redhat.com>
>
> self._close_sock will be called two times in HumanMonitor.__init__ and
> QMPMonitor.__init__ in exception.

Looks good to me, applied, thanks!

http://autotest.kernel.org/changeset/5521

> Signed-off-by: Feng Yang <fyang@redhat.com>
> ---
>  client/virt/kvm_monitor.py |    3 ---
>  1 files changed, 0 insertions(+), 3 deletions(-)
>
> diff --git a/client/virt/kvm_monitor.py b/client/virt/kvm_monitor.py
> index 3980da8..c96f062 100644
> --- a/client/virt/kvm_monitor.py
> +++ b/client/virt/kvm_monitor.py
> @@ -174,7 +174,6 @@ class HumanMonitor(Monitor):
>             # Find the initial (qemu) prompt
>             s, o = self._read_up_to_qemu_prompt(20)
>             if not s:
> -                self._close_sock()
>                 raise MonitorProtocolError("Could not find (qemu) prompt "
>                                            "after connecting to monitor. "
>                                            "Output so far: %r" % o)
> @@ -432,7 +431,6 @@ class QMPMonitor(Monitor):
>             try:
>                 json
>             except NameError:
> -                self._close_sock()
>                 raise MonitorNotSupportedError("QMP requires the json module "
>                                                "(Python 2.6 and up)")
>
> @@ -447,7 +445,6 @@ class QMPMonitor(Monitor):
>                     break
>                 time.sleep(0.1)
>             else:
> -                self._close_sock()
>                 raise MonitorProtocolError("No QMP greeting message received")
>
>             # Issue qmp_capabilities
> --
> 1.7.1
>
> _______________________________________________
> Autotest mailing list
> Autotest@test.kernel.org
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
>
diff mbox

Patch

diff --git a/client/virt/kvm_monitor.py b/client/virt/kvm_monitor.py
index 3980da8..c96f062 100644
--- a/client/virt/kvm_monitor.py
+++ b/client/virt/kvm_monitor.py
@@ -174,7 +174,6 @@  class HumanMonitor(Monitor):
             # Find the initial (qemu) prompt
             s, o = self._read_up_to_qemu_prompt(20)
             if not s:
-                self._close_sock()
                 raise MonitorProtocolError("Could not find (qemu) prompt "
                                            "after connecting to monitor. "
                                            "Output so far: %r" % o)
@@ -432,7 +431,6 @@  class QMPMonitor(Monitor):
             try:
                 json
             except NameError:
-                self._close_sock()
                 raise MonitorNotSupportedError("QMP requires the json module "
                                                "(Python 2.6 and up)")
 
@@ -447,7 +445,6 @@  class QMPMonitor(Monitor):
                     break
                 time.sleep(0.1)
             else:
-                self._close_sock()
                 raise MonitorProtocolError("No QMP greeting message received")
 
             # Issue qmp_capabilities