From d03915f9c08ff91c5d39f8cadb064718079bdb4b Mon Sep 17 00:00:00 2001
From: Daisuke Morita <morita.daisuke@lab.ntt.co.jp>
Date: Wed, 8 Oct 2014 06:52:21 +0000
Subject: [PATCH] Enable Swift's newer feature of container-sync

Newer version of container-sync feature is introduced in Swift ver. 1.12.0.

The spec:
http://docs.openstack.org/developer/swift/overview_container_sync.html

Before this commit, Devstack does not configure any realm used in
container-sync, therefore this feature does not work.
To test this feature in CI system, moreover to show the sample
configuration of realms, Devstack now edits realms configuration file.

Change-Id: I9f1e3224403e08e725a989162729470357fe90b0
Closes-Bug: 1378646
---
 lib/swift | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/swift b/lib/swift
index 21ed920149..d8c790a201 100644
--- a/lib/swift
+++ b/lib/swift
@@ -330,7 +330,12 @@ function configure_swift {
     SWIFT_CONFIG_PROXY_SERVER=${SWIFT_CONF_DIR}/proxy-server.conf
     cp ${SWIFT_DIR}/etc/proxy-server.conf-sample ${SWIFT_CONFIG_PROXY_SERVER}
 
-    cp ${SWIFT_DIR}/etc/container-sync-realms.conf-sample ${SWIFT_CONF_DIR}/container-sync-realms.conf
+    # To run container sync feature introduced in Swift ver 1.12.0,
+    # container sync "realm" is added in container-sync-realms.conf
+    local csyncfile=${SWIFT_CONF_DIR}/container-sync-realms.conf
+    cp ${SWIFT_DIR}/etc/container-sync-realms.conf-sample ${csyncfile}
+    iniset ${csyncfile} realm1 key realm1key
+    iniset ${csyncfile} realm1 cluster_name1 "$SWIFT_SERVICE_PROTOCOL://$SERVICE_HOST:8080/v1/"
 
     iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT user
     iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT user ${STACK_USER}