https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113842
Revision: 113842
Author: laner
Date: 2012-03-14 20:30:05 +0000 (Wed, 14 Mar 2012)
Log Message:
-----------
Adding a config option to manually add IP addresses to gluster access lists on
volumes
Modified Paths:
--------------
trunk/tools/subversion/user-management/manage-volumes
Modified: trunk/tools/subversion/user-management/manage-volumes
===================================================================
--- trunk/tools/subversion/user-management/manage-volumes 2012-03-14
20:29:25 UTC (rev 113841)
+++ trunk/tools/subversion/user-management/manage-volumes 2012-03-14
20:30:05 UTC (rev 113842)
@@ -21,6 +21,9 @@
# Volumes in projects listed as global; so: { 'dumps': ['xml']
} would be
# an xml share in the dumps project being listed as global.
self.global_shares = {'publicdata': ['project']}
+ # Volumes which need to have hosts manually added to the
gluster access list; so, { 'dumps':
+ # { 'project': ['10.0.0.1'] } } would manually add 10.0.0.1 to
the dumps-project access list
+ self.manual_shares = {'publicdata': {'project':
['208.80.154.11']}}
self.volume_quotas = {'home': '50GB','default': '300GB'}
self.default_options = ['nfs.disable on']
self.bricks = ['labstore1.pmtpa.wmnet',
'labstore2.pmtpa.wmnet', 'labstore3.pmtpa.wmnet', 'labstore4.pmtpa.wmnet']
@@ -65,6 +68,9 @@
hosts = project_hosts[project_name]
hosts.sort()
for volume_name in self.volume_names:
+ volume_hosts = hosts
+ if project_name in self.manual_shares and
volume_name in self.manual_shares[project_name]:
+
volume_hosts.extend(self.manual_shares[project_name][volume_name])
project_volume = project_name + '-' +
volume_name
if project_volume not in project_volumes:
# First, make the volume directories.
This function runs on all
@@ -82,25 +88,25 @@
continue
else:
continue
- volume_hosts = []
+ gluster_hosts = []
if project_volume in project_volumes and
'auth.allow' in project_volumes[project_volume]:
- volume_hosts =
project_volumes[project_volume]['auth.allow']
- volume_hosts.sort()
+ gluster_hosts =
project_volumes[project_volume]['auth.allow']
+ gluster_hosts.sort()
if project_name in self.global_shares and
volume_name in self.global_shares[project_name]:
# This is a global share
# A host has been added or deleted,
modify the auth.allow
- volume_nfs_hosts = ''
+ gluster_nfs_hosts = ''
if project_volume in project_volumes
and 'nfs.rpc-auth-allow' in project_volumes[project_volume]:
- volume_nfs_hosts =
project_volumes[project_volume]['nfs.rpc-auth-allow']
- if volume_nfs_hosts != '*':
+ gluster_nfs_hosts =
project_volumes[project_volume]['nfs.rpc-auth-allow']
+ if gluster_nfs_hosts != '*':
self.setglobal(project_name,volume_name)
- if hosts:
- if volume_hosts != hosts:
-
self.setallow(project_name,volume_name,hosts)
+ if volume_hosts:
+ if gluster_hosts != volume_hosts:
+
self.setallow(project_name,volume_name,volume_hosts)
else:
# All hosts have been deleted, or none
have been created, ensure we
# aren't sharing to anything
- if volume_hosts != []:
+ if gluster_hosts != []:
self.setallow(project_name,volume_name,[])
# TODO: Unshare and stop deleted projects
ds.unbind()
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs