Branch 'uidmap-management' - scripts/cloudfsd.py scripts/views

Kaleb KEITHLEY kkeithle at fedoraproject.org
Mon Jun 13 13:11:07 UTC 2011


 scripts/cloudfsd.py               |   26 +++++++++++++++++---------
 scripts/views/tenant_volumes.html |    2 +-
 scripts/views/volume_tenants.html |   32 ++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+), 10 deletions(-)

New commits:
commit 97ed9a10228b9fd92381f058a62b7c870338fdde
Author: Kaleb S. KEITHLEY <kkeithle at redhat.com>
Date:   Mon Jun 13 09:10:15 2011 -0400

    implement volumes link on the tenant management page of the Web UI

diff --git a/scripts/cloudfsd.py b/scripts/cloudfsd.py
index 145f51f..001c34a 100755
--- a/scripts/cloudfsd.py
+++ b/scripts/cloudfsd.py
@@ -70,13 +70,13 @@ def add_vol_local ():
 	vname = request.forms.get("vname")
 	return cfs_add_volume.add_local(vname)
 
- at route("volumes/:name/remove")
-def rm_volume (name):
-	return cfs_rm_volume.run_www(name)
+ at route("volumes/:vol_name/remove")
+def rm_volume (vol_name):
+	return cfs_rm_volume.run_www(vol_name)
 
- at route("/volumes/:name/rm_local")
-def rm_vol_local (name):
-	return cfs_rm_volume.rm_local(name)
+ at route("/volumes/:vol_name/rm_local")
+def rm_vol_local (vol_name):
+	return cfs_rm_volume.rm_local(vol_name)
 
 @route("/volumes/:vol_name/start")
 def start_volume(vol_name):
@@ -94,6 +94,14 @@ def stop_volume(vol_name):
 def stop_local (vol_name):
 	return cfs_stop_volume.stop_local(vol_name)
 
+ at route("/volumes/:vol_name/tenants")
+ at view("volume_tenants.html")
+def volume_tenants (vol_name):
+	db_obj = cfs_utils.open_db()
+	tenants = db_obj["vt_"+vol_name].split(",")
+	tenants.sort()
+	return dict(vol_name=vol_name,tenants=tenants,db=db_obj)
+
 # Used by mount.cloudfs
 @route("/:vol_name/fetch")
 def fetch_client_vf(vol_name):
@@ -121,9 +129,9 @@ def add_tenant_local ():
 	tn_pw = request.forms.get("tn_pw")
 	return cfs_add_tenant.add_local(tn_name,tn_pw)
 
- at route("/tenants/:name/delete")
-def delete_tenant (name):
-	return cfs_delete_tenant.run_www(name)
+ at route("/tenants/:tn_name/delete")
+def delete_tenant (tn_name):
+	return cfs_delete_tenant.run_www(tn_name)
 
 @route("/tenants/:tn_name/delete_local")
 def delete_tenant_local (tn_name):
diff --git a/scripts/views/tenant_volumes.html b/scripts/views/tenant_volumes.html
index dd4eb09..2718c70 100644
--- a/scripts/views/tenant_volumes.html
+++ b/scripts/views/tenant_volumes.html
@@ -11,7 +11,7 @@
 <h2>Volume List</h2>
 	<form method="post" action="/tenants/{{tn_name}}/enable">
 	<table cellspacing="0">
-	<tr><th>Volume Name</th><th></th></tr>
+	<tr><th>Volume Name</th><th>Enabled</th></tr>
 	%for vol in all_vols:
 		<tr>
 			<td>{{vol}}</td>
diff --git a/scripts/views/volume_tenants.html b/scripts/views/volume_tenants.html
new file mode 100644
index 0000000..aff220f
--- /dev/null
+++ b/scripts/views/volume_tenants.html
@@ -0,0 +1,32 @@
+<html><head>
+<title>_Volume {{vol_name}} Tenants_</title>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<meta http-equiv="Pragma" content="no-cache" />
+<link href="/styles/cfgmain.css" rel="stylesheet" type="text/css" />
+<link href="/styles/provlist.css" rel="stylesheet" type="text/css" />
+</head><body>
+<div class="banner">
+<h1>Volume {{vol_name}} Tenants</h1>
+</div>
+<div class="content">
+<h2>Volume {{vol_name}} Tenants:</h2>
+	<table>
+	<tr><th>Name</th><th>Password</th
+	><th>UID low</th><th>UID high</th>
+	<th>GID low</th><th>GID high</th><th></th></tr>
+	%for tn_name in tenants:
+		%tn_pw = db["tp_"+tn_name]
+		%tn_uid_low = db["tul_"+tn_name]
+		%tn_uid_high = db["tuh_"+tn_name]
+		%tn_gid_low = db["tgl_"+tn_name]
+		%tn_gid_high = db["tgh_"+tn_name]
+		<tr><td>{{tn_name}}</td><td>{{tn_pw}}</td>
+		<td>{{tn_uid_low}}</td><td>{{tn_uid_high}}</td>
+		<td>{{tn_gid_low}}</td><td>{{tn_gid_high}}</td>
+		<td><a href="/tenants/{{tn_name}}/volumes">volumes</a>
+		<a href="/tenants/{{tn_name}}/delete">delete</a></td>
+		</tr>
+	%end
+	</table>
+</div>
+</body></html>




More information about the cloudfs-devel mailing list