Change in vdsm[master]: Fix data pass with async execution

smizrahi at redhat.com smizrahi at redhat.com
Thu Sep 20 11:00:46 UTC 2012


Saggi Mizrahi has uploaded a new change for review.

Change subject: Fix data pass with async execution
......................................................................

Fix data pass with async execution

Change-Id: Ibe496e74a24721ba00c596d36286bcdafdc20069
Signed-off-by: Saggi Mizrahi <smizrahi at redhat.com>
---
M tests/miscTests.py
M vdsm/storage/misc.py
2 files changed, 11 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/81/8081/1

diff --git a/tests/miscTests.py b/tests/miscTests.py
index bec6539..5570579 100644
--- a/tests/miscTests.py
+++ b/tests/miscTests.py
@@ -352,6 +352,14 @@
         self.assertTrue(duration > (ttl))
         p.kill()
 
+    def testCommunicate(self):
+        data = ("The trouble with the world is that the stupid are cocksure "
+                "and the intelligent are full of doubt")
+        p = misc.execCmd(["dd"], data=data, sudo=False, sync=False)
+        p.stdin.flush()
+        p.stdin.close()
+        self.assertEquals(p.stdout.read(len(data)).strip(), data)
+
 
 class DdWatchCopy(TestCaseBase):
     def testNonAlignedCopy(self, sudo=False):
diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py
index 161726b..9627e8f 100644
--- a/vdsm/storage/misc.py
+++ b/vdsm/storage/misc.py
@@ -201,7 +201,9 @@
     p = AsyncProc(p)
     if not sync:
         if data is not None:
-            p.stdout.write(data)
+            p.stdin.write(data)
+            p.stdin.flush()
+
         return p
 
     (out, err) = p.communicate(data)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibe496e74a24721ba00c596d36286bcdafdc20069
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