Sometimes, when the kvm monitor code tries to verify if
there is data available on the monitor socket, a socket.error
might be thrown, leading to somewhat cryptic error messages,
such as:
raise error(EBADF, 'Bad file descriptor')
error: [Errno 9] Bad file descriptor
So, wrap the select operation on a try block and raise a
more comprehensive MonitorSocketError, along with the
original exception.
Also, turning the error into a MonitorError makes KVM
autotest to not blow when trying to get a screendump
from the VM during postprocessing.
Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
client/virt/kvm_monitor.py | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/client/virt/kvm_monitor.py b/client/virt/kvm_monitor.py
index c96f062..7e6a055 100644
--- a/client/virt/kvm_monitor.py
+++ b/client/virt/kvm_monitor.py
@@ -120,7 +120,10 @@ class Monitor:
def _data_available(self, timeout=0):
timeout = max(0, timeout)
- return bool(select.select([self._socket], [], [], timeout)[0])
+ try:
+ return bool(select.select([self._socket], [], [], timeout)[0])
+ except socket.error, e:
+ raise MonitorSocketError("Verifying data on monitor socket", e)
def _recvall(self):
--
1.7.6
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html