]> git.apps.os.sepia.ceph.com Git - ceph-ci.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)
committerSage Weil <sage@redhat.com>
Thu, 19 Dec 2019 17:12:04 +0000 (11:12 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
qa/tasks/cephfs/mount.py
qa/tasks/cephfs/test_full.py
qa/tasks/cephfs/test_pool_perm.py

index fe7186fb57d537ca714c637fba31ea281457c1e3..b729d801ab7038b0ca39cb5658f49941f6d4841f 100644 (file)
@@ -394,10 +394,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 9ebab53549cb2c22508facd023a54f15583001ec..279c21ebe2db85cf11ecdb5cb06526df7f21bc1f 100644 (file)
@@ -250,7 +250,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")
 
@@ -261,7 +261,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))
 
@@ -275,7 +275,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:
@@ -321,7 +321,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")
 
@@ -333,7 +333,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)
index 22775e71c1b051efd9c320003dd1929a5fd1954e..f0efc43ec6368275a0dd70d3f4e43699abf3d79d 100644 (file)
@@ -19,7 +19,7 @@ class TestPoolPerm(CephFSTestCase):
                 if {check_read}:
                     ret = os.read(fd, 1024)
                 else:
-                    os.write(fd, 'content')
+                    os.write(fd, b'content')
             except OSError, e:
                 if e.errno != errno.EPERM:
                     raise