r113842 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113841‎ | r113842 | r113843 >
Date:20:30, 14 March 2012
Author:laner
Status:new
Tags:
Comment:
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) (history)

Diff [purge]

Index: trunk/tools/subversion/user-management/manage-volumes
@@ -21,6 +21,9 @@
2222 # Volumes in projects listed as global; so: { 'dumps': ['xml'] } would be
2323 # an xml share in the dumps project being listed as global.
2424 self.global_shares = {'publicdata': ['project']}
 25+ # Volumes which need to have hosts manually added to the gluster access list; so, { 'dumps':
 26+ # { 'project': ['10.0.0.1'] } } would manually add 10.0.0.1 to the dumps-project access list
 27+ self.manual_shares = {'publicdata': {'project': ['208.80.154.11']}}
2528 self.volume_quotas = {'home': '50GB','default': '300GB'}
2629 self.default_options = ['nfs.disable on']
2730 self.bricks = ['labstore1.pmtpa.wmnet', 'labstore2.pmtpa.wmnet', 'labstore3.pmtpa.wmnet', 'labstore4.pmtpa.wmnet']
@@ -65,6 +68,9 @@
6669 hosts = project_hosts[project_name]
6770 hosts.sort()
6871 for volume_name in self.volume_names:
 72+ volume_hosts = hosts
 73+ if project_name in self.manual_shares and volume_name in self.manual_shares[project_name]:
 74+ volume_hosts.extend(self.manual_shares[project_name][volume_name])
6975 project_volume = project_name + '-' + volume_name
7076 if project_volume not in project_volumes:
7177 # First, make the volume directories. This function runs on all
@@ -82,25 +88,25 @@
8389 continue
8490 else:
8591 continue
86 - volume_hosts = []
 92+ gluster_hosts = []
8793 if project_volume in project_volumes and 'auth.allow' in project_volumes[project_volume]:
88 - volume_hosts = project_volumes[project_volume]['auth.allow']
89 - volume_hosts.sort()
 94+ gluster_hosts = project_volumes[project_volume]['auth.allow']
 95+ gluster_hosts.sort()
9096 if project_name in self.global_shares and volume_name in self.global_shares[project_name]:
9197 # This is a global share
9298 # A host has been added or deleted, modify the auth.allow
93 - volume_nfs_hosts = ''
 99+ gluster_nfs_hosts = ''
94100 if project_volume in project_volumes and 'nfs.rpc-auth-allow' in project_volumes[project_volume]:
95 - volume_nfs_hosts = project_volumes[project_volume]['nfs.rpc-auth-allow']
96 - if volume_nfs_hosts != '*':
 101+ gluster_nfs_hosts = project_volumes[project_volume]['nfs.rpc-auth-allow']
 102+ if gluster_nfs_hosts != '*':
97103 self.setglobal(project_name,volume_name)
98 - if hosts:
99 - if volume_hosts != hosts:
100 - self.setallow(project_name,volume_name,hosts)
 104+ if volume_hosts:
 105+ if gluster_hosts != volume_hosts:
 106+ self.setallow(project_name,volume_name,volume_hosts)
101107 else:
102108 # All hosts have been deleted, or none have been created, ensure we
103109 # aren't sharing to anything
104 - if volume_hosts != []:
 110+ if gluster_hosts != []:
105111 self.setallow(project_name,volume_name,[])
106112 # TODO: Unshare and stop deleted projects
107113 ds.unbind()

Status & tagging log