Skip to content

Commit

Permalink
Save ring serialized
Browse files Browse the repository at this point in the history
  • Loading branch information
JoanBoronat committed Nov 17, 2017
1 parent b2e0735 commit 3b9d1ff
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/swift_api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,15 @@ def deploy_storage_policy(request, storage_policy_id):
try:
tmp_policy_file = get_policy_file_path(settings.SWIFT_CFG_TMP_DIR, storage_policy_id)
deploy_policy_file = get_policy_file_path(settings.SWIFT_CFG_DEPLOY_DIR, storage_policy_id)
deploy_gzip_filename = deploy_policy_file.replace('builder', 'ring.gz')

ring = RingBuilder.load(tmp_policy_file)
ring.rebalance()
ring.save(tmp_policy_file)

ringdata = ring.get_ring()
ringdata.save(deploy_gzip_filename)

data = r.hgetall(key)
update_sp_files(settings.SWIFT_CFG_DEPLOY_DIR, storage_policy_id, {'name': data['name'],
'deprecated': data['deprecated'],
Expand Down

0 comments on commit 3b9d1ff

Please sign in to comment.