Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 1 | # lib/swift |
Dean Troyer | 6d04fd7 | 2012-12-21 11:03:37 -0600 | [diff] [blame] | 2 | # Functions to control the configuration and operation of the **Swift** service |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 3 | |
| 4 | # Dependencies: |
Adam Spiers | 6a5aa7c | 2013-10-24 11:27:02 +0100 | [diff] [blame] | 5 | # |
| 6 | # - ``functions`` file |
| 7 | # - ``apache`` file |
| 8 | # - ``DEST``, ``SCREEN_NAME``, `SWIFT_HASH` must be defined |
| 9 | # - ``STACK_USER`` must be defined |
| 10 | # - ``SWIFT_DATA_DIR`` or ``DATA_DIR`` must be defined |
| 11 | # - ``lib/keystone`` file |
| 12 | # |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 13 | # ``stack.sh`` calls the entry points in this order: |
| 14 | # |
Adam Spiers | 6a5aa7c | 2013-10-24 11:27:02 +0100 | [diff] [blame] | 15 | # - install_swift |
| 16 | # - _config_swift_apache_wsgi |
| 17 | # - configure_swift |
| 18 | # - init_swift |
| 19 | # - start_swift |
| 20 | # - stop_swift |
| 21 | # - cleanup_swift |
| 22 | # - _cleanup_swift_apache_wsgi |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 23 | |
| 24 | # Save trace setting |
| 25 | XTRACE=$(set +o | grep xtrace) |
| 26 | set +o xtrace |
| 27 | |
| 28 | |
| 29 | # Defaults |
| 30 | # -------- |
| 31 | |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 32 | # Set up default directories |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 33 | SWIFT_DIR=$DEST/swift |
| 34 | SWIFTCLIENT_DIR=$DEST/python-swiftclient |
Dean Troyer | 64ab774 | 2012-12-28 15:38:28 -0600 | [diff] [blame] | 35 | SWIFT_AUTH_CACHE_DIR=${SWIFT_AUTH_CACHE_DIR:-/var/cache/swift} |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 36 | SWIFT_APACHE_WSGI_DIR=${SWIFT_APACHE_WSGI_DIR:-/var/www/swift} |
Dean Troyer | b7490da | 2013-03-18 16:07:56 -0500 | [diff] [blame] | 37 | SWIFT3_DIR=$DEST/swift3 |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 38 | |
| 39 | # TODO: add logging to different location. |
| 40 | |
| 41 | # Set ``SWIFT_DATA_DIR`` to the location of swift drives and objects. |
| 42 | # Default is the common DevStack data directory. |
| 43 | SWIFT_DATA_DIR=${SWIFT_DATA_DIR:-${DATA_DIR}/swift} |
Attila Fazekas | e602441 | 2013-09-15 18:38:48 +0200 | [diff] [blame] | 44 | SWIFT_DISK_IMAGE=${SWIFT_DATA_DIR}/drives/images/swift.img |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 45 | |
Dean Troyer | 6ec72fa | 2013-03-13 11:44:53 -0500 | [diff] [blame] | 46 | # Set ``SWIFT_CONF_DIR`` to the location of the configuration files. |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 47 | # Default is ``/etc/swift``. |
Dean Troyer | 6ec72fa | 2013-03-13 11:44:53 -0500 | [diff] [blame] | 48 | # TODO(dtroyer): remove SWIFT_CONFIG_DIR after cutting stable/grizzly |
| 49 | SWIFT_CONF_DIR=${SWIFT_CONF_DIR:-${SWIFT_CONFIG_DIR:-/etc/swift}} |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 50 | |
Dean Troyer | b7490da | 2013-03-18 16:07:56 -0500 | [diff] [blame] | 51 | if is_service_enabled s-proxy && is_service_enabled swift3; then |
| 52 | # If we are using swift3, we can default the s3 port to swift instead |
| 53 | # of nova-objectstore |
| 54 | S3_SERVICE_PORT=${S3_SERVICE_PORT:-8080} |
| 55 | fi |
| 56 | |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 57 | # DevStack will create a loop-back disk formatted as XFS to store the |
Kevin Lyda | d66c965 | 2013-01-09 13:39:57 +0000 | [diff] [blame] | 58 | # swift data. Set ``SWIFT_LOOPBACK_DISK_SIZE`` to the disk size in |
| 59 | # kilobytes. |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 60 | # Default is 1 gigabyte. |
Attila Fazekas | e602441 | 2013-09-15 18:38:48 +0200 | [diff] [blame] | 61 | SWIFT_LOOPBACK_DISK_SIZE_DEFAULT=1G |
Joe Gordon | 66c5424 | 2013-11-12 16:24:14 -0800 | [diff] [blame] | 62 | # if tempest enabled the default size is 6 Gigabyte. |
Attila Fazekas | 3418c1c | 2013-09-16 18:35:49 +0200 | [diff] [blame] | 63 | if is_service_enabled tempest; then |
Joe Gordon | 66c5424 | 2013-11-12 16:24:14 -0800 | [diff] [blame] | 64 | SWIFT_LOOPBACK_DISK_SIZE_DEFAULT=${SWIFT_LOOPBACK_DISK_SIZE:-6G} |
Attila Fazekas | 3418c1c | 2013-09-16 18:35:49 +0200 | [diff] [blame] | 65 | fi |
| 66 | |
| 67 | SWIFT_LOOPBACK_DISK_SIZE=${SWIFT_LOOPBACK_DISK_SIZE:-$SWIFT_LOOPBACK_DISK_SIZE_DEFAULT} |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 68 | |
Chmouel Boudjnah | bc3a339 | 2013-02-23 04:00:51 +0100 | [diff] [blame] | 69 | # Set ``SWIFT_EXTRAS_MIDDLEWARE`` to extras middlewares. |
Samuel Merritt | f19ccb6 | 2014-03-08 07:54:05 -0800 | [diff] [blame] | 70 | # Default is ``staticweb, formpost`` |
| 71 | SWIFT_EXTRAS_MIDDLEWARE=${SWIFT_EXTRAS_MIDDLEWARE:-formpost staticweb} |
Chmouel Boudjnah | bc3a339 | 2013-02-23 04:00:51 +0100 | [diff] [blame] | 72 | |
Cyril Roelandt | d988340 | 2013-09-27 15:16:51 +0000 | [diff] [blame] | 73 | # Set ``SWIFT_EXTRAS_MIDDLEWARE_LAST`` to extras middlewares that need to be at |
| 74 | # the end of the pipeline. |
| 75 | SWIFT_EXTRAS_MIDDLEWARE_LAST=${SWIFT_EXTRAS_MIDDLEWARE_LAST} |
| 76 | |
Joe H. Rahme | 1ce2ffd | 2013-10-22 15:19:09 +0200 | [diff] [blame] | 77 | # Set ``SWIFT_EXTRAS_MIDDLEWARE_NO_AUTH`` to extras middlewares that need to be at |
| 78 | # the beginning of the pipeline, before authentication middlewares. |
| 79 | SWIFT_EXTRAS_MIDDLEWARE_NO_AUTH=${SWIFT_EXTRAS_MIDDLEWARE_NO_AUTH:-crossdomain} |
| 80 | |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 81 | # The ring uses a configurable number of bits from a path’s MD5 hash as |
| 82 | # a partition index that designates a device. The number of bits kept |
| 83 | # from the hash is known as the partition power, and 2 to the partition |
| 84 | # power indicates the partition count. Partitioning the full MD5 hash |
| 85 | # ring allows other parts of the cluster to work in batches of items at |
| 86 | # once which ends up either more efficient or at least less complex than |
| 87 | # working with each item separately or the entire cluster all at once. |
| 88 | # By default we define 9 for the partition count (which mean 512). |
| 89 | SWIFT_PARTITION_POWER_SIZE=${SWIFT_PARTITION_POWER_SIZE:-9} |
| 90 | |
| 91 | # Set ``SWIFT_REPLICAS`` to configure how many replicas are to be |
Chmouel Boudjnah | 0c3a558 | 2013-03-06 10:58:33 +0100 | [diff] [blame] | 92 | # configured for your Swift cluster. By default we are configuring |
| 93 | # only one replica since this is way less CPU and memory intensive. If |
| 94 | # you are planning to test swift replication you may want to set this |
| 95 | # up to 3. |
| 96 | SWIFT_REPLICAS=${SWIFT_REPLICAS:-1} |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 97 | SWIFT_REPLICAS_SEQ=$(seq ${SWIFT_REPLICAS}) |
| 98 | |
Peter Portante | cee4b3b | 2013-11-20 14:33:16 -0500 | [diff] [blame] | 99 | # Set ``SWIFT_LOG_TOKEN_LENGTH`` to configure how many characters of an auth |
| 100 | # token should be placed in the logs. When keystone is used with PKI tokens, |
| 101 | # the token values can be huge, seemingly larger the 2K, at the least. We |
| 102 | # restrict it here to a default of 12 characters, which should be enough to |
| 103 | # trace through the logs when looking for its use. |
| 104 | SWIFT_LOG_TOKEN_LENGTH=${SWIFT_LOG_TOKEN_LENGTH:-12} |
| 105 | |
Julien Vey | 63024d9 | 2014-05-06 15:10:07 +0200 | [diff] [blame^] | 106 | # Set ``SWIFT_MAX_HEADER_SIZE`` to configure the maximun length of headers in |
| 107 | # Swift API |
| 108 | SWIFT_MAX_HEADER_SIZE=${SWIFT_MAX_HEADER_SIZE:-16384} |
| 109 | |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 110 | # Set ``OBJECT_PORT_BASE``, ``CONTAINER_PORT_BASE``, ``ACCOUNT_PORT_BASE`` |
| 111 | # Port bases used in port number calclution for the service "nodes" |
| 112 | # The specified port number will be used, the additinal ports calculated by |
| 113 | # base_port + node_num * 10 |
Dean Troyer | 1151d6f | 2013-03-29 14:06:52 -0500 | [diff] [blame] | 114 | OBJECT_PORT_BASE=${OBJECT_PORT_BASE:-6013} |
| 115 | CONTAINER_PORT_BASE=${CONTAINER_PORT_BASE:-6011} |
| 116 | ACCOUNT_PORT_BASE=${ACCOUNT_PORT_BASE:-6012} |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 117 | |
Dean Troyer | 4237f59 | 2014-01-29 16:22:11 -0600 | [diff] [blame] | 118 | # Tell Tempest this project is present |
| 119 | TEMPEST_SERVICES+=,swift |
| 120 | |
Dean Troyer | 6d04fd7 | 2012-12-21 11:03:37 -0600 | [diff] [blame] | 121 | |
Dean Troyer | cc6b443 | 2013-04-08 15:38:03 -0500 | [diff] [blame] | 122 | # Functions |
| 123 | # --------- |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 124 | |
Dean Troyer | e4fa721 | 2014-01-15 15:04:49 -0600 | [diff] [blame] | 125 | # Test if any Swift services are enabled |
| 126 | # is_swift_enabled |
| 127 | function is_swift_enabled { |
| 128 | [[ ,${ENABLED_SERVICES} =~ ,"s-" ]] && return 0 |
| 129 | return 1 |
| 130 | } |
| 131 | |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 132 | # cleanup_swift() - Remove residual data files |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 133 | function cleanup_swift { |
Sean Dague | 101b424 | 2013-10-22 08:47:11 -0400 | [diff] [blame] | 134 | rm -f ${SWIFT_CONF_DIR}{*.builder,*.ring.gz,backups/*.builder,backups/*.ring.gz} |
| 135 | if egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then |
| 136 | sudo umount ${SWIFT_DATA_DIR}/drives/sdb1 |
| 137 | fi |
| 138 | if [[ -e ${SWIFT_DISK_IMAGE} ]]; then |
| 139 | rm ${SWIFT_DISK_IMAGE} |
| 140 | fi |
| 141 | rm -rf ${SWIFT_DATA_DIR}/run/ |
| 142 | if is_apache_enabled_service swift; then |
| 143 | _cleanup_swift_apache_wsgi |
| 144 | fi |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 145 | } |
| 146 | |
| 147 | # _cleanup_swift_apache_wsgi() - Remove wsgi files, disable and remove apache vhost file |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 148 | function _cleanup_swift_apache_wsgi { |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 149 | sudo rm -f $SWIFT_APACHE_WSGI_DIR/*.wsgi |
Jamie Lennox | 5470701 | 2013-09-17 12:07:48 +1000 | [diff] [blame] | 150 | disable_apache_site proxy-server |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 151 | for node_number in ${SWIFT_REPLICAS_SEQ}; do |
| 152 | for type in object container account; do |
| 153 | site_name=${type}-server-${node_number} |
Jamie Lennox | 5470701 | 2013-09-17 12:07:48 +1000 | [diff] [blame] | 154 | disable_apache_site ${site_name} |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 155 | sudo rm -f /etc/$APACHE_NAME/$APACHE_CONF_DIR/${site_name} |
| 156 | done |
| 157 | done |
| 158 | } |
| 159 | |
| 160 | # _config_swift_apache_wsgi() - Set WSGI config files of Swift |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 161 | function _config_swift_apache_wsgi { |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 162 | sudo mkdir -p ${SWIFT_APACHE_WSGI_DIR} |
| 163 | local apache_vhost_dir=/etc/${APACHE_NAME}/$APACHE_CONF_DIR |
| 164 | local proxy_port=${SWIFT_DEFAULT_BIND_PORT:-8080} |
| 165 | |
| 166 | # copy proxy vhost and wsgi file |
| 167 | sudo cp ${SWIFT_DIR}/examples/apache2/proxy-server.template ${apache_vhost_dir}/proxy-server |
| 168 | sudo sed -e " |
| 169 | /^#/d;/^$/d; |
| 170 | s/%PORT%/$proxy_port/g; |
| 171 | s/%SERVICENAME%/proxy-server/g; |
| 172 | s/%APACHE_NAME%/${APACHE_NAME}/g; |
Jamie Lennox | d582460 | 2013-09-17 11:44:37 +1000 | [diff] [blame] | 173 | s/%USER%/${STACK_USER}/g; |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 174 | " -i ${apache_vhost_dir}/proxy-server |
Jamie Lennox | 5470701 | 2013-09-17 12:07:48 +1000 | [diff] [blame] | 175 | enable_apache_site proxy-server |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 176 | |
| 177 | sudo cp ${SWIFT_DIR}/examples/wsgi/proxy-server.wsgi.template ${SWIFT_APACHE_WSGI_DIR}/proxy-server.wsgi |
| 178 | sudo sed -e " |
| 179 | /^#/d;/^$/d; |
| 180 | s/%SERVICECONF%/proxy-server.conf/g; |
| 181 | " -i ${SWIFT_APACHE_WSGI_DIR}/proxy-server.wsgi |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 182 | |
| 183 | # copy apache vhost file and set name and port |
| 184 | for node_number in ${SWIFT_REPLICAS_SEQ}; do |
| 185 | object_port=$[OBJECT_PORT_BASE + 10 * ($node_number - 1)] |
| 186 | container_port=$[CONTAINER_PORT_BASE + 10 * ($node_number - 1)] |
| 187 | account_port=$[ACCOUNT_PORT_BASE + 10 * ($node_number - 1)] |
| 188 | |
| 189 | sudo cp ${SWIFT_DIR}/examples/apache2/object-server.template ${apache_vhost_dir}/object-server-${node_number} |
| 190 | sudo sed -e " |
| 191 | s/%PORT%/$object_port/g; |
| 192 | s/%SERVICENAME%/object-server-${node_number}/g; |
| 193 | s/%APACHE_NAME%/${APACHE_NAME}/g; |
Jamie Lennox | d582460 | 2013-09-17 11:44:37 +1000 | [diff] [blame] | 194 | s/%USER%/${STACK_USER}/g; |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 195 | " -i ${apache_vhost_dir}/object-server-${node_number} |
Jamie Lennox | 5470701 | 2013-09-17 12:07:48 +1000 | [diff] [blame] | 196 | enable_apache_site object-server-${node_number} |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 197 | |
| 198 | sudo cp ${SWIFT_DIR}/examples/wsgi/object-server.wsgi.template ${SWIFT_APACHE_WSGI_DIR}/object-server-${node_number}.wsgi |
| 199 | sudo sed -e " |
| 200 | /^#/d;/^$/d; |
| 201 | s/%SERVICECONF%/object-server\/${node_number}.conf/g; |
| 202 | " -i ${SWIFT_APACHE_WSGI_DIR}/object-server-${node_number}.wsgi |
| 203 | |
| 204 | sudo cp ${SWIFT_DIR}/examples/apache2/container-server.template ${apache_vhost_dir}/container-server-${node_number} |
| 205 | sudo sed -e " |
| 206 | /^#/d;/^$/d; |
| 207 | s/%PORT%/$container_port/g; |
| 208 | s/%SERVICENAME%/container-server-${node_number}/g; |
| 209 | s/%APACHE_NAME%/${APACHE_NAME}/g; |
Jamie Lennox | d582460 | 2013-09-17 11:44:37 +1000 | [diff] [blame] | 210 | s/%USER%/${STACK_USER}/g; |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 211 | " -i ${apache_vhost_dir}/container-server-${node_number} |
Jamie Lennox | 5470701 | 2013-09-17 12:07:48 +1000 | [diff] [blame] | 212 | enable_apache_site container-server-${node_number} |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 213 | |
| 214 | sudo cp ${SWIFT_DIR}/examples/wsgi/container-server.wsgi.template ${SWIFT_APACHE_WSGI_DIR}/container-server-${node_number}.wsgi |
| 215 | sudo sed -e " |
| 216 | /^#/d;/^$/d; |
| 217 | s/%SERVICECONF%/container-server\/${node_number}.conf/g; |
| 218 | " -i ${SWIFT_APACHE_WSGI_DIR}/container-server-${node_number}.wsgi |
| 219 | |
| 220 | sudo cp ${SWIFT_DIR}/examples/apache2/account-server.template ${apache_vhost_dir}/account-server-${node_number} |
| 221 | sudo sed -e " |
Sean Dague | 101b424 | 2013-10-22 08:47:11 -0400 | [diff] [blame] | 222 | /^#/d;/^$/d; |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 223 | s/%PORT%/$account_port/g; |
| 224 | s/%SERVICENAME%/account-server-${node_number}/g; |
| 225 | s/%APACHE_NAME%/${APACHE_NAME}/g; |
Jamie Lennox | d582460 | 2013-09-17 11:44:37 +1000 | [diff] [blame] | 226 | s/%USER%/${STACK_USER}/g; |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 227 | " -i ${apache_vhost_dir}/account-server-${node_number} |
Jamie Lennox | 5470701 | 2013-09-17 12:07:48 +1000 | [diff] [blame] | 228 | enable_apache_site account-server-${node_number} |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 229 | |
| 230 | sudo cp ${SWIFT_DIR}/examples/wsgi/account-server.wsgi.template ${SWIFT_APACHE_WSGI_DIR}/account-server-${node_number}.wsgi |
| 231 | sudo sed -e " |
Sean Dague | 101b424 | 2013-10-22 08:47:11 -0400 | [diff] [blame] | 232 | /^#/d;/^$/d; |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 233 | s/%SERVICECONF%/account-server\/${node_number}.conf/g; |
| 234 | " -i ${SWIFT_APACHE_WSGI_DIR}/account-server-${node_number}.wsgi |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 235 | done |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 236 | } |
| 237 | |
Ian Wienand | f8e86bb | 2014-02-21 15:16:31 +1100 | [diff] [blame] | 238 | # This function generates an object/container/account configuration |
| 239 | # emulating 4 nodes on different ports |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 240 | function generate_swift_config { |
Ian Wienand | f8e86bb | 2014-02-21 15:16:31 +1100 | [diff] [blame] | 241 | local swift_node_config=$1 |
| 242 | local node_id=$2 |
| 243 | local bind_port=$3 |
| 244 | local server_type=$4 |
| 245 | |
| 246 | log_facility=$[ node_id - 1 ] |
| 247 | node_path=${SWIFT_DATA_DIR}/${node_number} |
| 248 | |
| 249 | iniuncomment ${swift_node_config} DEFAULT user |
| 250 | iniset ${swift_node_config} DEFAULT user ${STACK_USER} |
| 251 | |
| 252 | iniuncomment ${swift_node_config} DEFAULT bind_port |
| 253 | iniset ${swift_node_config} DEFAULT bind_port ${bind_port} |
| 254 | |
| 255 | iniuncomment ${swift_node_config} DEFAULT swift_dir |
| 256 | iniset ${swift_node_config} DEFAULT swift_dir ${SWIFT_CONF_DIR} |
| 257 | |
| 258 | iniuncomment ${swift_node_config} DEFAULT devices |
| 259 | iniset ${swift_node_config} DEFAULT devices ${node_path} |
| 260 | |
| 261 | iniuncomment ${swift_node_config} DEFAULT log_facility |
| 262 | iniset ${swift_node_config} DEFAULT log_facility LOG_LOCAL${log_facility} |
| 263 | |
| 264 | iniuncomment ${swift_node_config} DEFAULT workers |
| 265 | iniset ${swift_node_config} DEFAULT workers 1 |
| 266 | |
| 267 | iniuncomment ${swift_node_config} DEFAULT disable_fallocate |
| 268 | iniset ${swift_node_config} DEFAULT disable_fallocate true |
| 269 | |
| 270 | iniuncomment ${swift_node_config} DEFAULT mount_check |
| 271 | iniset ${swift_node_config} DEFAULT mount_check false |
| 272 | |
| 273 | iniuncomment ${swift_node_config} ${server_type}-replicator vm_test_mode |
| 274 | iniset ${swift_node_config} ${server_type}-replicator vm_test_mode yes |
| 275 | } |
| 276 | |
| 277 | |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 278 | # configure_swift() - Set config files, create data dirs and loop image |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 279 | function configure_swift { |
Joe H. Rahme | 1ce2ffd | 2013-10-22 15:19:09 +0200 | [diff] [blame] | 280 | local swift_pipeline="${SWIFT_EXTRAS_MIDDLEWARE_NO_AUTH}" |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 281 | local node_number |
| 282 | local swift_node_config |
| 283 | local swift_log_dir |
| 284 | |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 285 | # Make sure to kill all swift processes first |
Chmouel Boudjnah | ad8b276 | 2013-01-10 15:40:01 +0100 | [diff] [blame] | 286 | swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 287 | |
Dean Troyer | 1c6c112 | 2013-03-27 17:40:53 -0500 | [diff] [blame] | 288 | sudo mkdir -p ${SWIFT_CONF_DIR}/{object,container,account}-server |
Stephan Renatus | e578eff | 2013-11-19 13:31:04 +0100 | [diff] [blame] | 289 | sudo chown -R ${STACK_USER}: ${SWIFT_CONF_DIR} |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 290 | |
Dean Troyer | 6ec72fa | 2013-03-13 11:44:53 -0500 | [diff] [blame] | 291 | if [[ "$SWIFT_CONF_DIR" != "/etc/swift" ]]; then |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 292 | # Some swift tools are hard-coded to use ``/etc/swift`` and are apparently not going to be fixed. |
| 293 | # Create a symlink if the config dir is moved |
Dean Troyer | 6ec72fa | 2013-03-13 11:44:53 -0500 | [diff] [blame] | 294 | sudo ln -sf ${SWIFT_CONF_DIR} /etc/swift |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 295 | fi |
| 296 | |
| 297 | # Swift use rsync to synchronize between all the different |
| 298 | # partitions (which make more sense when you have a multi-node |
| 299 | # setup) we configure it with our version of rsync. |
| 300 | sed -e " |
| 301 | s/%GROUP%/${USER_GROUP}/; |
Stephan Renatus | e578eff | 2013-11-19 13:31:04 +0100 | [diff] [blame] | 302 | s/%USER%/${STACK_USER}/; |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 303 | s,%SWIFT_DATA_DIR%,$SWIFT_DATA_DIR,; |
| 304 | " $FILES/swift/rsyncd.conf | sudo tee /etc/rsyncd.conf |
| 305 | # rsyncd.conf just prepared for 4 nodes |
Vincent Untz | c18b965 | 2012-12-04 12:36:34 +0100 | [diff] [blame] | 306 | if is_ubuntu; then |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 307 | sudo sed -i '/^RSYNC_ENABLE=false/ { s/false/true/ }' /etc/default/rsync |
Attila Fazekas | 0e57b96 | 2014-02-28 09:09:52 +0100 | [diff] [blame] | 308 | elif [ -e /etc/xinetd.d/rsync ]; then |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 309 | sudo sed -i '/disable *= *yes/ { s/yes/no/ }' /etc/xinetd.d/rsync |
| 310 | fi |
| 311 | |
Dean Troyer | 6ec72fa | 2013-03-13 11:44:53 -0500 | [diff] [blame] | 312 | SWIFT_CONFIG_PROXY_SERVER=${SWIFT_CONF_DIR}/proxy-server.conf |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 313 | cp ${SWIFT_DIR}/etc/proxy-server.conf-sample ${SWIFT_CONFIG_PROXY_SERVER} |
| 314 | |
Chmouel Boudjnah | f2c1a71 | 2014-01-29 21:38:14 +0000 | [diff] [blame] | 315 | cp ${SWIFT_DIR}/etc/container-sync-realms.conf-sample ${SWIFT_CONF_DIR}/container-sync-realms.conf |
| 316 | |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 317 | iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT user |
Stephan Renatus | e578eff | 2013-11-19 13:31:04 +0100 | [diff] [blame] | 318 | iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT user ${STACK_USER} |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 319 | |
| 320 | iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT swift_dir |
Dean Troyer | 6ec72fa | 2013-03-13 11:44:53 -0500 | [diff] [blame] | 321 | iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT swift_dir ${SWIFT_CONF_DIR} |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 322 | |
| 323 | iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT workers |
| 324 | iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT workers 1 |
| 325 | |
| 326 | iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT log_level |
| 327 | iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT log_level DEBUG |
| 328 | |
| 329 | iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT bind_port |
| 330 | iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT bind_port ${SWIFT_DEFAULT_BIND_PORT:-8080} |
| 331 | |
Joe Gordon | d254da5 | 2013-11-19 21:06:29 -0800 | [diff] [blame] | 332 | # Devstack is commonly run in a small slow environment, so bump the |
| 333 | # timeouts up. |
| 334 | # node_timeout is how long between read operations a node takes to |
| 335 | # respond to the proxy server |
| 336 | # conn_timeout is all about how long it takes a connect() system call to |
| 337 | # return |
| 338 | iniset ${SWIFT_CONFIG_PROXY_SERVER} app:proxy-server node_timeout 120 |
| 339 | iniset ${SWIFT_CONFIG_PROXY_SERVER} app:proxy-server conn_timeout 20 |
| 340 | |
Joe Gordon | c381a54 | 2014-03-19 11:09:31 -0700 | [diff] [blame] | 341 | # Skipped due to bug 1294789 |
| 342 | ## Configure Ceilometer |
| 343 | #if is_service_enabled ceilometer; then |
| 344 | # iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:ceilometer use "egg:ceilometer#swift" |
| 345 | # SWIFT_EXTRAS_MIDDLEWARE_LAST="${SWIFT_EXTRAS_MIDDLEWARE_LAST} ceilometer" |
| 346 | #fi |
Cyril Roelandt | d988340 | 2013-09-27 15:16:51 +0000 | [diff] [blame] | 347 | |
Peter Portante | cee4b3b | 2013-11-20 14:33:16 -0500 | [diff] [blame] | 348 | # Restrict the length of auth tokens in the swift proxy-server logs. |
| 349 | iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:proxy-logging reveal_sensitive_prefix ${SWIFT_LOG_TOKEN_LENGTH} |
| 350 | |
Chmouel Boudjnah | 5cac378 | 2013-07-17 15:13:44 +0000 | [diff] [blame] | 351 | # By default Swift will be installed with keystone and tempauth middleware |
| 352 | # and add the swift3 middleware if its configured for it. The token for |
Adam Spiers | cb96159 | 2013-10-05 12:11:07 +0100 | [diff] [blame] | 353 | # tempauth would be prefixed with the reseller_prefix setting `TEMPAUTH_` the |
| 354 | # token for keystoneauth would have the standard reseller_prefix `AUTH_` |
Chmouel Boudjnah | 5cac378 | 2013-07-17 15:13:44 +0000 | [diff] [blame] | 355 | if is_service_enabled swift3;then |
Joe H. Rahme | 1ce2ffd | 2013-10-22 15:19:09 +0200 | [diff] [blame] | 356 | swift_pipeline+=" swift3 s3token " |
Chmouel Boudjnah | bc3a339 | 2013-02-23 04:00:51 +0100 | [diff] [blame] | 357 | fi |
Chmouel Boudjnah | 5cac378 | 2013-07-17 15:13:44 +0000 | [diff] [blame] | 358 | swift_pipeline+=" authtoken keystoneauth tempauth " |
Chmouel Boudjnah | bc3a339 | 2013-02-23 04:00:51 +0100 | [diff] [blame] | 359 | sed -i "/^pipeline/ { s/tempauth/${swift_pipeline} ${SWIFT_EXTRAS_MIDDLEWARE}/ ;}" ${SWIFT_CONFIG_PROXY_SERVER} |
Cyril Roelandt | d988340 | 2013-09-27 15:16:51 +0000 | [diff] [blame] | 360 | sed -i "/^pipeline/ { s/proxy-server/${SWIFT_EXTRAS_MIDDLEWARE_LAST} proxy-server/ ; }" ${SWIFT_CONFIG_PROXY_SERVER} |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 361 | |
Chmouel Boudjnah | 5cac378 | 2013-07-17 15:13:44 +0000 | [diff] [blame] | 362 | iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth account_autocreate |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 363 | iniset ${SWIFT_CONFIG_PROXY_SERVER} app:proxy-server account_autocreate true |
| 364 | |
Chmouel Boudjnah | 5cac378 | 2013-07-17 15:13:44 +0000 | [diff] [blame] | 365 | iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth reseller_prefix |
| 366 | iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth reseller_prefix "TEMPAUTH" |
| 367 | |
Joe H. Rahme | 1ce2ffd | 2013-10-22 15:19:09 +0200 | [diff] [blame] | 368 | # Configure Crossdomain |
| 369 | iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:crossdomain use "egg:swift#crossdomain" |
| 370 | |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 371 | # Configure Keystone |
| 372 | sed -i '/^# \[filter:authtoken\]/,/^# \[filter:keystoneauth\]$/ s/^#[ \t]*//' ${SWIFT_CONFIG_PROXY_SERVER} |
| 373 | iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken auth_host $KEYSTONE_AUTH_HOST |
| 374 | iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken auth_port $KEYSTONE_AUTH_PORT |
| 375 | iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken auth_protocol $KEYSTONE_AUTH_PROTOCOL |
Jamie Lennox | bd24a8d | 2013-09-20 16:26:42 +1000 | [diff] [blame] | 376 | iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken cafile $KEYSTONE_SSL_CA |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 377 | iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken auth_uri $KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_SERVICE_PORT/ |
| 378 | iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken admin_tenant_name $SERVICE_TENANT_NAME |
| 379 | iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken admin_user swift |
| 380 | iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken admin_password $SERVICE_PASSWORD |
Dean Troyer | 64ab774 | 2012-12-28 15:38:28 -0600 | [diff] [blame] | 381 | iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken signing_dir $SWIFT_AUTH_CACHE_DIR |
Peter Portante | 8afc893 | 2013-11-20 17:34:39 -0500 | [diff] [blame] | 382 | # This causes the authtoken middleware to use the same python logging |
| 383 | # adapter provided by the swift proxy-server, so that request transaction |
| 384 | # IDs will included in all of its log messages. |
| 385 | iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:authtoken log_name swift |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 386 | |
| 387 | iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} filter:keystoneauth use |
| 388 | iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} filter:keystoneauth operator_roles |
| 389 | iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:keystoneauth operator_roles "Member, admin" |
| 390 | |
| 391 | if is_service_enabled swift3; then |
| 392 | cat <<EOF >>${SWIFT_CONFIG_PROXY_SERVER} |
| 393 | # NOTE(chmou): s3token middleware is not updated yet to use only |
| 394 | # username and password. |
| 395 | [filter:s3token] |
Chmouel Boudjnah | 891277f | 2014-02-03 21:07:03 +0000 | [diff] [blame] | 396 | paste.filter_factory = keystoneclient.middleware.s3_token:filter_factory |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 397 | auth_port = ${KEYSTONE_AUTH_PORT} |
| 398 | auth_host = ${KEYSTONE_AUTH_HOST} |
| 399 | auth_protocol = ${KEYSTONE_AUTH_PROTOCOL} |
Jamie Lennox | bd24a8d | 2013-09-20 16:26:42 +1000 | [diff] [blame] | 400 | cafile = ${KEYSTONE_SSL_CA} |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 401 | auth_token = ${SERVICE_TOKEN} |
| 402 | admin_token = ${SERVICE_TOKEN} |
| 403 | |
| 404 | [filter:swift3] |
| 405 | use = egg:swift3#swift3 |
| 406 | EOF |
| 407 | fi |
| 408 | |
Dean Troyer | 6ec72fa | 2013-03-13 11:44:53 -0500 | [diff] [blame] | 409 | cp ${SWIFT_DIR}/etc/swift.conf-sample ${SWIFT_CONF_DIR}/swift.conf |
| 410 | iniset ${SWIFT_CONF_DIR}/swift.conf swift-hash swift_hash_path_suffix ${SWIFT_HASH} |
Julien Vey | 63024d9 | 2014-05-06 15:10:07 +0200 | [diff] [blame^] | 411 | iniset ${SWIFT_CONF_DIR}/swift.conf swift-constraints max_header_size ${SWIFT_MAX_HEADER_SIZE} |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 412 | |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 413 | for node_number in ${SWIFT_REPLICAS_SEQ}; do |
Dean Troyer | 6ec72fa | 2013-03-13 11:44:53 -0500 | [diff] [blame] | 414 | swift_node_config=${SWIFT_CONF_DIR}/object-server/${node_number}.conf |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 415 | cp ${SWIFT_DIR}/etc/object-server.conf-sample ${swift_node_config} |
Chmouel Boudjnah | 35633f0 | 2013-07-16 07:35:13 +0000 | [diff] [blame] | 416 | generate_swift_config ${swift_node_config} ${node_number} $[OBJECT_PORT_BASE + 10 * (node_number - 1)] object |
Chmouel Boudjnah | 8e5d2f0 | 2012-12-20 13:11:43 +0000 | [diff] [blame] | 417 | iniset ${swift_node_config} filter:recon recon_cache_path ${SWIFT_DATA_DIR}/cache |
| 418 | # Using a sed and not iniset/iniuncomment because we want to a global |
| 419 | # modification and make sure it works for new sections. |
| 420 | sed -i -e "s,#[ ]*recon_cache_path .*,recon_cache_path = ${SWIFT_DATA_DIR}/cache," ${swift_node_config} |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 421 | |
Dean Troyer | 6ec72fa | 2013-03-13 11:44:53 -0500 | [diff] [blame] | 422 | swift_node_config=${SWIFT_CONF_DIR}/container-server/${node_number}.conf |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 423 | cp ${SWIFT_DIR}/etc/container-server.conf-sample ${swift_node_config} |
Chmouel Boudjnah | 35633f0 | 2013-07-16 07:35:13 +0000 | [diff] [blame] | 424 | generate_swift_config ${swift_node_config} ${node_number} $[CONTAINER_PORT_BASE + 10 * (node_number - 1)] container |
Attila Fazekas | 83e1095 | 2012-11-30 23:28:07 +0100 | [diff] [blame] | 425 | iniuncomment ${swift_node_config} app:container-server allow_versions |
| 426 | iniset ${swift_node_config} app:container-server allow_versions "true" |
Chmouel Boudjnah | 8e5d2f0 | 2012-12-20 13:11:43 +0000 | [diff] [blame] | 427 | sed -i -e "s,#[ ]*recon_cache_path .*,recon_cache_path = ${SWIFT_DATA_DIR}/cache," ${swift_node_config} |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 428 | |
Dean Troyer | 6ec72fa | 2013-03-13 11:44:53 -0500 | [diff] [blame] | 429 | swift_node_config=${SWIFT_CONF_DIR}/account-server/${node_number}.conf |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 430 | cp ${SWIFT_DIR}/etc/account-server.conf-sample ${swift_node_config} |
Chmouel Boudjnah | 35633f0 | 2013-07-16 07:35:13 +0000 | [diff] [blame] | 431 | generate_swift_config ${swift_node_config} ${node_number} $[ACCOUNT_PORT_BASE + 10 * (node_number - 1)] account |
Chmouel Boudjnah | 8e5d2f0 | 2012-12-20 13:11:43 +0000 | [diff] [blame] | 432 | sed -i -e "s,#[ ]*recon_cache_path .*,recon_cache_path = ${SWIFT_DATA_DIR}/cache," ${swift_node_config} |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 433 | done |
| 434 | |
Chmouel Boudjnah | 0ce91a5 | 2013-07-05 11:59:24 +0000 | [diff] [blame] | 435 | # Set new accounts in tempauth to match keystone tenant/user (to make testing easier) |
| 436 | iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth user_swifttenanttest1_swiftusertest1 "testing .admin" |
| 437 | iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth user_swifttenanttest2_swiftusertest2 "testing2 .admin" |
| 438 | iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth user_swifttenanttest1_swiftusertest3 "testing3 .admin" |
| 439 | |
| 440 | testfile=${SWIFT_CONF_DIR}/test.conf |
| 441 | cp ${SWIFT_DIR}/test/sample.conf ${testfile} |
| 442 | |
| 443 | # Set accounts for functional tests |
| 444 | iniset ${testfile} func_test account swifttenanttest1 |
| 445 | iniset ${testfile} func_test username swiftusertest1 |
| 446 | iniset ${testfile} func_test username3 swiftusertest3 |
| 447 | iniset ${testfile} func_test account2 swifttenanttest2 |
| 448 | iniset ${testfile} func_test username2 swiftusertest2 |
| 449 | |
Chmouel Boudjnah | 0ce91a5 | 2013-07-05 11:59:24 +0000 | [diff] [blame] | 450 | if is_service_enabled key;then |
| 451 | iniuncomment ${testfile} func_test auth_version |
| 452 | iniset ${testfile} func_test auth_host ${KEYSTONE_SERVICE_HOST} |
| 453 | iniset ${testfile} func_test auth_port ${KEYSTONE_AUTH_PORT} |
| 454 | iniset ${testfile} func_test auth_prefix /v2.0/ |
| 455 | fi |
| 456 | |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 457 | swift_log_dir=${SWIFT_DATA_DIR}/logs |
| 458 | rm -rf ${swift_log_dir} |
| 459 | mkdir -p ${swift_log_dir}/hourly |
Stephan Renatus | e578eff | 2013-11-19 13:31:04 +0100 | [diff] [blame] | 460 | sudo chown -R ${STACK_USER}:adm ${swift_log_dir} |
Yves-Gwenael Bourhis | f894c2a | 2014-04-16 13:37:46 +0200 | [diff] [blame] | 461 | |
| 462 | if [[ $SYSLOG != "False" ]]; then |
| 463 | sed "s,%SWIFT_LOGDIR%,${swift_log_dir}," $FILES/swift/rsyslog.conf | sudo \ |
| 464 | tee /etc/rsyslog.d/10-swift.conf |
| 465 | # restart syslog to take the changes |
| 466 | sudo killall -HUP rsyslogd |
| 467 | fi |
Sean Dague | ad7e8c6 | 2014-03-19 19:13:20 -0400 | [diff] [blame] | 468 | |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 469 | if is_apache_enabled_service swift; then |
| 470 | _config_swift_apache_wsgi |
| 471 | fi |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 472 | } |
| 473 | |
Dean Troyer | 1c6c112 | 2013-03-27 17:40:53 -0500 | [diff] [blame] | 474 | # create_swift_disk - Create Swift backing disk |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 475 | function create_swift_disk { |
Dean Troyer | 1c6c112 | 2013-03-27 17:40:53 -0500 | [diff] [blame] | 476 | local node_number |
| 477 | |
| 478 | # First do a bit of setup by creating the directories and |
| 479 | # changing the permissions so we can run it as our user. |
| 480 | |
Stephan Renatus | e578eff | 2013-11-19 13:31:04 +0100 | [diff] [blame] | 481 | USER_GROUP=$(id -g ${STACK_USER}) |
Dean Troyer | 1c6c112 | 2013-03-27 17:40:53 -0500 | [diff] [blame] | 482 | sudo mkdir -p ${SWIFT_DATA_DIR}/{drives,cache,run,logs} |
Stephan Renatus | e578eff | 2013-11-19 13:31:04 +0100 | [diff] [blame] | 483 | sudo chown -R ${STACK_USER}:${USER_GROUP} ${SWIFT_DATA_DIR} |
Dean Troyer | 1c6c112 | 2013-03-27 17:40:53 -0500 | [diff] [blame] | 484 | |
| 485 | # Create a loopback disk and format it to XFS. |
Attila Fazekas | e602441 | 2013-09-15 18:38:48 +0200 | [diff] [blame] | 486 | if [[ -e ${SWIFT_DISK_IMAGE} ]]; then |
Dean Troyer | 1c6c112 | 2013-03-27 17:40:53 -0500 | [diff] [blame] | 487 | if egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then |
| 488 | sudo umount ${SWIFT_DATA_DIR}/drives/sdb1 |
Attila Fazekas | e602441 | 2013-09-15 18:38:48 +0200 | [diff] [blame] | 489 | sudo rm -f ${SWIFT_DISK_IMAGE} |
Dean Troyer | 1c6c112 | 2013-03-27 17:40:53 -0500 | [diff] [blame] | 490 | fi |
| 491 | fi |
| 492 | |
| 493 | mkdir -p ${SWIFT_DATA_DIR}/drives/images |
Attila Fazekas | e602441 | 2013-09-15 18:38:48 +0200 | [diff] [blame] | 494 | sudo touch ${SWIFT_DISK_IMAGE} |
Stephan Renatus | e578eff | 2013-11-19 13:31:04 +0100 | [diff] [blame] | 495 | sudo chown ${STACK_USER}: ${SWIFT_DISK_IMAGE} |
Dean Troyer | 1c6c112 | 2013-03-27 17:40:53 -0500 | [diff] [blame] | 496 | |
Attila Fazekas | e602441 | 2013-09-15 18:38:48 +0200 | [diff] [blame] | 497 | truncate -s ${SWIFT_LOOPBACK_DISK_SIZE} ${SWIFT_DISK_IMAGE} |
Dean Troyer | 1c6c112 | 2013-03-27 17:40:53 -0500 | [diff] [blame] | 498 | |
| 499 | # Make a fresh XFS filesystem |
Longgeek | fd034f0 | 2014-03-24 17:32:02 +0800 | [diff] [blame] | 500 | /sbin/mkfs.xfs -f -i size=1024 ${SWIFT_DISK_IMAGE} |
Dean Troyer | 1c6c112 | 2013-03-27 17:40:53 -0500 | [diff] [blame] | 501 | |
| 502 | # Mount the disk with mount options to make it as efficient as possible |
| 503 | mkdir -p ${SWIFT_DATA_DIR}/drives/sdb1 |
| 504 | if ! egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then |
| 505 | sudo mount -t xfs -o loop,noatime,nodiratime,nobarrier,logbufs=8 \ |
Attila Fazekas | e602441 | 2013-09-15 18:38:48 +0200 | [diff] [blame] | 506 | ${SWIFT_DISK_IMAGE} ${SWIFT_DATA_DIR}/drives/sdb1 |
Dean Troyer | 1c6c112 | 2013-03-27 17:40:53 -0500 | [diff] [blame] | 507 | fi |
| 508 | |
| 509 | # Create a link to the above mount and |
| 510 | # create all of the directories needed to emulate a few different servers |
| 511 | for node_number in ${SWIFT_REPLICAS_SEQ}; do |
| 512 | sudo ln -sf ${SWIFT_DATA_DIR}/drives/sdb1/$node_number ${SWIFT_DATA_DIR}/$node_number; |
| 513 | drive=${SWIFT_DATA_DIR}/drives/sdb1/${node_number} |
| 514 | node=${SWIFT_DATA_DIR}/${node_number}/node |
| 515 | node_device=${node}/sdb1 |
| 516 | [[ -d $node ]] && continue |
| 517 | [[ -d $drive ]] && continue |
Stephan Renatus | e578eff | 2013-11-19 13:31:04 +0100 | [diff] [blame] | 518 | sudo install -o ${STACK_USER} -g $USER_GROUP -d $drive |
| 519 | sudo install -o ${STACK_USER} -g $USER_GROUP -d $node_device |
| 520 | sudo chown -R ${STACK_USER}: ${node} |
Dean Troyer | 1c6c112 | 2013-03-27 17:40:53 -0500 | [diff] [blame] | 521 | done |
| 522 | } |
Chmouel Boudjnah | ba31305 | 2013-07-10 21:03:43 +0200 | [diff] [blame] | 523 | # create_swift_accounts() - Set up standard swift accounts and extra |
| 524 | # one for tests we do this by attaching all words in the account name |
| 525 | # since we want to make it compatible with tempauth which use |
| 526 | # underscores for separators. |
Chmouel Boudjnah | 0ce91a5 | 2013-07-05 11:59:24 +0000 | [diff] [blame] | 527 | |
| 528 | # Tenant User Roles |
| 529 | # ------------------------------------------------------------------ |
Chmouel Boudjnah | ba31305 | 2013-07-10 21:03:43 +0200 | [diff] [blame] | 530 | # service swift service |
Chmouel Boudjnah | 0ce91a5 | 2013-07-05 11:59:24 +0000 | [diff] [blame] | 531 | # swifttenanttest1 swiftusertest1 admin |
| 532 | # swifttenanttest1 swiftusertest3 anotherrole |
| 533 | # swifttenanttest2 swiftusertest2 admin |
| 534 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 535 | function create_swift_accounts { |
Sahid Orentino Ferdjaoui | 1814e67 | 2014-02-11 17:56:07 +0100 | [diff] [blame] | 536 | # Defines specific passwords used by tools/create_userrc.sh |
| 537 | SWIFTUSERTEST1_PASSWORD=testing |
| 538 | SWIFTUSERTEST2_PASSWORD=testing2 |
| 539 | SWIFTUSERTEST3_PASSWORD=testing3 |
| 540 | |
Chmouel Boudjnah | ba31305 | 2013-07-10 21:03:43 +0200 | [diff] [blame] | 541 | KEYSTONE_CATALOG_BACKEND=${KEYSTONE_CATALOG_BACKEND:-sql} |
| 542 | |
Steve Martinelli | 1968542 | 2014-01-24 13:02:26 -0600 | [diff] [blame] | 543 | SERVICE_TENANT=$(openstack project list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }") |
| 544 | ADMIN_ROLE=$(openstack role list | awk "/ admin / { print \$2 }") |
Chmouel Boudjnah | ba31305 | 2013-07-10 21:03:43 +0200 | [diff] [blame] | 545 | |
Steve Martinelli | 1968542 | 2014-01-24 13:02:26 -0600 | [diff] [blame] | 546 | SWIFT_USER=$(openstack user create \ |
| 547 | swift \ |
| 548 | --password "$SERVICE_PASSWORD" \ |
| 549 | --project $SERVICE_TENANT \ |
| 550 | --email=swift@example.com \ |
| 551 | | grep " id " | get_field 2) |
| 552 | openstack role add \ |
| 553 | $ADMIN_ROLE \ |
| 554 | --project $SERVICE_TENANT \ |
| 555 | --user $SWIFT_USER |
Chmouel Boudjnah | ba31305 | 2013-07-10 21:03:43 +0200 | [diff] [blame] | 556 | |
| 557 | if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then |
Steve Martinelli | 1968542 | 2014-01-24 13:02:26 -0600 | [diff] [blame] | 558 | SWIFT_SERVICE=$(openstack service create \ |
| 559 | swift \ |
| 560 | --type="object-store" \ |
| 561 | --description="Swift Service" \ |
| 562 | | grep " id " | get_field 2) |
| 563 | openstack endpoint create \ |
| 564 | $SWIFT_SERVICE \ |
Chmouel Boudjnah | ba31305 | 2013-07-10 21:03:43 +0200 | [diff] [blame] | 565 | --region RegionOne \ |
Chmouel Boudjnah | ba31305 | 2013-07-10 21:03:43 +0200 | [diff] [blame] | 566 | --publicurl "http://$SERVICE_HOST:8080/v1/AUTH_\$(tenant_id)s" \ |
| 567 | --adminurl "http://$SERVICE_HOST:8080" \ |
| 568 | --internalurl "http://$SERVICE_HOST:8080/v1/AUTH_\$(tenant_id)s" |
| 569 | fi |
| 570 | |
Steve Martinelli | 1968542 | 2014-01-24 13:02:26 -0600 | [diff] [blame] | 571 | SWIFT_TENANT_TEST1=$(openstack project create swifttenanttest1 | grep " id " | get_field 2) |
DennyZhang | 23178a9 | 2013-10-22 17:07:32 -0500 | [diff] [blame] | 572 | die_if_not_set $LINENO SWIFT_TENANT_TEST1 "Failure creating SWIFT_TENANT_TEST1" |
Steve Martinelli | 1968542 | 2014-01-24 13:02:26 -0600 | [diff] [blame] | 573 | SWIFT_USER_TEST1=$(openstack user create swiftusertest1 --password=$SWIFTUSERTEST1_PASSWORD \ |
| 574 | --project "$SWIFT_TENANT_TEST1" --email=test@example.com | grep " id " | get_field 2) |
DennyZhang | 23178a9 | 2013-10-22 17:07:32 -0500 | [diff] [blame] | 575 | die_if_not_set $LINENO SWIFT_USER_TEST1 "Failure creating SWIFT_USER_TEST1" |
Steve Martinelli | 1968542 | 2014-01-24 13:02:26 -0600 | [diff] [blame] | 576 | openstack role add --user $SWIFT_USER_TEST1 --project $SWIFT_TENANT_TEST1 $ADMIN_ROLE |
Chmouel Boudjnah | 0ce91a5 | 2013-07-05 11:59:24 +0000 | [diff] [blame] | 577 | |
Steve Martinelli | 1968542 | 2014-01-24 13:02:26 -0600 | [diff] [blame] | 578 | SWIFT_USER_TEST3=$(openstack user create swiftusertest3 --password=$SWIFTUSERTEST3_PASSWORD \ |
| 579 | --project "$SWIFT_TENANT_TEST1" --email=test3@example.com | grep " id " | get_field 2) |
DennyZhang | 23178a9 | 2013-10-22 17:07:32 -0500 | [diff] [blame] | 580 | die_if_not_set $LINENO SWIFT_USER_TEST3 "Failure creating SWIFT_USER_TEST3" |
Steve Martinelli | 1968542 | 2014-01-24 13:02:26 -0600 | [diff] [blame] | 581 | openstack role add --user $SWIFT_USER_TEST3 --project $SWIFT_TENANT_TEST1 $ANOTHER_ROLE |
Chmouel Boudjnah | 0ce91a5 | 2013-07-05 11:59:24 +0000 | [diff] [blame] | 582 | |
Steve Martinelli | 1968542 | 2014-01-24 13:02:26 -0600 | [diff] [blame] | 583 | SWIFT_TENANT_TEST2=$(openstack project create swifttenanttest2 | grep " id " | get_field 2) |
DennyZhang | 23178a9 | 2013-10-22 17:07:32 -0500 | [diff] [blame] | 584 | die_if_not_set $LINENO SWIFT_TENANT_TEST2 "Failure creating SWIFT_TENANT_TEST2" |
Steve Martinelli | 1968542 | 2014-01-24 13:02:26 -0600 | [diff] [blame] | 585 | |
| 586 | SWIFT_USER_TEST2=$(openstack user create swiftusertest2 --password=$SWIFTUSERTEST2_PASSWORD \ |
| 587 | --project "$SWIFT_TENANT_TEST2" --email=test2@example.com | grep " id " | get_field 2) |
DennyZhang | 23178a9 | 2013-10-22 17:07:32 -0500 | [diff] [blame] | 588 | die_if_not_set $LINENO SWIFT_USER_TEST2 "Failure creating SWIFT_USER_TEST2" |
Steve Martinelli | 1968542 | 2014-01-24 13:02:26 -0600 | [diff] [blame] | 589 | openstack role add --user $SWIFT_USER_TEST2 --project $SWIFT_TENANT_TEST2 $ADMIN_ROLE |
Chmouel Boudjnah | 0ce91a5 | 2013-07-05 11:59:24 +0000 | [diff] [blame] | 590 | } |
Dean Troyer | 1c6c112 | 2013-03-27 17:40:53 -0500 | [diff] [blame] | 591 | |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 592 | # init_swift() - Initialize rings |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 593 | function init_swift { |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 594 | local node_number |
| 595 | # Make sure to kill all swift processes first |
Chmouel Boudjnah | ad8b276 | 2013-01-10 15:40:01 +0100 | [diff] [blame] | 596 | swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 597 | |
Dean Troyer | 1c6c112 | 2013-03-27 17:40:53 -0500 | [diff] [blame] | 598 | # Forcibly re-create the backing filesystem |
| 599 | create_swift_disk |
| 600 | |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 601 | # This is where we create three different rings for swift with |
| 602 | # different object servers binding on different ports. |
Dean Troyer | 6ec72fa | 2013-03-13 11:44:53 -0500 | [diff] [blame] | 603 | pushd ${SWIFT_CONF_DIR} >/dev/null && { |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 604 | |
| 605 | rm -f *.builder *.ring.gz backups/*.builder backups/*.ring.gz |
| 606 | |
| 607 | swift-ring-builder object.builder create ${SWIFT_PARTITION_POWER_SIZE} ${SWIFT_REPLICAS} 1 |
| 608 | swift-ring-builder container.builder create ${SWIFT_PARTITION_POWER_SIZE} ${SWIFT_REPLICAS} 1 |
| 609 | swift-ring-builder account.builder create ${SWIFT_PARTITION_POWER_SIZE} ${SWIFT_REPLICAS} 1 |
| 610 | |
| 611 | for node_number in ${SWIFT_REPLICAS_SEQ}; do |
| 612 | swift-ring-builder object.builder add z${node_number}-127.0.0.1:$[OBJECT_PORT_BASE + 10 * (node_number - 1)]/sdb1 1 |
| 613 | swift-ring-builder container.builder add z${node_number}-127.0.0.1:$[CONTAINER_PORT_BASE + 10 * (node_number - 1)]/sdb1 1 |
| 614 | swift-ring-builder account.builder add z${node_number}-127.0.0.1:$[ACCOUNT_PORT_BASE + 10 * (node_number - 1)]/sdb1 1 |
| 615 | done |
| 616 | swift-ring-builder object.builder rebalance |
| 617 | swift-ring-builder container.builder rebalance |
| 618 | swift-ring-builder account.builder rebalance |
| 619 | } && popd >/dev/null |
| 620 | |
Dean Troyer | 64ab774 | 2012-12-28 15:38:28 -0600 | [diff] [blame] | 621 | # Create cache dir |
| 622 | sudo mkdir -p $SWIFT_AUTH_CACHE_DIR |
Attila Fazekas | 91b8d13 | 2013-01-06 22:40:09 +0100 | [diff] [blame] | 623 | sudo chown $STACK_USER $SWIFT_AUTH_CACHE_DIR |
Dean Troyer | 64ab774 | 2012-12-28 15:38:28 -0600 | [diff] [blame] | 624 | rm -f $SWIFT_AUTH_CACHE_DIR/* |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 625 | } |
| 626 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 627 | function install_swift { |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 628 | git_clone $SWIFT_REPO $SWIFT_DIR $SWIFT_BRANCH |
Dean Troyer | 253a1a3 | 2013-04-01 18:23:22 -0500 | [diff] [blame] | 629 | setup_develop $SWIFT_DIR |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 630 | if is_apache_enabled_service swift; then |
| 631 | install_apache_wsgi |
| 632 | fi |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 633 | } |
| 634 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 635 | function install_swiftclient { |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 636 | git_clone $SWIFTCLIENT_REPO $SWIFTCLIENT_DIR $SWIFTCLIENT_BRANCH |
Dean Troyer | 253a1a3 | 2013-04-01 18:23:22 -0500 | [diff] [blame] | 637 | setup_develop $SWIFTCLIENT_DIR |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 638 | } |
| 639 | |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 640 | # start_swift() - Start running processes, including screen |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 641 | function start_swift { |
Chmouel Boudjnah | 8ecbb38 | 2013-03-12 12:15:17 +0100 | [diff] [blame] | 642 | # (re)start memcached to make sure we have a clean memcache. |
| 643 | restart_service memcached |
| 644 | |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 645 | # Start rsync |
Vincent Untz | c18b965 | 2012-12-04 12:36:34 +0100 | [diff] [blame] | 646 | if is_ubuntu; then |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 647 | sudo /etc/init.d/rsync restart || : |
Attila Fazekas | 0e57b96 | 2014-02-28 09:09:52 +0100 | [diff] [blame] | 648 | elif [ -e /etc/xinetd.d/rsync ]; then |
| 649 | start_service xinetd |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 650 | else |
Attila Fazekas | 0e57b96 | 2014-02-28 09:09:52 +0100 | [diff] [blame] | 651 | start_service rsyncd |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 652 | fi |
| 653 | |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 654 | if is_apache_enabled_service swift; then |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 655 | restart_apache_server |
| 656 | swift-init --run-dir=${SWIFT_DATA_DIR}/run rest start |
| 657 | screen_it s-proxy "cd $SWIFT_DIR && sudo tail -f /var/log/$APACHE_NAME/proxy-server" |
| 658 | if [[ ${SWIFT_REPLICAS} == 1 ]]; then |
| 659 | for type in object container account; do |
| 660 | screen_it s-${type} "cd $SWIFT_DIR && sudo tail -f /var/log/$APACHE_NAME/${type}-server-1" |
| 661 | done |
| 662 | fi |
| 663 | return 0 |
| 664 | fi |
| 665 | |
Sean Dague | 101b424 | 2013-10-22 08:47:11 -0400 | [diff] [blame] | 666 | # By default with only one replica we are launching the proxy, |
| 667 | # container, account and object server in screen in foreground and |
| 668 | # other services in background. If we have SWIFT_REPLICAS set to something |
| 669 | # greater than one we first spawn all the swift services then kill the proxy |
| 670 | # service so we can run it in foreground in screen. ``swift-init ... |
| 671 | # {stop|restart}`` exits with '1' if no servers are running, ignore it just |
| 672 | # in case |
| 673 | swift-init --run-dir=${SWIFT_DATA_DIR}/run all restart || true |
| 674 | if [[ ${SWIFT_REPLICAS} == 1 ]]; then |
Chmouel Boudjnah | 0c3a558 | 2013-03-06 10:58:33 +0100 | [diff] [blame] | 675 | todo="object container account" |
Sean Dague | 101b424 | 2013-10-22 08:47:11 -0400 | [diff] [blame] | 676 | fi |
| 677 | for type in proxy ${todo}; do |
| 678 | swift-init --run-dir=${SWIFT_DATA_DIR}/run ${type} stop || true |
| 679 | done |
| 680 | screen_it s-proxy "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-proxy-server ${SWIFT_CONF_DIR}/proxy-server.conf -v" |
| 681 | if [[ ${SWIFT_REPLICAS} == 1 ]]; then |
| 682 | for type in object container account; do |
| 683 | screen_it s-${type} "cd $SWIFT_DIR && $SWIFT_DIR/bin/swift-${type}-server ${SWIFT_CONF_DIR}/${type}-server/1.conf -v" |
| 684 | done |
| 685 | fi |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 686 | } |
| 687 | |
| 688 | # stop_swift() - Stop running processes (non-screen) |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 689 | function stop_swift { |
zhang-hare | d98a5d0 | 2013-06-21 18:18:02 +0800 | [diff] [blame] | 690 | |
| 691 | if is_apache_enabled_service swift; then |
| 692 | swift-init --run-dir=${SWIFT_DATA_DIR}/run rest stop && return 0 |
| 693 | fi |
| 694 | |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 695 | # screen normally killed by unstack.sh |
Dean Troyer | 995eb92 | 2013-03-07 16:11:40 -0600 | [diff] [blame] | 696 | if type -p swift-init >/dev/null; then |
Chmouel Boudjnah | 0c3a558 | 2013-03-06 10:58:33 +0100 | [diff] [blame] | 697 | swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true |
| 698 | fi |
Chmouel Boudjnah | f36a9b2 | 2014-02-03 23:44:47 +0100 | [diff] [blame] | 699 | # Dump all of the servers |
Dean Troyer | 1eae3e1 | 2014-03-06 11:49:22 -0600 | [diff] [blame] | 700 | # Maintain the iteration as screen_stop() has some desirable side-effects |
| 701 | for type in proxy object container account; do |
| 702 | screen_stop s-${type} |
| 703 | done |
| 704 | # Blast out any stragglers |
Chmouel Boudjnah | f36a9b2 | 2014-02-03 23:44:47 +0100 | [diff] [blame] | 705 | pkill -f swift- |
Attila Fazekas | ece6a33 | 2012-11-29 14:19:41 +0100 | [diff] [blame] | 706 | } |
| 707 | |
| 708 | # Restore xtrace |
| 709 | $XTRACE |
Sean Dague | 584d90e | 2013-03-29 14:34:53 -0400 | [diff] [blame] | 710 | |
Adam Spiers | 6a5aa7c | 2013-10-24 11:27:02 +0100 | [diff] [blame] | 711 | # Tell emacs to use shell-script-mode |
| 712 | ## Local variables: |
| 713 | ## mode: shell-script |
| 714 | ## End: |