Commit 98eefa9a authored by Łukasz Nowak's avatar Łukasz Nowak

Prepare tidstorage configuration.

In order to stabilise it zodb path has to be calculated early.
parent cca1a120
...@@ -54,6 +54,7 @@ class Recipe(GenericSlapRecipe): ...@@ -54,6 +54,7 @@ class Recipe(GenericSlapRecipe):
part_list = [] part_list = []
zope_dict = {} zope_dict = {}
zope_connection_dict = {} zope_connection_dict = {}
known_tid_storage_identifier_dict = {}
snippet_zeo = open(self.options['snippet-zeo']).read() snippet_zeo = open(self.options['snippet-zeo']).read()
for zeo_id, zeo_configuration_list in json_data['zeo'].iteritems(): for zeo_id, zeo_configuration_list in json_data['zeo'].iteritems():
storage_list = [] storage_list = []
...@@ -66,7 +67,13 @@ class Recipe(GenericSlapRecipe): ...@@ -66,7 +67,13 @@ class Recipe(GenericSlapRecipe):
'storage-name': zeo_slave['storage-name'], 'storage-name': zeo_slave['storage-name'],
'server': '${zeo-instance-%(zeo-id)s:ip}:${zeo-instance-%(zeo-id)s:port}' % {'zeo-id': zeo_id} 'server': '${zeo-instance-%(zeo-id)s:ip}:${zeo-instance-%(zeo-id)s:port}' % {'zeo-id': zeo_id}
} }
a(' storage-name=%(storage-name)s zodb-name=%(zodb-name)s' % zeo_slave) zodb_path = os.path.join('${directory:zodb}', zeo_slave['storage-name'] + '.fs')
a(' storage-name=%(storage-name)s zodb-path=%(zodb-path)s' % {'zodb-path': zodb_path, 'storage-name': zeo_slave['storage-name']})
known_tid_storage_identifier_dict[
"((('%(ip)s', %(port)s),), '%(storage_name)s')" % dict(
ip='${zeo-instance-%(zeo-id)s:ip}',
port='${zeo-instance-%(zeo-id)s:port}',
storage_name=zeo_slave['storage-name'])] = (zodb_path, '${directory:zodb-backup}/%s/' % zeo_slave['storage-name'], zeo_slave['serialize-path'] % {'site-id': site_id})
current_zeo_port += 1 current_zeo_port += 1
output += snippet_zeo % dict( output += snippet_zeo % dict(
zeo_id=zeo_id, zeo_id=zeo_id,
......
...@@ -65,11 +65,10 @@ class Recipe(GenericBaseRecipe): ...@@ -65,11 +65,10 @@ class Recipe(GenericBaseRecipe):
for q in storage_definition.split(): for q in storage_definition.split():
if 'storage-name' in q: if 'storage-name' in q:
storage_name = q.split('=')[1].strip() storage_name = q.split('=')[1].strip()
if 'zodb-name' in q: if 'zodb-path' in q:
zodb_name = q.split('=')[1].strip() zodb_path = q.split('=')[1].strip()
storage_path = os.path.join(zodb_directory_path, '%s.fs' % zodb_name)
filestorage_snippet += self.substituteTemplate( filestorage_snippet += self.substituteTemplate(
snippet_filename, dict(storage_name=storage_name, path=storage_path)) snippet_filename, dict(storage_name=storage_name, path=zodb_path))
config = dict( config = dict(
zeo_ip=self.options['ip'], zeo_ip=self.options['ip'],
......
...@@ -74,7 +74,6 @@ create = true ...@@ -74,7 +74,6 @@ create = true
[zeo-instance-entry-common] [zeo-instance-entry-common]
recipe = slapos.cookbook:zeo recipe = slapos.cookbook:zeo
zodb-path = $${directory:zodb}
ip = $${slap-network-information:local-ipv4} ip = $${slap-network-information:local-ipv4}
binary-path = ${buildout:bin-directory}/runzeo binary-path = ${buildout:bin-directory}/runzeo
...@@ -115,6 +114,7 @@ backup = $${rootdirectory:srv}/backup/ ...@@ -115,6 +114,7 @@ backup = $${rootdirectory:srv}/backup/
[directory] [directory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
zodb = $${rootdirectory:srv}/zodb/ zodb = $${rootdirectory:srv}/zodb/
zodb-backup = $${basedirectory:backup}/zodb
instance = $${rootdirectory:srv}/erp5shared/ instance = $${rootdirectory:srv}/erp5shared/
instance-etc = $${:instance}/etc instance-etc = $${:instance}/etc
apache-conf = $${rootdirectory:etc}/apache apache-conf = $${rootdirectory:etc}/apache
......
...@@ -88,7 +88,7 @@ mode = 0644 ...@@ -88,7 +88,7 @@ mode = 0644
[template-snippet-master] [template-snippet-master]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/snippet-master.cfg url = ${:_profile_base_location_}/snippet-master.cfg
md5sum = c14f7eecea2603f53f1dd6e640ee671b md5sum = 4061555651d15cd050f4e00736877a33
output = ${buildout:directory}/template-snippet-master.cfg output = ${buildout:directory}/template-snippet-master.cfg
mode = 0644 mode = 0644
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment