Change in vdsm[master]: asyncproc: Return None when no data could be read

smizrahi at redhat.com smizrahi at redhat.com
Tue Dec 10 16:00:27 UTC 2013


Saggi Mizrahi has uploaded a new change for review.

Change subject: asyncproc: Return None when no data could be read
......................................................................

asyncproc: Return None when no data could be read

According to http://docs.python.org/2/library/io.html#io.RawIOBase
we need to return None when a non-blocking call couldn't produce any
data and not an empty strings.

Change-Id: I6329a8651c936789169bd35f26f69580958ef2cd
Signed-off-by: Saggi Mizrahi <smizrahi at redhat.com>
---
M lib/vdsm/utils.py
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/65/22265/1

diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index 6bed6c5..2758f22 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -340,10 +340,16 @@
                 if self._stream.pos == self._stream.len:
                     self._stream.truncate(0)
 
-            return res
+            if res == "" and not self._streamClosed:
+                return None
+            else:
+                return res
 
         def readinto(self, b):
             data = self.read(len(b))
+            if data is None:
+                return None
+
             bytesRead = len(data)
             b[:bytesRead] = data
 


-- 
To view, visit http://gerrit.ovirt.org/22265
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6329a8651c936789169bd35f26f69580958ef2cd
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi at redhat.com>


More information about the vdsm-patches mailing list