change swift config location to SWIFT_DIR/config
| ... | ... |
@@ -6,74 +6,74 @@ address = 127.0.0.1 |
| 6 | 6 |
|
| 7 | 7 |
[account6012] |
| 8 | 8 |
max connections = 25 |
| 9 |
-path = %SWIFT_LOCATION%/1/node/ |
|
| 9 |
+path = %SWIFT_DATA_LOCATION%/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_LOCATION%/2/node/ |
|
| 15 |
+path = %SWIFT_DATA_LOCATION%/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_LOCATION%/3/node/ |
|
| 21 |
+path = %SWIFT_DATA_LOCATION%/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_LOCATION%/4/node/ |
|
| 27 |
+path = %SWIFT_DATA_LOCATION%/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_LOCATION%/1/node/ |
|
| 34 |
+path = %SWIFT_DATA_LOCATION%/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_LOCATION%/2/node/ |
|
| 40 |
+path = %SWIFT_DATA_LOCATION%/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_LOCATION%/3/node/ |
|
| 46 |
+path = %SWIFT_DATA_LOCATION%/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_LOCATION%/4/node/ |
|
| 52 |
+path = %SWIFT_DATA_LOCATION%/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_LOCATION%/1/node/ |
|
| 59 |
+path = %SWIFT_DATA_LOCATION%/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_LOCATION%/2/node/ |
|
| 65 |
+path = %SWIFT_DATA_LOCATION%/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_LOCATION%/3/node/ |
|
| 71 |
+path = %SWIFT_DATA_LOCATION%/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_LOCATION%/4/node/ |
|
| 77 |
+path = %SWIFT_DATA_LOCATION%/4/node/ |
|
| 78 | 78 |
read only = false |
| 79 | 79 |
lock file = /var/lock/object6040.lock |
| ... | ... |
@@ -293,9 +293,13 @@ GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$HOST_IP:9292}
|
| 293 | 293 |
# TODO: add logging to different location. |
| 294 | 294 |
|
| 295 | 295 |
# By default the location of swift drives and objects is located inside |
| 296 |
-# the swift source directory. SWIFT_LOCATION variable allow you to redefine |
|
| 296 |
+# the swift source directory. SWIFT_DATA_LOCATION variable allow you to redefine |
|
| 297 | 297 |
# this. |
| 298 |
-SWIFT_LOCATION=${SWIFT_LOCATION:-${SWIFT_DIR}/data}
|
|
| 298 |
+SWIFT_DATA_LOCATION=${SWIFT_DATA_LOCATION:-${SWIFT_DIR}/data}
|
|
| 299 |
+ |
|
| 300 |
+# We are going to have the configuration files inside the source |
|
| 301 |
+# directory, change SWIFT_CONFIG_LOCATION if you want to adjust that. |
|
| 302 |
+SWIFT_CONFIG_LOCATION=${SWIFT_CONFIG_LOCATION:-${SWIFT_DIR}/config}
|
|
| 299 | 303 |
|
| 300 | 304 |
# devstack will create a loop-back disk formatted as XFS to store the |
| 301 | 305 |
# swift data. By default the disk size is 1 gigabyte. The variable |
| ... | ... |
@@ -644,47 +648,54 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then |
| 644 | 644 |
# changing the permissions so we can run it as our user. |
| 645 | 645 |
|
| 646 | 646 |
USER_GROUP=$(id -g) |
| 647 |
- sudo mkdir -p ${SWIFT_LOCATION}/drives
|
|
| 648 |
- sudo chown -R $USER:${USER_GROUP} ${SWIFT_LOCATION}/drives
|
|
| 647 |
+ sudo mkdir -p ${SWIFT_DATA_LOCATION}/drives
|
|
| 648 |
+ sudo chown -R $USER:${USER_GROUP} ${SWIFT_DATA_LOCATION}/drives
|
|
| 649 | 649 |
|
| 650 | 650 |
# We then create a loopback disk and format it to XFS. |
| 651 |
- if [[ ! -e ${SWIFT_LOCATION}/drives/images/swift.img ]];then
|
|
| 652 |
- mkdir -p ${SWIFT_LOCATION}/drives/images
|
|
| 653 |
- sudo touch ${SWIFT_LOCATION}/drives/images/swift.img
|
|
| 654 |
- sudo chown $USER: ${SWIFT_LOCATION}/drives/images/swift.img
|
|
| 651 |
+ if [[ ! -e ${SWIFT_DATA_LOCATION}/drives/images/swift.img ]];then
|
|
| 652 |
+ mkdir -p ${SWIFT_DATA_LOCATION}/drives/images
|
|
| 653 |
+ sudo touch ${SWIFT_DATA_LOCATION}/drives/images/swift.img
|
|
| 654 |
+ sudo chown $USER: ${SWIFT_DATA_LOCATION}/drives/images/swift.img
|
|
| 655 | 655 |
|
| 656 |
- dd if=/dev/zero of=${SWIFT_LOCATION}/drives/images/swift.img \
|
|
| 656 |
+ dd if=/dev/zero of=${SWIFT_DATA_LOCATION}/drives/images/swift.img \
|
|
| 657 | 657 |
bs=1024 count=0 seek=${SWIFT_LOOPBACK_DISK_SIZE}
|
| 658 |
- mkfs.xfs -f -i size=1024 ${SWIFT_LOCATION}/drives/images/swift.img
|
|
| 658 |
+ mkfs.xfs -f -i size=1024 ${SWIFT_DATA_LOCATION}/drives/images/swift.img
|
|
| 659 | 659 |
fi |
| 660 | 660 |
|
| 661 | 661 |
# After the drive being created we mount the disk with a few mount |
| 662 | 662 |
# options to make it most efficient as possible for swift. |
| 663 |
- mkdir -p ${SWIFT_LOCATION}/drives/sdb1
|
|
| 664 |
- if ! egrep -q ${SWIFT_LOCATION}/drives/sdb1 /proc/mounts;then
|
|
| 663 |
+ mkdir -p ${SWIFT_DATA_LOCATION}/drives/sdb1
|
|
| 664 |
+ if ! egrep -q ${SWIFT_DATA_LOCATION}/drives/sdb1 /proc/mounts;then
|
|
| 665 | 665 |
sudo mount -t xfs -o loop,noatime,nodiratime,nobarrier,logbufs=8 \ |
| 666 |
- ${SWIFT_LOCATION}/drives/images/swift.img ${SWIFT_LOCATION}/drives/sdb1
|
|
| 666 |
+ ${SWIFT_DATA_LOCATION}/drives/images/swift.img ${SWIFT_DATA_LOCATION}/drives/sdb1
|
|
| 667 | 667 |
fi |
| 668 | 668 |
|
| 669 | 669 |
# We then create link to that mounted location so swift would know |
| 670 | 670 |
# where to go. |
| 671 |
- for x in {1..4}; do sudo ln -sf ${SWIFT_LOCATION}/drives/sdb1/$x ${SWIFT_LOCATION}/$x; done
|
|
| 671 |
+ for x in {1..4}; do sudo ln -sf ${SWIFT_DATA_LOCATION}/drives/sdb1/$x ${SWIFT_DATA_LOCATION}/$x; done
|
|
| 672 | 672 |
|
| 673 | 673 |
# We now have to emulate a few different servers into one we |
| 674 | 674 |
# create all the directories needed for swift |
| 675 | 675 |
tmpd="" |
| 676 |
- for d in ${SWIFT_LOCATION}/drives/sdb1/{1..4} /etc/swift /etc/swift/{object,container,account}-server \
|
|
| 677 |
- ${SWIFT_LOCATION}/{1..4}/node/sdb1 /var/run/swift ;do
|
|
| 676 |
+ for d in ${SWIFT_DATA_LOCATION}/drives/sdb1/{1..4} \
|
|
| 677 |
+ ${SWIFT_CONFIG_LOCATION}/{object,container,account}-server \
|
|
| 678 |
+ ${SWIFT_DATA_LOCATION}/{1..4}/node/sdb1 /var/run/swift ;do
|
|
| 678 | 679 |
[[ -d $d ]] && continue |
| 679 | 680 |
sudo install -o ${USER} -g $USER_GROUP -d $d
|
| 680 | 681 |
done |
| 681 | 682 |
|
| 682 |
- sudo chown -R $USER: ${SWIFT_LOCATION}/{1..4}/node
|
|
| 683 |
+ # We do want to make sure this is all owned by our user. |
|
| 684 |
+ sudo chown -R $USER: ${SWIFT_DATA_LOCATION}/{1..4}/node
|
|
| 685 |
+ sudo chown -R $USER: ${SWIFT_CONFIG_LOCATION}
|
|
| 683 | 686 |
|
| 687 |
+ # swift-init has a bug using /etc/swift until bug #885595 is fixed |
|
| 688 |
+ # we have to create a link |
|
| 689 |
+ sudo ln -s ${SWIFT_CONFIG_LOCATION} /etc/swift
|
|
| 690 |
+ |
|
| 684 | 691 |
# Swift use rsync to syncronize between all the different |
| 685 | 692 |
# partitions (which make more sense when you have a multi-node |
| 686 | 693 |
# setup) we configure it with our version of rsync. |
| 687 |
- sed -e "s/%GROUP%/${USER_GROUP}/;s/%USER%/$USER/;s,%SWIFT_LOCATION%,$SWIFT_LOCATION," $FILES/swift/rsyncd.conf | sudo tee /etc/rsyncd.conf
|
|
| 694 |
+ 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
|
|
| 688 | 695 |
sudo sed -i '/^RSYNC_ENABLE=false/ { s/false/true/ }' /etc/default/rsync
|
| 689 | 696 |
|
| 690 | 697 |
# By default Swift will be installed with the tempauth middleware |
| ... | ... |
@@ -703,10 +714,10 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then |
| 703 | 703 |
|
| 704 | 704 |
# We do the install of the proxy-server and swift configuration |
| 705 | 705 |
# replacing a few directives to match our configuration. |
| 706 |
- sed "s/%USER%/$USER/;s/%SERVICE_TOKEN%/${SERVICE_TOKEN}/;s/%AUTH_SERVER%/${swift_auth_server}/" \
|
|
| 707 |
- $FILES/swift/proxy-server.conf|sudo tee /etc/swift/proxy-server.conf |
|
| 706 |
+ sed "s,%SWIFT_CONFIG_LOCATION%,${SWIFT_CONFIG_LOCATION},;s/%USER%/$USER/;s/%SERVICE_TOKEN%/${SERVICE_TOKEN}/;s/%AUTH_SERVER%/${swift_auth_server}/" \
|
|
| 707 |
+ $FILES/swift/proxy-server.conf|sudo tee ${SWIFT_CONFIG_LOCATION}/proxy-server.conf
|
|
| 708 | 708 |
|
| 709 |
- sed -e "s/%SWIFT_HASH%/$SWIFT_HASH/" $FILES/swift/swift.conf > /etc/swift/swift.conf |
|
| 709 |
+ sed -e "s/%SWIFT_HASH%/$SWIFT_HASH/" $FILES/swift/swift.conf > ${SWIFT_CONFIG_LOCATION}/swift.conf
|
|
| 710 | 710 |
|
| 711 | 711 |
# We need to generate a object/account/proxy configuration |
| 712 | 712 |
# emulating 4 nodes on different ports we have a little function |
| ... | ... |
@@ -718,9 +729,9 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then |
| 718 | 718 |
local node_number |
| 719 | 719 |
|
| 720 | 720 |
for node_number in {1..4};do
|
| 721 |
- node_path=${SWIFT_LOCATION}/${node_number}
|
|
| 722 |
- sed -e "s,%USER%,$USER,;s,%NODE_PATH%,${node_path},;s,%BIND_PORT%,${bind_port},;s,%LOG_FACILITY%,${log_facility}," \
|
|
| 723 |
- $FILES/swift/${server_type}-server.conf > /etc/swift/${server_type}-server/${node_number}.conf
|
|
| 721 |
+ node_path=${SWIFT_DATA_LOCATION}/${node_number}
|
|
| 722 |
+ 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}," \
|
|
| 723 |
+ $FILES/swift/${server_type}-server.conf > ${SWIFT_CONFIG_LOCATION}/${server_type}-server/${node_number}.conf
|
|
| 724 | 724 |
bind_port=$(( ${bind_port} + 10 ))
|
| 725 | 725 |
log_facility=$(( ${log_facility} + 1 ))
|
| 726 | 726 |
done |
| ... | ... |
@@ -736,7 +747,7 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then |
| 736 | 736 |
# - swift-startmain |
| 737 | 737 |
# Restart your full cluster. |
| 738 | 738 |
# |
| 739 |
- sed -e "s/%SWIFT_PARTITION_POWER_SIZE%/$SWIFT_PARTITION_POWER_SIZE/" $FILES/swift/swift-remakerings | \ |
|
| 739 |
+ sed -e "s,%SWIFT_CONFIG_LOCATION%,${SWIFT_CONFIG_LOCATION},;s/%SWIFT_PARTITION_POWER_SIZE%/$SWIFT_PARTITION_POWER_SIZE/" $FILES/swift/swift-remakerings | \
|
|
| 740 | 740 |
sudo tee /usr/local/bin/swift-remakerings |
| 741 | 741 |
sudo install -m755 $FILES/swift/swift-startmain /usr/local/bin/ |
| 742 | 742 |
sudo chmod +x /usr/local/bin/swift-* |