summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xextras/prot_filter.py12
-rwxr-xr-xextras/rebalance.py38
-rw-r--r--extras/volfilter.py14
-rwxr-xr-xtests/bugs/distribute/overlap.py26
-rwxr-xr-xtests/features/ipctest.py8
-rwxr-xr-xtests/utils/gfid-access.py2
-rwxr-xr-xtests/utils/setfattr.py2
-rwxr-xr-xxlators/experimental/fdl/src/gen_dumper.py12
-rwxr-xr-xxlators/experimental/fdl/src/gen_recon.py18
9 files changed, 66 insertions, 66 deletions
diff --git a/extras/prot_filter.py b/extras/prot_filter.py
index 099832fc08a..e2b81218f40 100755
--- a/extras/prot_filter.py
+++ b/extras/prot_filter.py
@@ -43,7 +43,7 @@ def load (path):
# If it's a string, open it; otherwise, assume it's already a
# file-like object (most notably from urllib*).
if type(path) in (str,):
- fp = file(path,"r")
+ fp = file(path, "r")
else:
fp = path
all_xlators = {}
@@ -86,7 +86,7 @@ def load (path):
def generate (graph, last, stream=sys.stdout):
for sv in last.subvols:
if not sv.dumped:
- generate(graph,sv,stream)
+ generate(graph, sv, stream)
print("", file=stream)
sv.dumped = True
print("volume %s" % last.name, file=stream)
@@ -133,13 +133,13 @@ if __name__ == "__main__":
sys.exit(0)
for v in graph.values():
if v.xl_type == "cluster/distribute":
- push_filter(graph,v,"features/prot_dht")
+ push_filter(graph, v, "features/prot_dht")
elif v.xl_type == "protocol/client":
- push_filter(graph,v,"features/prot_client")
+ push_filter(graph, v, "features/prot_client")
# We push debug/trace so that every fop gets a real frame, because DHT
# gets confused if STACK_WIND_TAIL causes certain fops to be invoked
# from anything other than a direct child.
for v in graph.values():
if v.xl_type == "features/prot_client":
- push_filter(graph,v,"debug/trace")
- generate(graph,last,stream=open(path,"w"))
+ push_filter(graph, v, "debug/trace")
+ generate(graph, last, stream=open(path, "w"))
diff --git a/extras/rebalance.py b/extras/rebalance.py
index 871b06682d5..32ca067b32d 100755
--- a/extras/rebalance.py
+++ b/extras/rebalance.py
@@ -39,13 +39,13 @@ class Brick:
def get_bricks (host, vol):
t = pipes.Template()
- t.prepend("gluster --remote-host=%s system getspec %s"%(host,vol),".-")
- return t.open(None,"r")
+ t.prepend("gluster --remote-host=%s system getspec %s"%(host, vol), ".-")
+ return t.open(None, "r")
def generate_stanza (vf, all_xlators, cur_subvol):
sv_list = []
for sv in cur_subvol.subvols:
- generate_stanza(vf,all_xlators,sv)
+ generate_stanza(vf, all_xlators, sv)
sv_list.append(sv.name)
vf.write("volume %s\n"%cur_subvol.name)
vf.write(" type %s\n"%cur_subvol.type)
@@ -60,14 +60,14 @@ def mount_brick (localpath, all_xlators, dht_subvol):
# Generate a volfile.
vf_name = localpath + ".vol"
- vf = open(vf_name,"w")
- generate_stanza(vf,all_xlators,dht_subvol)
+ vf = open(vf_name, "w")
+ generate_stanza(vf, all_xlators, dht_subvol)
vf.flush()
vf.close()
# Create a brick directory and mount the brick there.
os.mkdir(localpath)
- subprocess.call(["glusterfs","-f",vf_name,localpath])
+ subprocess.call(["glusterfs", "-f", vf_name, localpath])
# We use the command-line tools because there's no getxattr support in the
# Python standard library (which is ridiculous IMO). Adding the xattr package
@@ -81,16 +81,16 @@ def mount_brick (localpath, all_xlators, dht_subvol):
def get_range (brick):
t = pipes.Template()
cmd = "getfattr -e hex -n trusted.glusterfs.dht %s 2> /dev/null"
- t.prepend(cmd%brick,".-")
- t.append("grep ^trusted.glusterfs.dht=","--")
- f = t.open(None,"r")
+ t.prepend(cmd%brick, ".-")
+ t.append("grep ^trusted.glusterfs.dht=", "--")
+ f = t.open(None, "r")
try:
value = f.readline().rstrip().split('=')[1][2:]
except:
print("could not get layout for %s (might be OK)" % brick)
return None
- v_start = int("0x"+value[16:24],16)
- v_end = int("0x"+value[24:32],16)
+ v_start = int("0x"+value[16:24], 16)
+ v_end = int("0x"+value[24:32], 16)
return (v_start, v_end)
def calc_sizes (bricks, total):
@@ -186,7 +186,7 @@ if __name__ == "__main__":
if options.verbose:
print("Cleaning up %s" % work_dir)
for b in bricks:
- subprocess.call(["umount",b.path])
+ subprocess.call(["umount", b.path])
shutil.rmtree(work_dir)
if not options.leave_mounted:
atexit.register(cleanup_workdir)
@@ -196,7 +196,7 @@ if __name__ == "__main__":
if options.verbose:
print("Mounting subvolumes...")
index = 0
- volfile_pipe = get_bricks(hostname,volname)
+ volfile_pipe = get_bricks(hostname, volname)
all_xlators, last_xlator = volfilter.load(volfile_pipe)
for dht_vol in all_xlators.itervalues():
if dht_vol.type == "cluster/distribute":
@@ -208,8 +208,8 @@ if __name__ == "__main__":
#print "found subvol %s" % sv.name
lpath = "%s/brick%s" % (work_dir, index)
index += 1
- mount_brick(lpath,all_xlators,sv)
- bricks.append(Brick(lpath,sv.name))
+ mount_brick(lpath, all_xlators, sv)
+ bricks.append(Brick(lpath, sv.name))
if index == 0:
print("no bricks")
sys.exit(1)
@@ -251,11 +251,11 @@ if __name__ == "__main__":
if rs > re:
print("%s has backwards hash range" % b.path)
sys.exit(1)
- b.set_range(hash_range[0],hash_range[1])
+ b.set_range(hash_range[0], hash_range[1])
if options.verbose:
print("Calculating new layouts...")
- calc_sizes(bricks,total)
+ calc_sizes(bricks, total)
bricks, used = normalize(bricks)
# We can't afford O(n!) here, but O(n^2) should be OK and the result
@@ -266,7 +266,7 @@ if __name__ == "__main__":
for i in range(used):
new_bricks = bricks[:]
del new_bricks[used]
- new_bricks.insert(i,bricks[used])
+ new_bricks.insert(i, bricks[used])
new_score = get_score(new_bricks)
if new_score > best_score:
best_place = i
@@ -274,7 +274,7 @@ if __name__ == "__main__":
if best_place != used:
nb = bricks[used]
del bricks[used]
- bricks.insert(best_place,nb)
+ bricks.insert(best_place, nb)
used += 1
# Finalize whatever we decided on.
diff --git a/extras/volfilter.py b/extras/volfilter.py
index 515a6408bb9..da0a0e62ddb 100644
--- a/extras/volfilter.py
+++ b/extras/volfilter.py
@@ -36,7 +36,7 @@ good_xlators = [
"storage/posix",
]
-def copy_stack (old_xl,suffix,recursive=False):
+def copy_stack (old_xl, suffix, recursive=False):
if recursive:
new_name = old_xl.name + "-" + suffix
else:
@@ -46,7 +46,7 @@ def copy_stack (old_xl,suffix,recursive=False):
# The results with normal assignment here are . . . amusing.
new_xl.opts = copy.deepcopy(old_xl.opts)
for sv in old_xl.subvols:
- new_xl.subvols.append(copy_stack(sv,suffix,True))
+ new_xl.subvols.append(copy_stack(sv, suffix, True))
# Patch up the path at the bottom.
if new_xl.type == "storage/posix":
new_xl.opts["directory"] += ("/" + suffix)
@@ -64,10 +64,10 @@ def cleanup (parent, graph):
parent.opts["transport-type"] = "ssl"
sv = []
for child in parent.subvols:
- sv.append(cleanup(child,graph))
+ sv.append(cleanup(child, graph))
parent.subvols = sv
else:
- parent = cleanup(parent.subvols[0],graph)
+ parent = cleanup(parent.subvols[0], graph)
return parent
class Translator:
@@ -84,7 +84,7 @@ def load (path):
# If it's a string, open it; otherwise, assume it's already a
# file-like object (most notably from urllib*).
if type(path) in (str,):
- fp = file(path,"r")
+ fp = file(path, "r")
else:
fp = path
all_xlators = {}
@@ -127,7 +127,7 @@ def load (path):
def generate (graph, last, stream=sys.stdout):
for sv in last.subvols:
if not sv.dumped:
- generate(graph,sv,stream)
+ generate(graph, sv, stream)
print("", file=stream)
sv.dumped = True
print("volume %s" % last.name, file=stream)
@@ -165,4 +165,4 @@ def delete (graph, victim):
if __name__ == "__main__":
graph, last = load(sys.argv[1])
- generate(graph,last)
+ generate(graph, last)
diff --git a/tests/bugs/distribute/overlap.py b/tests/bugs/distribute/overlap.py
index 105aa6792cf..726389a78d6 100755
--- a/tests/bugs/distribute/overlap.py
+++ b/tests/bugs/distribute/overlap.py
@@ -4,15 +4,15 @@ from __future__ import print_function
import sys
def calculate_one (ov, nv):
- old_start = int(ov[18:26],16)
- old_end = int(ov[26:34],16)
- new_start = int(nv[18:26],16)
- new_end = int(nv[26:34],16)
+ old_start = int(ov[18:26], 16)
+ old_end = int(ov[26:34], 16)
+ new_start = int(nv[18:26], 16)
+ new_end = int(nv[26:34], 16)
if (new_end < old_start) or (new_start > old_end):
#print '%s, %s -> ZERO' % (ov, nv)
return 0
- all_start = max(old_start,new_start)
- all_end = min(old_end,new_end)
+ all_start = max(old_start, new_start)
+ all_end = min(old_end, new_end)
#print '%s, %s -> %08x' % (ov, nv, all_end - all_start + 1)
return all_end - all_start + 1
@@ -22,7 +22,7 @@ def calculate_all (values):
for old_val in values[:nv_index]:
new_val = values[nv_index]
nv_index += 1
- total += calculate_one(old_val,new_val)
+ total += calculate_one(old_val, new_val)
return total
"""
@@ -45,13 +45,13 @@ test2_vals = [
'0x000000000000000055555555aaaaaaa9', # second third
]
-print '%08x' % calculate_one(test1_vals[0],test1_vals[3])
-print '%08x' % calculate_one(test1_vals[1],test1_vals[4])
-print '%08x' % calculate_one(test1_vals[2],test1_vals[5])
+print '%08x' % calculate_one(test1_vals[0], test1_vals[3])
+print '%08x' % calculate_one(test1_vals[1], test1_vals[4])
+print '%08x' % calculate_one(test1_vals[2], test1_vals[5])
print '= %08x' % calculate_all(test1_vals)
-print '%08x' % calculate_one(test2_vals[0],test2_vals[3])
-print '%08x' % calculate_one(test2_vals[1],test2_vals[4])
-print '%08x' % calculate_one(test2_vals[2],test2_vals[5])
+print '%08x' % calculate_one(test2_vals[0], test2_vals[3])
+print '%08x' % calculate_one(test2_vals[1], test2_vals[4])
+print '%08x' % calculate_one(test2_vals[2], test2_vals[5])
print '= %08x' % calculate_all(test2_vals)
"""
diff --git a/tests/features/ipctest.py b/tests/features/ipctest.py
index 4417493a0ae..b64d4f86895 100755
--- a/tests/features/ipctest.py
+++ b/tests/features/ipctest.py
@@ -3,18 +3,18 @@
from __future__ import print_function
import ctypes
-api = ctypes.CDLL("libgfapi.so",mode=ctypes.RTLD_GLOBAL)
+api = ctypes.CDLL("libgfapi.so", mode=ctypes.RTLD_GLOBAL)
api.glfs_ipc.argtypes = [ ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p, ctypes.c_void_p ]
api.glfs_ipc.restype = ctypes.c_int
def do_ipc (host, volume):
fs = api.glfs_new(volume)
- #api.glfs_set_logging(fs,"/dev/stderr",7)
- api.glfs_set_volfile_server(fs,"tcp",host,24007)
+ #api.glfs_set_logging(fs, "/dev/stderr", 7)
+ api.glfs_set_volfile_server(fs, "tcp", host, 24007)
api.glfs_init(fs)
- ret = api.glfs_ipc(fs,1470369258,0,0)
+ ret = api.glfs_ipc(fs, 1470369258, 0, 0)
api.glfs_fini(fs)
return ret
diff --git a/tests/utils/gfid-access.py b/tests/utils/gfid-access.py
index 2a58bfebc4e..6d892a37b2e 100755
--- a/tests/utils/gfid-access.py
+++ b/tests/utils/gfid-access.py
@@ -64,7 +64,7 @@ if __name__ == '__main__':
ftype = sys.argv[5]
uid = int(sys.argv[6])
gid = int(sys.argv[7])
- perm = int(sys.argv[8],8)
+ perm = int(sys.argv[8], 8)
os.chdir(mtpt)
if pargfid == 'ROOT':
diff --git a/tests/utils/setfattr.py b/tests/utils/setfattr.py
index 159218d8bef..9a7daeb1be4 100755
--- a/tests/utils/setfattr.py
+++ b/tests/utils/setfattr.py
@@ -46,7 +46,7 @@ if __name__ == '__main__':
parser.add_option("-x", action="store", dest="xname", type="string",
help="Remove the named extended attribute entirely.")
- (option,args) = parser.parse_args()
+ (option, args) = parser.parse_args()
if not args:
print ("Usage: setfattr {-n name} [-v value] file...")
print (" setfattr {-x name} file...")
diff --git a/xlators/experimental/fdl/src/gen_dumper.py b/xlators/experimental/fdl/src/gen_dumper.py
index 363ba6ce63f..95313adefcc 100755
--- a/xlators/experimental/fdl/src/gen_dumper.py
+++ b/xlators/experimental/fdl/src/gen_dumper.py
@@ -67,8 +67,8 @@ def get_special_subs (args):
if (arg[0] != 'fop-arg') or (len(arg) < 4):
continue
recon_type, recon_fmt = typemap[arg[2]]
- code += fragments[recon_type].replace("@ARGNAME@",arg[3]) \
- .replace("@FORMAT@",recon_fmt)
+ code += fragments[recon_type].replace("@ARGNAME@", arg[3]) \
+ .replace("@FORMAT@", recon_fmt)
return code
def gen_functions ():
@@ -78,7 +78,7 @@ def gen_functions ():
continue
fop_subs[name]["@FUNCTION_BODY@"] = get_special_subs(value)
# Print the FOP fragment with @FUNCTION_BODY@ in the middle.
- code += generate(fragments["FOP"],name,fop_subs)
+ code += generate(fragments["FOP"], name, fop_subs)
return code
def gen_cases ():
@@ -87,7 +87,7 @@ def gen_cases ():
if "journal" not in [ x[0] for x in value ]:
continue
# Add the CASE fragment for this fop.
- code += generate(fragments["CASE"],name,fop_subs)
+ code += generate(fragments["CASE"], name, fop_subs)
return code
def load_fragments (path="recon-tmpl.c"):
@@ -95,7 +95,7 @@ def load_fragments (path="recon-tmpl.c"):
cur_symbol = None
cur_value = ""
result = {}
- for line in open(path,"r").readlines():
+ for line in open(path, "r").readlines():
m = pragma_re.search(line)
if m:
if cur_symbol:
@@ -113,5 +113,5 @@ if __name__ == "__main__":
print("/* BEGIN GENERATED CODE - DO NOT MODIFY */")
print(fragments["PROLOG"])
print(gen_functions())
- print(fragments["EPILOG"].replace("@SWITCH_BODY@",gen_cases()))
+ print(fragments["EPILOG"].replace("@SWITCH_BODY@", gen_cases()))
print("/* END GENERATED CODE */")
diff --git a/xlators/experimental/fdl/src/gen_recon.py b/xlators/experimental/fdl/src/gen_recon.py
index 69e45698703..ff5b5e16066 100755
--- a/xlators/experimental/fdl/src/gen_recon.py
+++ b/xlators/experimental/fdl/src/gen_recon.py
@@ -74,8 +74,8 @@ def get_special_subs (name, args, fop_type):
s_args.append(arg[3])
continue
if arg[0] == 'link':
- links += fragments["LINK"].replace("@INODE_ARG@",arg[1]) \
- .replace("@IATT_ARG@",arg[2])
+ links += fragments["LINK"].replace("@INODE_ARG@", arg[1]) \
+ .replace("@IATT_ARG@", arg[2])
continue
if arg[0] != 'fop-arg':
continue
@@ -98,11 +98,11 @@ def get_special_subs (name, args, fop_type):
if (name != "link") or (arg[1] != "oldloc"):
# print "/* change to PARENT_LOC */"
recon_type = "PARENT_LOC"
- code += fragments[recon_type].replace("@ARGNAME@",arg[1]) \
- .replace("@ARGTYPE@",arg[2])
+ code += fragments[recon_type].replace("@ARGNAME@", arg[1]) \
+ .replace("@ARGTYPE@", arg[2])
cleanup_key = recon_type + "_CLEANUP"
if cleanup_key in fragments:
- new_frag = fragments[cleanup_key].replace("@ARGNAME@",arg[1])
+ new_frag = fragments[cleanup_key].replace("@ARGNAME@", arg[1])
# Make sure these get added in *reverse* order. Otherwise, a
# failure for an earlier argument might goto a label that falls
# through to the cleanup code for a variable associated with a
@@ -179,7 +179,7 @@ def gen_functions ():
else:
fop_subs[name]["@SUCCESS_VALUE@"] = "GFAPI_SUCCESS"
# Print the FOP fragment with @FUNCTION_BODY@ in the middle.
- code += generate(fragments["FOP"],name,fop_subs)
+ code += generate(fragments["FOP"], name, fop_subs)
return code
def gen_cases ():
@@ -188,7 +188,7 @@ def gen_cases ():
if "journal" not in [ x[0] for x in value ]:
continue
# Add the CASE fragment for this fop.
- code += generate(fragments["CASE"],name,fop_subs)
+ code += generate(fragments["CASE"], name, fop_subs)
return code
def load_fragments (path="recon-tmpl.c"):
@@ -196,7 +196,7 @@ def load_fragments (path="recon-tmpl.c"):
cur_symbol = None
cur_value = ""
result = {}
- for line in open(path,"r").readlines():
+ for line in open(path, "r").readlines():
m = pragma_re.search(line)
if m:
if cur_symbol:
@@ -214,5 +214,5 @@ if __name__ == "__main__":
print("/* BEGIN GENERATED CODE - DO NOT MODIFY */")
print(fragments["PROLOG"])
print(gen_functions())
- print(fragments["EPILOG"].replace("@SWITCH_BODY@",gen_cases()))
+ print(fragments["EPILOG"].replace("@SWITCH_BODY@", gen_cases()))
print("/* END GENERATED CODE */")