scripts/cfs_utils.py | 8 ++++----
scripts/cloudfsd.py | 7 ++++---
scripts/views/volumes.html | 3 ++-
3 files changed, 10 insertions(+), 8 deletions(-)
New commits:
commit 93ea5ceac3e784671fc33927c5960c5300de5daf
Author: Kaleb S. KEITHLEY <kkeithle(a)redhat.com>
Date: Thu Jun 9 12:01:14 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
diff --git a/scripts/cfs_utils.py b/scripts/cfs_utils.py
index 21db9ec..6a63dfd 100644
--- a/scripts/cfs_utils.py
+++ b/scripts/cfs_utils.py
@@ -45,8 +45,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
@@ -75,12 +75,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 d081aed..2ccef28 100755
--- a/scripts/cloudfsd.py
+++ b/scripts/cloudfsd.py
@@ -73,8 +73,9 @@ def show_volumes():
abort(401,"Forbidden")
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 ():
@@ -194,10 +195,10 @@ def show_tenant_volumes (tn_name):
abort(401,"Forbidden")
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}}">
Show replies by date