Branch 'uidmap' - scripts/cfs_utils.py scripts/cloudfsd.py scripts/views
Kaleb KEITHLEY
kkeithle at fedoraproject.org
Thu Jun 9 17:37:08 UTC 2011
scripts/cfs_utils.py | 8 ++++----
scripts/cloudfsd.py | 7 ++++---
scripts/views/volumes.html | 3 ++-
3 files changed, 10 insertions(+), 8 deletions(-)
New commits:
commit c15711dcd84f5365bb4dfeb687df1766eef6b696
Author: Kaleb S. KEITHLEY <kkeithle at cloudfs-node01.kkeithle.redhat.com>
Date: Thu Jun 9 11:52:45 2011 -0400
fix nit issues in the UI in preparation for adding UI to specify uid/gid
ranges per tenant.
cfs_utils.py: fix use_sudo (fmt string); don't make_remote when host
is local; use IP addr for localhost's name like all other nodes,;sort
node_list, maybe just (semantic) sugar, but will be nice for long
lists of nodes and mounts
cloudfsd.py: glue between cfs_utils sorted node list and printing
nodes-and-mounts in sorted order
views/volumes.html: utilize sorted node_list to print nodes-and-mounts
in order
This commit matches 93ea5ceac3e784671fc33927c5960c5300de5daf on the
cloudfsd branch. I wanted/tried to just rebase from cloudfsd branch, but
the diff was huge. Didn't see the point in that (because mostly I think
we're merging to master), but may have to do it eventually anyway. Or
alternatively I could have merged these changes from cloudfsd but similarly
didn't see the point for ~10 lines of changes
diff --git a/scripts/cfs_utils.py b/scripts/cfs_utils.py
index 39a36e0..ed6c6c4 100644
--- a/scripts/cfs_utils.py
+++ b/scripts/cfs_utils.py
@@ -40,8 +40,8 @@ def run_cmd (program, args, host=None, filters=[]):
for prog2, args2 in filters:
cmd = "%s | %s %s" % (cmd, get_path(prog2), args2)
if use_sudo:
- cmd = "%s %s" % cmd
- if host:
+ cmd = "sudo %s" % cmd
+ if host and host not in local_addrs:
cmd = make_remote(host,cmd)
if len(filters):
#print "executing %s using shell" % cmd
@@ -70,12 +70,12 @@ for line in run_cmd("ip","addr").stdout:
def get_members ():
peer_ips = run_cmd("gluster","peer status",
filters=[("grep","Hostname:")]).stdout
- my_ip = socket.gethostbyname(socket.gethostname())
- node_list = [socket.gethostbyaddr(my_ip)[0]]
+ node_list = [socket.gethostbyname(socket.gethostname())]
# For each line: strip off the trailing newline, split at colon, take
# item #1
for peer in [line[:-1].split(": ")[1] for line in peer_ips]:
node_list.append(peer)
+ node_list.sort()
return node_list
# A brick list looks something like this:
diff --git a/scripts/cloudfsd.py b/scripts/cloudfsd.py
index 8255a44..145f51f 100755
--- a/scripts/cloudfsd.py
+++ b/scripts/cloudfsd.py
@@ -48,8 +48,9 @@ def add_node():
def show_volumes():
brick_list = cfs_utils.get_bricks()
mount_list = cfs_utils.get_mounts(brick_list)
+ node_list = cfs_utils.get_members()
# TBD: allow adding arbitrary directories instead of just mountpoints
- return dict(bricks=brick_list,mounts=mount_list)
+ return dict(bricks=brick_list,mounts=mount_list,nodes=node_list)
@post("/volumes/add_directory")
def add_directory ():
@@ -133,10 +134,10 @@ def delete_tenant_local (tn_name):
def show_tenant_volumes (tn_name):
db_obj = cfs_utils.open_db()
all_vols = [v[3:] for v in db_obj.keys() if v.startswith("vt_")]
- print all_vols
+ # print all_vols
active = db_obj["tv_"+tn_name].split(",")
active.sort()
- print active
+ # print active
return dict(tn_name=tn_name,all_vols=all_vols,active=active)
@post("/tenants/:tn_name/enable")
diff --git a/scripts/views/volumes.html b/scripts/views/volumes.html
index cc54f92..12ef314 100644
--- a/scripts/views/volumes.html
+++ b/scripts/views/volumes.html
@@ -40,7 +40,8 @@
<form method="post" name="provision" action="/volumes/add_volume">
<table>
%color_index = 0
- %for node, mount_list in mounts.iteritems():
+ %for node in nodes:
+ %mount_list = mounts[node]
%color = "d%d" % color_index
%color_index = (color_index + 1) % 2
<tr class="{{color}}">
More information about the cloudfs-devel
mailing list