summaryrefslogtreecommitdiffstats
path: root/geo-replication/syncdaemon/libgfchangelog.py
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2018-10-03 00:45:09 -0400
committerAmar Tumballi <amarts@redhat.com>2018-10-08 16:36:04 +0000
commitfb6e8d0d0ca21b16d331fa69da9b9dadf6c5c35d (patch)
treedcff4d7a563b034f0f91347bf9fc4f1814143724 /geo-replication/syncdaemon/libgfchangelog.py
parent860a990811c5364bc2de04ca07096cde312ff209 (diff)
georep: python2 to python3 compat - syscalls
1. ctypes/syscalls A) arguments is expected to be encoded B) Raw conversion of return value from bytearray into string 2. struct pack/unpack - Raw converstion of string to bytearray 3. basestring -> str Updates: #411 Change-Id: I80f939adcdec0ed0022c87c0b76d057ad5559e5a Signed-off-by: Kotresh HR <khiremat@redhat.com>
Diffstat (limited to 'geo-replication/syncdaemon/libgfchangelog.py')
-rw-r--r--geo-replication/syncdaemon/libgfchangelog.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/geo-replication/syncdaemon/libgfchangelog.py b/geo-replication/syncdaemon/libgfchangelog.py
index da12438d069..cc40fd5475d 100644
--- a/geo-replication/syncdaemon/libgfchangelog.py
+++ b/geo-replication/syncdaemon/libgfchangelog.py
@@ -39,8 +39,8 @@ class Changes(object):
@classmethod
def cl_register(cls, brick, path, log_file, log_level, retries=0):
- ret = cls._get_api('gf_changelog_register')(brick, path,
- log_file,
+ ret = cls._get_api('gf_changelog_register')(brick.encode(), path.encode(),
+ log_file.encode(),
log_level, retries)
if ret == -1:
cls.raise_changelog_err()
@@ -63,14 +63,14 @@ class Changes(object):
def clsort(f):
return f.split('.')[-1]
changes = []
- buf = create_string_buffer('\0', 4096)
+ buf = create_string_buffer(b'\0' * 4096)
call = cls._get_api('gf_changelog_next_change')
while True:
ret = call(buf, 4096)
if ret in (0, -1):
break
- changes.append(buf.raw[:ret - 1])
+ changes.append(buf.raw[:ret - 1].decode())
if ret == -1:
cls.raise_changelog_err()
# cleanup tracker
@@ -79,7 +79,7 @@ class Changes(object):
@classmethod
def cl_done(cls, clfile):
- ret = cls._get_api('gf_changelog_done')(clfile)
+ ret = cls._get_api('gf_changelog_done')(clfile.encode())
if ret == -1:
cls.raise_changelog_err()
@@ -94,7 +94,7 @@ class Changes(object):
@classmethod
def cl_history_changelog(cls, changelog_path, start, end, num_parallel):
actual_end = c_ulong()
- ret = cls._get_api('gf_history_changelog')(changelog_path, start, end,
+ ret = cls._get_api('gf_history_changelog')(changelog_path.encode(), start, end,
num_parallel,
byref(actual_end))
if ret == -1:
@@ -118,14 +118,14 @@ class Changes(object):
return f.split('.')[-1]
changes = []
- buf = create_string_buffer('\0', 4096)
+ buf = create_string_buffer(b'\0' * 4096)
call = cls._get_api('gf_history_changelog_next_change')
while True:
ret = call(buf, 4096)
if ret in (0, -1):
break
- changes.append(buf.raw[:ret - 1])
+ changes.append(buf.raw[:ret - 1].decode())
if ret == -1:
cls.raise_changelog_err()
@@ -133,6 +133,6 @@ class Changes(object):
@classmethod
def cl_history_done(cls, clfile):
- ret = cls._get_api('gf_history_changelog_done')(clfile)
+ ret = cls._get_api('gf_history_changelog_done')(clfile.encode())
if ret == -1:
cls.raise_changelog_err()