]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/cephfs: os.write takes bytes, not str
authorSage Weil <sage@redhat.com>
Thu, 19 Dec 2019 17:08:59 +0000 (11:08 -0600)
committerRamana Raja <rraja@redhat.com>
Mon, 15 Jun 2020 09:43:20 +0000 (15:13 +0530)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 05eb2f647d16504a81ff17a8ef732cf0e2d90284)

Conflicts:
qa/tasks/cephfs/test_pool_perm.py: trivial resolution

qa/tasks/cephfs/mount.py
qa/tasks/cephfs/test_full.py

index 86beb45ec0949e1ccfd7653a63a492ecd5446071..8f053feb92a3cd6126da4efce352e89f8141bfbb 100644 (file)
@@ -356,10 +356,10 @@ class CephFSMount(object):
             import os
             import time
 
-            fd = os.open("{path}", os.O_RDWR | os.O_CREAT, 0644)
+            fd = os.open("{path}", os.O_RDWR | os.O_CREAT, 0o644)
             try:
                 while True:
-                    os.write(fd, 'content')
+                    os.write(fd, b'content')
                     time.sleep(1)
                     if not {loop}:
                         break
index e0311883ecae071d429fef9ff7ad4e49ee288b08..21470c87044a51e9ba0ec847cdb6e4c3548ee96c 100644 (file)
@@ -232,7 +232,7 @@ class FullnessTestCase(CephFSTestCase):
             print("writing some data through which we expect to succeed")
             bytes = 0
             f = os.open("{file_path}", os.O_WRONLY | os.O_CREAT)
-            bytes += os.write(f, 'a' * 512 * 1024)
+            bytes += os.write(f, b'a' * 512 * 1024)
             os.fsync(f)
             print("fsync'ed data successfully, will now attempt to fill fs")
 
@@ -243,7 +243,7 @@ class FullnessTestCase(CephFSTestCase):
             full = False
 
             for n in range(0, int({fill_mb} * 0.9)):
-                bytes += os.write(f, 'x' * 1024 * 1024)
+                bytes += os.write(f, b'x' * 1024 * 1024)
                 print("wrote {{0}} bytes via buffered write, may repeat".format(bytes))
             print("done writing {{0}} bytes".format(bytes))
 
@@ -257,7 +257,7 @@ class FullnessTestCase(CephFSTestCase):
             print("starting buffered write")
             try:
                 for n in range(0, int({fill_mb} * 0.2)):
-                    bytes += os.write(f, 'x' * 1024 * 1024)
+                    bytes += os.write(f, b'x' * 1024 * 1024)
                     print("sleeping a bit as we've exceeded 90% of our expected full ratio")
                     time.sleep({full_wait})
             except OSError:
@@ -303,7 +303,7 @@ class FullnessTestCase(CephFSTestCase):
             print("writing some data through which we expect to succeed")
             bytes = 0
             f = os.open("{file_path}", os.O_WRONLY | os.O_CREAT)
-            bytes += os.write(f, 'a' * 4096)
+            bytes += os.write(f, b'a' * 4096)
             os.fsync(f)
             print("fsync'ed data successfully, will now attempt to fill fs")
 
@@ -315,7 +315,7 @@ class FullnessTestCase(CephFSTestCase):
 
             for n in range(0, int({fill_mb} * 1.1)):
                 try:
-                    bytes += os.write(f, 'x' * 1024 * 1024)
+                    bytes += os.write(f, b'x' * 1024 * 1024)
                     print("wrote bytes via buffered write, moving on to fsync")
                 except OSError as e:
                     print("Unexpected error %s from write() instead of fsync()" % e)