Skip to contentSkip to conversation

kvm_monitor.py: is_responsive(): Use status command

PATCH In review Luiz Capitulino 2 participants 2 messages Oct 7, 2010 – Oct 8, 2010 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm_monitor.py: is_responsive(): Use status command

The is_responsive() method in QMPMonitor class uses the query-version command to check if the monitor is alive and the same method in the HumanMonitor class uses the help command.

This commit changes both classes to use the status command instead, so that:

o The QEMU's response is shorter when using the Human Monitor. The help command output is 70 lines long, which makes it a bit expansive for a single ping

o is_responsive() can be extended to check if QEMU is running

o My logs won't be flooded with help's output :-)

---
 client/tests/kvm/kvm_monitor.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
client/tests/kvm/kvm_monitor.py +2 -2
index 9a66388..8c92413 100644
@@ -243,7 +243,7 @@ class HumanMonitor(Monitor):
         @return: True if responsive, False otherwise
         """
         try:
-            self._get_command_output("help")
+            self._get_command_output("info status")
             return True
         except MonitorError:
             return False
@@ -548,7 +548,7 @@ class QMPMonitor(Monitor):
         @return: True if responsive, False otherwise
         """
         try:
-            self._get_command_output("query-version")
+            self._get_command_output("query-status")
             return True
         except MonitorError:
             return False
Signature · 1 line
1.7.3.1.104.gc752e
#1 lore raw
Quoted 7 lines · Luiz Capitulino

The is_responsive() method in QMPMonitor class uses the query-version command to check if the monitor is alive and the same method in the HumanMonitor class uses the help command.

This commit changes both classes to use the status command instead, so that:

Quoted 7 lines

o The QEMU's response is shorter when using the Human Monitor. The help command output is 70 lines long, which makes it a bit expansive for a single ping

o is_responsive() can be extended to check if QEMU is running

o My logs won't be flooded with help's output :-)

This looks good to me, applied:

Quoted 27 lines
---
 client/tests/kvm/kvm_monitor.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
client/tests/kvm/kvm_monitor.py +2 -2
index 9a66388..8c92413 100644
@@ -243,7 +243,7 @@ class HumanMonitor(Monitor):
         @return: True if responsive, False otherwise
         """
         try:
-            self._get_command_output("help")
+            self._get_command_output("info status")
             return True
         except MonitorError:
             return False
@@ -548,7 +548,7 @@ class QMPMonitor(Monitor):
         @return: True if responsive, False otherwise
         """
         try:
-            self._get_command_output("query-version")
+            self._get_command_output("query-status")
             return True
         except MonitorError:
             return False