diff options
-rwxr-xr-x | extras/quota/quota_fsck.py | 30 | ||||
-rwxr-xr-x | extras/quota/xattr_analysis.py | 12 | ||||
-rwxr-xr-x | xlators/experimental/fdl/src/gen_fdl.py | 24 |
3 files changed, 33 insertions, 33 deletions
diff --git a/extras/quota/quota_fsck.py b/extras/quota/quota_fsck.py index e2bb580dd5d..2803c6ec7c6 100755 --- a/extras/quota/quota_fsck.py +++ b/extras/quota/quota_fsck.py @@ -52,16 +52,16 @@ epilog_msg=''' def print_msg(log_type, path, xattr_dict = {}, stbuf = "", dir_size = None): if log_type == QUOTA_VERBOSE: - print('%-24s %-60s\nxattr_values: %s\n%s\n' % {"Verbose", path , xattr_dict, stbuf}) + print('%-24s %-60s\nxattr_values: %s\n%s\n' % {"Verbose", path, xattr_dict, stbuf}) elif log_type == QUOTA_META_ABSENT: - print('%-24s %-60s\n%s\n' % {"Quota-Meta Absent", path , xattr_dict}) + print('%-24s %-60s\n%s\n' % {"Quota-Meta Absent", path, xattr_dict}) elif log_type == QUOTA_SIZE_MISMATCH: print("mismatch") if dir_size is not None: - print('%24s %60s %12s %12s' % {"Size Mismatch", path , xattr_dict['contri_size'], + print('%24s %60s %12s %12s' % {"Size Mismatch", path, xattr_dict['contri_size'], dir_size}) else: - print('%-24s %-60s %-12i %-12i' % {"Size Mismatch", path , xattr_dict['contri_size'], + print('%-24s %-60s %-12i %-12i' % {"Size Mismatch", path, xattr_dict['contri_size'], stbuf.st_size}) def size_differs_lot(s1, s2): @@ -158,18 +158,18 @@ def get_quota_xattr_brick(dpath): for xattr in pairs: xattr_key = xattr.split("=")[0] - if re.search("# file:",xattr_key): + if re.search("# file:", xattr_key): # skip the file comment continue elif xattr_key is "": # skip any empty lines continue - elif not re.search("quota",xattr_key): + elif not re.search("quota", xattr_key): # skip all non quota xattr. continue xattr_value = xattr.split("=")[1] - if re.search("contri",xattr_key): + if re.search("contri", xattr_key): xattr_version = xattr_key.split(".")[5] if 'version' not in xattr_dict: @@ -197,18 +197,18 @@ def get_quota_xattr_brick(dpath): contri_dict['contri_file_count'] = int(xattr_value[18:34], 16) contri_dict['contri_dir_count'] = int(xattr_value[34:], 16) - elif re.search("size",xattr_key): + elif re.search("size", xattr_key): xattr_dict['size'] = int(xattr_value[2:18], 16) xattr_dict['file_count'] = int(xattr_value[18:34], 16) xattr_dict['dir_count'] = int(xattr_value[34:], 16) - elif re.search("dirty",xattr_key): + elif re.search("dirty", xattr_key): if xattr_value == IS_CLEAN: xattr_dict['dirty'] = False elif xattr_value == IS_DIRTY: xattr_dict['dirty'] = True - elif re.search("limit_objects",xattr_key): + elif re.search("limit_objects", xattr_key): xattr_dict['limit_objects'] = int(xattr_value[2:18], 16) - elif re.search("limit_set",xattr_key): + elif re.search("limit_set", xattr_key): xattr_dict['limit_set'] = int(xattr_value[2:18], 16) return xattr_dict @@ -232,7 +232,7 @@ def verify_file_xattr(path, stbuf = None): print_msg(QUOTA_META_ABSENT, path, xattr_dict, stbuf) fix_xattr(path, False) return - elif size_differs_lot(contri_dict['contri_size'] , stbuf.st_size): + elif size_differs_lot(contri_dict['contri_size'], stbuf.st_size): print_msg(QUOTA_SIZE_MISMATCH, path, xattr_dict, stbuf) fix_xattr(path, False) return @@ -257,7 +257,7 @@ def verify_dir_xattr(path, dir_size): fix_xattr(path, True) return elif size_differs_lot(dir_size, xattr_dict['size']) or \ - size_differs_lot(contri_dict['contri_size'] , xattr_dict['size']): + size_differs_lot(contri_dict['contri_size'], xattr_dict['size']): print_msg(QUOTA_SIZE_MISMATCH, path, xattr_dict, stbuf, dir_size) fix_xattr(path, True) return @@ -347,7 +347,7 @@ if __name__ == '__main__': disk space exists if redirecting to file] ''' ) - parser.add_argument('--fix-issues',metavar='mount_path', dest='mnt', action='store', + parser.add_argument('--fix-issues', metavar='mount_path', dest='mnt', action='store', help=''' fix accounting issues where the xattr values disagree with stat sizes reported by gluster. A mount is also @@ -355,7 +355,7 @@ if __name__ == '__main__': [CAUTION: This will directly modify backend xattr] ''' ) - parser.add_argument('--sub-dir',metavar='sub_dir', dest='sub_dir', action='store', + parser.add_argument('--sub-dir', metavar='sub_dir', dest='sub_dir', action='store', help=''' limit the crawling and accounting verification/correction to a specific subdirectory. diff --git a/extras/quota/xattr_analysis.py b/extras/quota/xattr_analysis.py index 9a178e058c2..a68eb341e19 100755 --- a/extras/quota/xattr_analysis.py +++ b/extras/quota/xattr_analysis.py @@ -28,7 +28,7 @@ def get_quota_xattr_brick(): mismatch_size = [('====contri_size===', '====size====')] for xattr in pairs: k = xattr.split("=")[0] - if re.search("# file:",k): + if re.search("# file:", k): print(xdict) filename=k print("=====" + filename + "=======") @@ -38,7 +38,7 @@ def get_quota_xattr_brick(): else: print(xattr) v = xattr.split("=")[1] - if re.search("contri",k): + if re.search("contri", k): if len(v) == 34: # for files size is obtained in iatt, file count should be 1, dir count=0 xdict['contri_file_count'] = int(v[18:34], 16) @@ -47,18 +47,18 @@ def get_quota_xattr_brick(): xdict['contri_size'] = size(int(v[2:18], 16)) xdict['contri_file_count'] = int(v[18:34], 16) xdict['contri_dir_count'] = int(v[34:], 16) - elif re.search("size",k): + elif re.search("size", k): xdict['size'] = size(int(v[2:18], 16)) xdict['file_count'] = int(v[18:34], 16) xdict['dir_count'] = int(v[34:], 16) - elif re.search("dirty",k): + elif re.search("dirty", k): if v == '0x3000': xdict['dirty'] = False elif v == '0x3100': xdict['dirty'] = True - elif re.search("limit_objects",k): + elif re.search("limit_objects", k): xdict['limit_objects'] = int(v[2:18], 16) - elif re.search("limit_set",k): + elif re.search("limit_set", k): xdict['limit_set'] = size(int(v[2:18], 16)) if 'size' in xdict and 'contri_size' in xdict and xdict['size'] != xdict['contri_size']: diff --git a/xlators/experimental/fdl/src/gen_fdl.py b/xlators/experimental/fdl/src/gen_fdl.py index d2e7dd5dfb2..e8f97dc9957 100755 --- a/xlators/experimental/fdl/src/gen_fdl.py +++ b/xlators/experimental/fdl/src/gen_fdl.py @@ -289,16 +289,16 @@ def get_special_subs (args): if arg[3] == "vector": # Make it as obvious as possible that this is a special case. len_code += LEN_VECTOR_TEMPLATE \ - .replace("@VEC@","stub->args.vector") \ - .replace("@CNT@","stub->args.count") + .replace("@VEC@", "stub->args.vector") \ + .replace("@CNT@", "stub->args.count") ser_code += SERLZ_VECTOR_TEMPLATE \ - .replace("@VEC@","stub->args.vector") \ - .replace("@CNT@","stub->args.count") + .replace("@VEC@", "stub->args.vector") \ + .replace("@CNT@", "stub->args.count") else: len_tmpl, ser_tmpl = typemap[arg[2]] src = "stub->args.%s" % arg[3] - len_code += len_tmpl.replace("@SRC@",src) - ser_code += ser_tmpl.replace("@SRC@",src) + len_code += len_tmpl.replace("@SRC@", src) + ser_code += ser_tmpl.replace("@SRC@", src) return len_code, ser_code # Mention those fops in the selective_generate table, for which @@ -326,17 +326,17 @@ def gen_fdl (): fop_subs[name]["@LEN_CODE@"] = len_code[:-1] fop_subs[name]["@SER_CODE@"] = ser_code[:-1] if 'len' in gen_funcs: - print(generate(LEN_TEMPLATE,name,fop_subs)) + print(generate(LEN_TEMPLATE, name, fop_subs)) if 'serialize' in gen_funcs: - print(generate(SER_TEMPLATE,name,fop_subs)) + print(generate(SER_TEMPLATE, name, fop_subs)) if name == 'writev': print("#define DESTAGE_ASYNC") if 'callback' in gen_funcs: - print(generate(CBK_TEMPLATE,name,cbk_subs)) + print(generate(CBK_TEMPLATE, name, cbk_subs)) if 'continue' in gen_funcs: - print(generate(CONTINUE_TEMPLATE,name,fop_subs)) + print(generate(CONTINUE_TEMPLATE, name, fop_subs)) if 'fop' in gen_funcs: - print(generate(FOP_TEMPLATE,name,fop_subs)) + print(generate(FOP_TEMPLATE, name, fop_subs)) if name == 'writev': print("#undef DESTAGE_ASYNC") entrypoints.append(name) @@ -345,7 +345,7 @@ def gen_fdl (): print("\t.%s = fdl_%s," % (ep, ep)) print("};") -for l in open(sys.argv[1],'r').readlines(): +for l in open(sys.argv[1], 'r').readlines(): if l.find('#pragma generate') != -1: print("/* BEGIN GENERATED CODE - DO NOT MODIFY */") gen_fdl() |