* change config vars _LOCATION to _DIR to be consistient with other vars
* let config files live in /etc/swift like they want to
* move swift backing files to $DEST/data/swift
Change-Id: Idbd507736b46c5c2330e0255cc87f40068d3faf6
| ... | ... |
@@ -6,74 +6,74 @@ address = 127.0.0.1 |
| 6 | 6 |
|
| 7 | 7 |
[account6012] |
| 8 | 8 |
max connections = 25 |
| 9 |
-path = %SWIFT_DATA_LOCATION%/1/node/ |
|
| 9 |
+path = %SWIFT_DATA_DIR%/1/node/ |
|
| 10 | 10 |
read only = false |
| 11 | 11 |
lock file = /var/lock/account6012.lock |
| 12 | 12 |
|
| 13 | 13 |
[account6022] |
| 14 | 14 |
max connections = 25 |
| 15 |
-path = %SWIFT_DATA_LOCATION%/2/node/ |
|
| 15 |
+path = %SWIFT_DATA_DIR%/2/node/ |
|
| 16 | 16 |
read only = false |
| 17 | 17 |
lock file = /var/lock/account6022.lock |
| 18 | 18 |
|
| 19 | 19 |
[account6032] |
| 20 | 20 |
max connections = 25 |
| 21 |
-path = %SWIFT_DATA_LOCATION%/3/node/ |
|
| 21 |
+path = %SWIFT_DATA_DIR%/3/node/ |
|
| 22 | 22 |
read only = false |
| 23 | 23 |
lock file = /var/lock/account6032.lock |
| 24 | 24 |
|
| 25 | 25 |
[account6042] |
| 26 | 26 |
max connections = 25 |
| 27 |
-path = %SWIFT_DATA_LOCATION%/4/node/ |
|
| 27 |
+path = %SWIFT_DATA_DIR%/4/node/ |
|
| 28 | 28 |
read only = false |
| 29 | 29 |
lock file = /var/lock/account6042.lock |
| 30 | 30 |
|
| 31 | 31 |
|
| 32 | 32 |
[container6011] |
| 33 | 33 |
max connections = 25 |
| 34 |
-path = %SWIFT_DATA_LOCATION%/1/node/ |
|
| 34 |
+path = %SWIFT_DATA_DIR%/1/node/ |
|
| 35 | 35 |
read only = false |
| 36 | 36 |
lock file = /var/lock/container6011.lock |
| 37 | 37 |
|
| 38 | 38 |
[container6021] |
| 39 | 39 |
max connections = 25 |
| 40 |
-path = %SWIFT_DATA_LOCATION%/2/node/ |
|
| 40 |
+path = %SWIFT_DATA_DIR%/2/node/ |
|
| 41 | 41 |
read only = false |
| 42 | 42 |
lock file = /var/lock/container6021.lock |
| 43 | 43 |
|
| 44 | 44 |
[container6031] |
| 45 | 45 |
max connections = 25 |
| 46 |
-path = %SWIFT_DATA_LOCATION%/3/node/ |
|
| 46 |
+path = %SWIFT_DATA_DIR%/3/node/ |
|
| 47 | 47 |
read only = false |
| 48 | 48 |
lock file = /var/lock/container6031.lock |
| 49 | 49 |
|
| 50 | 50 |
[container6041] |
| 51 | 51 |
max connections = 25 |
| 52 |
-path = %SWIFT_DATA_LOCATION%/4/node/ |
|
| 52 |
+path = %SWIFT_DATA_DIR%/4/node/ |
|
| 53 | 53 |
read only = false |
| 54 | 54 |
lock file = /var/lock/container6041.lock |
| 55 | 55 |
|
| 56 | 56 |
|
| 57 | 57 |
[object6010] |
| 58 | 58 |
max connections = 25 |
| 59 |
-path = %SWIFT_DATA_LOCATION%/1/node/ |
|
| 59 |
+path = %SWIFT_DATA_DIR%/1/node/ |
|
| 60 | 60 |
read only = false |
| 61 | 61 |
lock file = /var/lock/object6010.lock |
| 62 | 62 |
|
| 63 | 63 |
[object6020] |
| 64 | 64 |
max connections = 25 |
| 65 |
-path = %SWIFT_DATA_LOCATION%/2/node/ |
|
| 65 |
+path = %SWIFT_DATA_DIR%/2/node/ |
|
| 66 | 66 |
read only = false |
| 67 | 67 |
lock file = /var/lock/object6020.lock |
| 68 | 68 |
|
| 69 | 69 |
[object6030] |
| 70 | 70 |
max connections = 25 |
| 71 |
-path = %SWIFT_DATA_LOCATION%/3/node/ |
|
| 71 |
+path = %SWIFT_DATA_DIR%/3/node/ |
|
| 72 | 72 |
read only = false |
| 73 | 73 |
lock file = /var/lock/object6030.lock |
| 74 | 74 |
|
| 75 | 75 |
[object6040] |
| 76 | 76 |
max connections = 25 |
| 77 |
-path = %SWIFT_DATA_LOCATION%/4/node/ |
|
| 77 |
+path = %SWIFT_DATA_DIR%/4/node/ |
|
| 78 | 78 |
read only = false |
| 79 | 79 |
lock file = /var/lock/object6040.lock |
| ... | ... |
@@ -376,13 +376,13 @@ GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$SERVICE_HOST:9292}
|
| 376 | 376 |
# TODO: add logging to different location. |
| 377 | 377 |
|
| 378 | 378 |
# By default the location of swift drives and objects is located inside |
| 379 |
-# the swift source directory. SWIFT_DATA_LOCATION variable allow you to redefine |
|
| 379 |
+# the swift source directory. SWIFT_DATA_DIR variable allow you to redefine |
|
| 380 | 380 |
# this. |
| 381 |
-SWIFT_DATA_LOCATION=${SWIFT_DATA_LOCATION:-${SWIFT_DIR}/data}
|
|
| 381 |
+SWIFT_DATA_DIR=${SWIFT_DATA_DIR:-${DEST}/data/swift}
|
|
| 382 | 382 |
|
| 383 | 383 |
# We are going to have the configuration files inside the source |
| 384 |
-# directory, change SWIFT_CONFIG_LOCATION if you want to adjust that. |
|
| 385 |
-SWIFT_CONFIG_LOCATION=${SWIFT_CONFIG_LOCATION:-${SWIFT_DIR}/config}
|
|
| 384 |
+# directory, change SWIFT_CONFIG_DIR if you want to adjust that. |
|
| 385 |
+SWIFT_CONFIG_DIR=${SWIFT_CONFIG_DIR:-/etc/swift}
|
|
| 386 | 386 |
|
| 387 | 387 |
# devstack will create a loop-back disk formatted as XFS to store the |
| 388 | 388 |
# swift data. By default the disk size is 1 gigabyte. The variable |
| ... | ... |
@@ -1128,39 +1128,39 @@ if is_service_enabled swift; then |
| 1128 | 1128 |
# changing the permissions so we can run it as our user. |
| 1129 | 1129 |
|
| 1130 | 1130 |
USER_GROUP=$(id -g) |
| 1131 |
- sudo mkdir -p ${SWIFT_DATA_LOCATION}/drives
|
|
| 1132 |
- sudo chown -R $USER:${USER_GROUP} ${SWIFT_DATA_LOCATION}
|
|
| 1131 |
+ sudo mkdir -p ${SWIFT_DATA_DIR}/drives
|
|
| 1132 |
+ sudo chown -R $USER:${USER_GROUP} ${SWIFT_DATA_DIR}
|
|
| 1133 | 1133 |
|
| 1134 | 1134 |
# We then create a loopback disk and format it to XFS. |
| 1135 | 1135 |
# TODO: Reset disks on new pass. |
| 1136 |
- if [[ ! -e ${SWIFT_DATA_LOCATION}/drives/images/swift.img ]]; then
|
|
| 1137 |
- mkdir -p ${SWIFT_DATA_LOCATION}/drives/images
|
|
| 1138 |
- sudo touch ${SWIFT_DATA_LOCATION}/drives/images/swift.img
|
|
| 1139 |
- sudo chown $USER: ${SWIFT_DATA_LOCATION}/drives/images/swift.img
|
|
| 1136 |
+ if [[ ! -e ${SWIFT_DATA_DIR}/drives/images/swift.img ]]; then
|
|
| 1137 |
+ mkdir -p ${SWIFT_DATA_DIR}/drives/images
|
|
| 1138 |
+ sudo touch ${SWIFT_DATA_DIR}/drives/images/swift.img
|
|
| 1139 |
+ sudo chown $USER: ${SWIFT_DATA_DIR}/drives/images/swift.img
|
|
| 1140 | 1140 |
|
| 1141 |
- dd if=/dev/zero of=${SWIFT_DATA_LOCATION}/drives/images/swift.img \
|
|
| 1141 |
+ dd if=/dev/zero of=${SWIFT_DATA_DIR}/drives/images/swift.img \
|
|
| 1142 | 1142 |
bs=1024 count=0 seek=${SWIFT_LOOPBACK_DISK_SIZE}
|
| 1143 |
- mkfs.xfs -f -i size=1024 ${SWIFT_DATA_LOCATION}/drives/images/swift.img
|
|
| 1143 |
+ mkfs.xfs -f -i size=1024 ${SWIFT_DATA_DIR}/drives/images/swift.img
|
|
| 1144 | 1144 |
fi |
| 1145 | 1145 |
|
| 1146 | 1146 |
# After the drive being created we mount the disk with a few mount |
| 1147 | 1147 |
# options to make it most efficient as possible for swift. |
| 1148 |
- mkdir -p ${SWIFT_DATA_LOCATION}/drives/sdb1
|
|
| 1149 |
- if ! egrep -q ${SWIFT_DATA_LOCATION}/drives/sdb1 /proc/mounts; then
|
|
| 1148 |
+ mkdir -p ${SWIFT_DATA_DIR}/drives/sdb1
|
|
| 1149 |
+ if ! egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then
|
|
| 1150 | 1150 |
sudo mount -t xfs -o loop,noatime,nodiratime,nobarrier,logbufs=8 \ |
| 1151 |
- ${SWIFT_DATA_LOCATION}/drives/images/swift.img ${SWIFT_DATA_LOCATION}/drives/sdb1
|
|
| 1151 |
+ ${SWIFT_DATA_DIR}/drives/images/swift.img ${SWIFT_DATA_DIR}/drives/sdb1
|
|
| 1152 | 1152 |
fi |
| 1153 | 1153 |
|
| 1154 | 1154 |
# We then create link to that mounted location so swift would know |
| 1155 | 1155 |
# where to go. |
| 1156 | 1156 |
for x in $(seq ${SWIFT_REPLICAS}); do
|
| 1157 |
- sudo ln -sf ${SWIFT_DATA_LOCATION}/drives/sdb1/$x ${SWIFT_DATA_LOCATION}/$x; done
|
|
| 1157 |
+ sudo ln -sf ${SWIFT_DATA_DIR}/drives/sdb1/$x ${SWIFT_DATA_DIR}/$x; done
|
|
| 1158 | 1158 |
|
| 1159 | 1159 |
# We now have to emulate a few different servers into one we |
| 1160 | 1160 |
# create all the directories needed for swift |
| 1161 | 1161 |
for x in $(seq ${SWIFT_REPLICAS}); do
|
| 1162 |
- drive=${SWIFT_DATA_LOCATION}/drives/sdb1/${x}
|
|
| 1163 |
- node=${SWIFT_DATA_LOCATION}/${x}/node
|
|
| 1162 |
+ drive=${SWIFT_DATA_DIR}/drives/sdb1/${x}
|
|
| 1163 |
+ node=${SWIFT_DATA_DIR}/${x}/node
|
|
| 1164 | 1164 |
node_device=${node}/sdb1
|
| 1165 | 1165 |
[[ -d $node ]] && continue |
| 1166 | 1166 |
[[ -d $drive ]] && continue |
| ... | ... |
@@ -1169,17 +1169,23 @@ if is_service_enabled swift; then |
| 1169 | 1169 |
sudo chown -R $USER: ${node}
|
| 1170 | 1170 |
done |
| 1171 | 1171 |
|
| 1172 |
- sudo mkdir -p ${SWIFT_CONFIG_LOCATION}/{object,container,account}-server /var/run/swift
|
|
| 1173 |
- sudo chown -R $USER: ${SWIFT_CONFIG_LOCATION} /var/run/swift
|
|
| 1172 |
+ sudo mkdir -p ${SWIFT_CONFIG_DIR}/{object,container,account}-server /var/run/swift
|
|
| 1173 |
+ sudo chown -R $USER: ${SWIFT_CONFIG_DIR} /var/run/swift
|
|
| 1174 | 1174 |
|
| 1175 |
- # swift-init has a bug using /etc/swift until bug #885595 is fixed |
|
| 1176 |
- # we have to create a link |
|
| 1177 |
- sudo ln -sf ${SWIFT_CONFIG_LOCATION} /etc/swift
|
|
| 1175 |
+ if [[ "$SWIFT_CONFIG_DIR" != "/etc/swift" ]]; then |
|
| 1176 |
+ # Some swift tools are hard-coded to use /etc/swift and are apparenty not going to be fixed. |
|
| 1177 |
+ # Create a symlink if the config dir is moved |
|
| 1178 |
+ sudo ln -sf ${SWIFT_CONFIG_DIR} /etc/swift
|
|
| 1179 |
+ fi |
|
| 1178 | 1180 |
|
| 1179 |
- # Swift use rsync to syncronize between all the different |
|
| 1180 |
- # partitions (which make more sense when you have a multi-node |
|
| 1181 |
- # setup) we configure it with our version of rsync. |
|
| 1182 |
- sed -e "s/%GROUP%/${USER_GROUP}/;s/%USER%/$USER/;s,%SWIFT_DATA_LOCATION%,$SWIFT_DATA_LOCATION," $FILES/swift/rsyncd.conf | sudo tee /etc/rsyncd.conf
|
|
| 1181 |
+ # Swift use rsync to syncronize between all the different |
|
| 1182 |
+ # partitions (which make more sense when you have a multi-node |
|
| 1183 |
+ # setup) we configure it with our version of rsync. |
|
| 1184 |
+ sed -e " |
|
| 1185 |
+ s/%GROUP%/${USER_GROUP}/;
|
|
| 1186 |
+ s/%USER%/$USER/; |
|
| 1187 |
+ s,%SWIFT_DATA_DIR%,$SWIFT_DATA_DIR,; |
|
| 1188 |
+ " $FILES/swift/rsyncd.conf | sudo tee /etc/rsyncd.conf |
|
| 1183 | 1189 |
sudo sed -i '/^RSYNC_ENABLE=false/ { s/false/true/ }' /etc/default/rsync
|
| 1184 | 1190 |
|
| 1185 | 1191 |
# By default Swift will be installed with the tempauth middleware |
| ... | ... |
@@ -1194,7 +1200,7 @@ if is_service_enabled swift; then |
| 1194 | 1194 |
# We do the install of the proxy-server and swift configuration |
| 1195 | 1195 |
# replacing a few directives to match our configuration. |
| 1196 | 1196 |
sed -e " |
| 1197 |
- s,%SWIFT_CONFIG_LOCATION%,${SWIFT_CONFIG_LOCATION},g;
|
|
| 1197 |
+ s,%SWIFT_CONFIG_DIR%,${SWIFT_CONFIG_DIR},g;
|
|
| 1198 | 1198 |
s,%USER%,$USER,g; |
| 1199 | 1199 |
s,%SERVICE_TENANT_NAME%,$SERVICE_TENANT_NAME,g; |
| 1200 | 1200 |
s,%SERVICE_USERNAME%,swift,g; |
| ... | ... |
@@ -1209,35 +1215,40 @@ if is_service_enabled swift; then |
| 1209 | 1209 |
s,%KEYSTONE_AUTH_PROTOCOL%,${KEYSTONE_AUTH_PROTOCOL},g;
|
| 1210 | 1210 |
s/%AUTH_SERVER%/${swift_auth_server}/g;
|
| 1211 | 1211 |
" $FILES/swift/proxy-server.conf | \ |
| 1212 |
- sudo tee ${SWIFT_CONFIG_LOCATION}/proxy-server.conf
|
|
| 1213 |
- |
|
| 1214 |
- sed -e "s/%SWIFT_HASH%/$SWIFT_HASH/" $FILES/swift/swift.conf > ${SWIFT_CONFIG_LOCATION}/swift.conf
|
|
| 1215 |
- |
|
| 1216 |
- # We need to generate a object/account/proxy configuration |
|
| 1217 |
- # emulating 4 nodes on different ports we have a little function |
|
| 1218 |
- # that help us doing that. |
|
| 1219 |
- function generate_swift_configuration() {
|
|
| 1220 |
- local server_type=$1 |
|
| 1221 |
- local bind_port=$2 |
|
| 1222 |
- local log_facility=$3 |
|
| 1223 |
- local node_number |
|
| 1224 |
- |
|
| 1225 |
- for node_number in $(seq ${SWIFT_REPLICAS}); do
|
|
| 1226 |
- node_path=${SWIFT_DATA_LOCATION}/${node_number}
|
|
| 1227 |
- sed -e "s,%SWIFT_CONFIG_LOCATION%,${SWIFT_CONFIG_LOCATION},;s,%USER%,$USER,;s,%NODE_PATH%,${node_path},;s,%BIND_PORT%,${bind_port},;s,%LOG_FACILITY%,${log_facility}," \
|
|
| 1228 |
- $FILES/swift/${server_type}-server.conf > ${SWIFT_CONFIG_LOCATION}/${server_type}-server/${node_number}.conf
|
|
| 1229 |
- bind_port=$(( ${bind_port} + 10 ))
|
|
| 1230 |
- log_facility=$(( ${log_facility} + 1 ))
|
|
| 1231 |
- done |
|
| 1232 |
- } |
|
| 1233 |
- generate_swift_configuration object 6010 2 |
|
| 1234 |
- generate_swift_configuration container 6011 2 |
|
| 1235 |
- generate_swift_configuration account 6012 2 |
|
| 1212 |
+ sudo tee ${SWIFT_CONFIG_DIR}/proxy-server.conf
|
|
| 1213 |
+ |
|
| 1214 |
+ sed -e "s/%SWIFT_HASH%/$SWIFT_HASH/" $FILES/swift/swift.conf > ${SWIFT_CONFIG_DIR}/swift.conf
|
|
| 1215 |
+ |
|
| 1216 |
+ # We need to generate a object/account/proxy configuration |
|
| 1217 |
+ # emulating 4 nodes on different ports we have a little function |
|
| 1218 |
+ # that help us doing that. |
|
| 1219 |
+ function generate_swift_configuration() {
|
|
| 1220 |
+ local server_type=$1 |
|
| 1221 |
+ local bind_port=$2 |
|
| 1222 |
+ local log_facility=$3 |
|
| 1223 |
+ local node_number |
|
| 1224 |
+ |
|
| 1225 |
+ for node_number in $(seq ${SWIFT_REPLICAS}); do
|
|
| 1226 |
+ node_path=${SWIFT_DATA_DIR}/${node_number}
|
|
| 1227 |
+ sed -e " |
|
| 1228 |
+ s,%SWIFT_CONFIG_DIR%,${SWIFT_CONFIG_DIR},;
|
|
| 1229 |
+ s,%USER%,$USER,; |
|
| 1230 |
+ s,%NODE_PATH%,${node_path},;
|
|
| 1231 |
+ s,%BIND_PORT%,${bind_port},;
|
|
| 1232 |
+ s,%LOG_FACILITY%,${log_facility},
|
|
| 1233 |
+ " $FILES/swift/${server_type}-server.conf > ${SWIFT_CONFIG_DIR}/${server_type}-server/${node_number}.conf
|
|
| 1234 |
+ bind_port=$(( ${bind_port} + 10 ))
|
|
| 1235 |
+ log_facility=$(( ${log_facility} + 1 ))
|
|
| 1236 |
+ done |
|
| 1237 |
+ } |
|
| 1238 |
+ generate_swift_configuration object 6010 2 |
|
| 1239 |
+ generate_swift_configuration container 6011 2 |
|
| 1240 |
+ generate_swift_configuration account 6012 2 |
|
| 1236 | 1241 |
|
| 1237 | 1242 |
|
| 1238 | 1243 |
# We have some specific configuration for swift for rsyslog. See |
| 1239 | 1244 |
# the file /etc/rsyslog.d/10-swift.conf for more info. |
| 1240 |
- swift_log_dir=${SWIFT_DATA_LOCATION}/logs
|
|
| 1245 |
+ swift_log_dir=${SWIFT_DATA_DIR}/logs
|
|
| 1241 | 1246 |
rm -rf ${swift_log_dir}
|
| 1242 | 1247 |
mkdir -p ${swift_log_dir}/hourly
|
| 1243 | 1248 |
sudo chown -R syslog:adm ${swift_log_dir}
|
| ... | ... |
@@ -1247,7 +1258,7 @@ if is_service_enabled swift; then |
| 1247 | 1247 |
|
| 1248 | 1248 |
# This is where we create three different rings for swift with |
| 1249 | 1249 |
# different object servers binding on different ports. |
| 1250 |
- pushd ${SWIFT_CONFIG_LOCATION} >/dev/null && {
|
|
| 1250 |
+ pushd ${SWIFT_CONFIG_DIR} >/dev/null && {
|
|
| 1251 | 1251 |
|
| 1252 | 1252 |
rm -f *.builder *.ring.gz backups/*.builder backups/*.ring.gz |
| 1253 | 1253 |
|
| ... | ... |
@@ -1619,7 +1630,7 @@ screen_it n-novnc "cd $NOVNC_DIR && ./utils/nova-novncproxy --config-file $NOVA_ |
| 1619 | 1619 |
screen_it n-xvnc "cd $NOVA_DIR && ./bin/nova-xvpvncproxy --config-file $NOVA_CONF_DIR/$NOVA_CONF" |
| 1620 | 1620 |
screen_it n-cauth "cd $NOVA_DIR && ./bin/nova-consoleauth" |
| 1621 | 1621 |
screen_it horizon "cd $HORIZON_DIR && sudo tail -f /var/log/apache2/error.log" |
| 1622 |
-screen_it swift "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-proxy-server ${SWIFT_CONFIG_LOCATION}/proxy-server.conf -v"
|
|
| 1622 |
+screen_it swift "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-proxy-server ${SWIFT_CONFIG_DIR}/proxy-server.conf -v"
|
|
| 1623 | 1623 |
|
| 1624 | 1624 |
# Starting the nova-objectstore only if swift service is not enabled. |
| 1625 | 1625 |
# Swift will act as s3 objectstore. |