Add swift support.
Based on github.sh/cloudbuilders/deploy.sh/swift. This is a WIP branch.
This commit is contained in:
parent
e70806452d
commit
28fa4e8d94
9 changed files with 271 additions and 1 deletions
19
files/apts/swift
Normal file
19
files/apts/swift
Normal file
|
@ -0,0 +1,19 @@
|
|||
curl
|
||||
gcc
|
||||
memcached
|
||||
memcached
|
||||
python-configobj
|
||||
python-coverage
|
||||
python-dev
|
||||
python-eventlet
|
||||
python-greenlet
|
||||
python-netifaces
|
||||
python-nose
|
||||
python-nose
|
||||
python-pastedeploy
|
||||
python-setuptools
|
||||
python-simplejson
|
||||
python-webob
|
||||
python-xattr
|
||||
sqlite3
|
||||
xfsprogs
|
19
files/swift-account-server.conf
Normal file
19
files/swift-account-server.conf
Normal file
|
@ -0,0 +1,19 @@
|
|||
[DEFAULT]
|
||||
devices = %NODE_PATH%/node
|
||||
mount_check = false
|
||||
bind_port = %BIND_PORT%
|
||||
user = stack
|
||||
log_facility = LOG_LOCAL%LOG_FACILITY%
|
||||
|
||||
[pipeline:main]
|
||||
pipeline = account-server
|
||||
|
||||
[app:account-server]
|
||||
use = egg:swift#account
|
||||
|
||||
[account-replicator]
|
||||
vm_test_mode = yes
|
||||
|
||||
[account-auditor]
|
||||
|
||||
[account-reaper]
|
21
files/swift-container-server.conf
Normal file
21
files/swift-container-server.conf
Normal file
|
@ -0,0 +1,21 @@
|
|||
[DEFAULT]
|
||||
devices = %NODE_PATH%/node
|
||||
mount_check = false
|
||||
bind_port = %BIND_PORT%
|
||||
user = stack
|
||||
log_facility = LOG_LOCAL%LOG_FACILITY%
|
||||
|
||||
[pipeline:main]
|
||||
pipeline = container-server
|
||||
|
||||
[app:container-server]
|
||||
use = egg:swift#container
|
||||
|
||||
[container-replicator]
|
||||
vm_test_mode = yes
|
||||
|
||||
[container-updater]
|
||||
|
||||
[container-auditor]
|
||||
|
||||
[container-sync]
|
19
files/swift-object-server.conf
Normal file
19
files/swift-object-server.conf
Normal file
|
@ -0,0 +1,19 @@
|
|||
[DEFAULT]
|
||||
devices = %NODE_PATH%/node
|
||||
mount_check = false
|
||||
bind_port = %BIND_PORT%
|
||||
user = stack
|
||||
log_facility = LOG_LOCAL%LOG_FACILITY%
|
||||
|
||||
[pipeline:main]
|
||||
pipeline = object-server
|
||||
|
||||
[app:object-server]
|
||||
use = egg:swift#object
|
||||
|
||||
[object-replicator]
|
||||
vm_test_mode = yes
|
||||
|
||||
[object-updater]
|
||||
|
||||
[object-auditor]
|
25
files/swift-proxy-server.conf
Normal file
25
files/swift-proxy-server.conf
Normal file
|
@ -0,0 +1,25 @@
|
|||
[DEFAULT]
|
||||
bind_port = 8080
|
||||
user = stack
|
||||
log_facility = LOG_LOCAL1
|
||||
|
||||
[pipeline:main]
|
||||
pipeline = healthcheck cache tempauth proxy-server
|
||||
|
||||
[app:proxy-server]
|
||||
use = egg:swift#proxy
|
||||
allow_account_management = true
|
||||
|
||||
[filter:tempauth]
|
||||
use = egg:swift#tempauth
|
||||
user_admin_admin = admin .admin .reseller_admin
|
||||
user_test_tester = testing .admin
|
||||
user_test2_tester2 = testing2 .admin
|
||||
user_test_tester3 = testing3
|
||||
bind_ip = ${MY_IP}
|
||||
|
||||
[filter:healthcheck]
|
||||
use = egg:swift#healthcheck
|
||||
|
||||
[filter:cache]
|
||||
use = egg:swift#memcache
|
79
files/swift-rsyncd.conf
Normal file
79
files/swift-rsyncd.conf
Normal file
|
@ -0,0 +1,79 @@
|
|||
uid = stack
|
||||
gid = stack
|
||||
log file = /var/log/rsyncd.log
|
||||
pid file = /var/run/rsyncd.pid
|
||||
address = 127.0.0.1
|
||||
|
||||
[account6012]
|
||||
max connections = 25
|
||||
path = %SWIFT_LOOPBACK_DISK_SIZE%/1/node/
|
||||
read only = false
|
||||
lock file = /var/lock/account6012.lock
|
||||
|
||||
[account6022]
|
||||
max connections = 25
|
||||
path = %SWIFT_LOOPBACK_DISK_SIZE%/2/node/
|
||||
read only = false
|
||||
lock file = /var/lock/account6022.lock
|
||||
|
||||
[account6032]
|
||||
max connections = 25
|
||||
path = %SWIFT_LOOPBACK_DISK_SIZE%/3/node/
|
||||
read only = false
|
||||
lock file = /var/lock/account6032.lock
|
||||
|
||||
[account6042]
|
||||
max connections = 25
|
||||
path = %SWIFT_LOOPBACK_DISK_SIZE%/4/node/
|
||||
read only = false
|
||||
lock file = /var/lock/account6042.lock
|
||||
|
||||
|
||||
[container6011]
|
||||
max connections = 25
|
||||
path = %SWIFT_LOOPBACK_DISK_SIZE%/1/node/
|
||||
read only = false
|
||||
lock file = /var/lock/container6011.lock
|
||||
|
||||
[container6021]
|
||||
max connections = 25
|
||||
path = %SWIFT_LOOPBACK_DISK_SIZE%/2/node/
|
||||
read only = false
|
||||
lock file = /var/lock/container6021.lock
|
||||
|
||||
[container6031]
|
||||
max connections = 25
|
||||
path = %SWIFT_LOOPBACK_DISK_SIZE%/3/node/
|
||||
read only = false
|
||||
lock file = /var/lock/container6031.lock
|
||||
|
||||
[container6041]
|
||||
max connections = 25
|
||||
path = %SWIFT_LOOPBACK_DISK_SIZE%/4/node/
|
||||
read only = false
|
||||
lock file = /var/lock/container6041.lock
|
||||
|
||||
|
||||
[object6010]
|
||||
max connections = 25
|
||||
path = %SWIFT_LOOPBACK_DISK_SIZE%/1/node/
|
||||
read only = false
|
||||
lock file = /var/lock/object6010.lock
|
||||
|
||||
[object6020]
|
||||
max connections = 25
|
||||
path = %SWIFT_LOOPBACK_DISK_SIZE%/2/node/
|
||||
read only = false
|
||||
lock file = /var/lock/object6020.lock
|
||||
|
||||
[object6030]
|
||||
max connections = 25
|
||||
path = %SWIFT_LOOPBACK_DISK_SIZE%/3/node/
|
||||
read only = false
|
||||
lock file = /var/lock/object6030.lock
|
||||
|
||||
[object6040]
|
||||
max connections = 25
|
||||
path = %SWIFT_LOOPBACK_DISK_SIZE%/4/node/
|
||||
read only = false
|
||||
lock file = /var/lock/object6040.lock
|
3
files/swift.conf
Normal file
3
files/swift.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
[swift-hash]
|
||||
# random unique string that can never change (DO NOT LOSE)
|
||||
swift_hash_path_suffix = %SWIFT_HASH%
|
83
stack.sh
83
stack.sh
|
@ -150,9 +150,10 @@ KEYSTONE_DIR=$DEST/keystone
|
|||
NOVACLIENT_DIR=$DEST/python-novaclient
|
||||
OPENSTACKX_DIR=$DEST/openstackx
|
||||
NOVNC_DIR=$DEST/noVNC
|
||||
SWIFT_DIR=$DEST/swift
|
||||
|
||||
# Specify which services to launch. These generally correspond to screen tabs
|
||||
ENABLED_SERVICES=${ENABLED_SERVICES:-g-api,g-reg,key,n-api,n-cpu,n-net,n-sch,n-vnc,horizon,mysql,rabbit}
|
||||
ENABLED_SERVICES=${ENABLED_SERVICES:-g-api,g-reg,key,n-api,n-cpu,n-net,n-sch,n-vnc,horizon,mysql,rabbit,swift}
|
||||
|
||||
# Nova hypervisor configuration. We default to libvirt whth **kvm** but will
|
||||
# drop back to **qemu** if we are unable to load the kvm module. Stack.sh can
|
||||
|
@ -270,6 +271,14 @@ read_password RABBIT_PASSWORD "ENTER A PASSWORD TO USE FOR RABBIT."
|
|||
# Glance connection info. Note the port must be specified.
|
||||
GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$HOST_IP:9292}
|
||||
|
||||
# SWIFT
|
||||
# -----
|
||||
#
|
||||
# Location of SWIFT drives
|
||||
SWIFT_DRIVE_LOCATION=${SWIFT_DRIVE_LOCATION:-/srv}
|
||||
|
||||
# Size of the loopback disks
|
||||
SWIFT_LOOPBACK_DISK_SIZE=${SWIFT_LOOPBACK_DISK_SIZE:-1000000}
|
||||
|
||||
# Keystone
|
||||
# --------
|
||||
|
@ -349,6 +358,8 @@ function git_clone {
|
|||
|
||||
# compute service
|
||||
git_clone $NOVA_REPO $NOVA_DIR $NOVA_BRANCH
|
||||
# storage service
|
||||
git_clone $SWIFT_REPO $SWIFT_DIR $SWIFT_BRANCH
|
||||
# image catalog service
|
||||
git_clone $GLANCE_REPO $GLANCE_DIR $GLANCE_BRANCH
|
||||
# unified auth system (manages accounts/tokens)
|
||||
|
@ -370,6 +381,7 @@ git_clone $OPENSTACKX_REPO $OPENSTACKX_DIR $OPENSTACKX_BRANCH
|
|||
# setup our checkouts so they are installed into python path
|
||||
# allowing ``import nova`` or ``import glance.client``
|
||||
cd $KEYSTONE_DIR; sudo python setup.py develop
|
||||
cd $SWIFT_DIR; sudo python setup.py develop
|
||||
cd $GLANCE_DIR; sudo python setup.py develop
|
||||
cd $NOVACLIENT_DIR; sudo python setup.py develop
|
||||
cd $NOVA_DIR; sudo python setup.py develop
|
||||
|
@ -580,6 +592,75 @@ if [[ "$ENABLED_SERVICES" =~ "n-net" ]]; then
|
|||
mkdir -p $NOVA_DIR/networks
|
||||
fi
|
||||
|
||||
# Storage Service
|
||||
if [[ "$ENABLED_SERVICES" =~ "swift" ]];then
|
||||
mkdir -p ${SWIFT_DRIVE_LOCATION}/drives
|
||||
local s=${SWIFT_DRIVE_LOCATION}/drives/sdb1 # Shortcut variable
|
||||
|
||||
# Create a loopback disk and format it with XFS.
|
||||
if [[ ! -e ${SWIFT_DRIVE_LOCATION}/swift-disk ]];then
|
||||
dd if=/dev/zero of=${SWIFT_DRIVE_LOCATION}/swift-disk bs=1024 count=0 seek=${SWIFT_LOOPBACK_DISK_SIZE}
|
||||
mkfs.xfs -f -i size=1024 ${SWIFT_DRIVE_LOCATION}/swift-disk
|
||||
fi
|
||||
|
||||
# Add the mountpoint to fstab
|
||||
if ! egrep -q "^${SWIFT_DRIVE_LOCATION}/swift-disk" /etc/fstab;then
|
||||
echo "# Added by devstack" | tee -a /etc/fstab
|
||||
echo "${SWIFT_DRIVE_LOCATION}/swift-disk ${s} xfs loop,noatime,nodiratime,nobarrier,logbufs=8 0 0" | \
|
||||
tee -a /etc/fstab
|
||||
fi
|
||||
|
||||
# Create and mount drives.
|
||||
mkdir -p ${s}
|
||||
mount ${s}
|
||||
mkdir ${s}/{1..4}
|
||||
|
||||
# Create directories
|
||||
install -g stack -o stack -d /etc/swift/{object,container,account}-server \
|
||||
${SWIFT_DRIVE_LOCATION}/{1..4}/node/sdb1 /var/run/swift
|
||||
|
||||
# Adjust rc.local to always have a /var/run/swift on reboot
|
||||
# created and chown to our user.
|
||||
# TODO (chmou): We may not have a "exit 0"
|
||||
sed -i '/^exit 0/d' /etc/rc.local
|
||||
cat <<EOF>>/etc/rc.local
|
||||
mkdir -p /var/run/swift
|
||||
chown stack: /var/run/swift
|
||||
exit 0
|
||||
EOF
|
||||
|
||||
# Add rsync file
|
||||
sed -e "s/%SWIFT_LOOPBACK_DISK_SIZE%/$SWIFT_DRIVE_LOCATION/" $FILES/swift-rsyncd.conf > /etc/rsyncd.conf
|
||||
|
||||
# Copy proxy-server configuration
|
||||
cp $FILES/swift-proxy-server.conf /etc/swift/
|
||||
|
||||
# Generate swift.conf, we need to have the swift-hash being random
|
||||
# and unique.
|
||||
local SWIFT_HASH=$(od -t x8 -N 8 -A n </dev/random)
|
||||
sed -e "s/%SWIFT_HASH%/$SWIFT_HASH/" $FILES/swift.conf > /etc/swift/swift.conf
|
||||
|
||||
# We need to generate a object/account/proxy configuration
|
||||
# emulating 4 nodes on different ports we have a litle function
|
||||
# that help us doing that.
|
||||
function generate_swift_configuration() {
|
||||
local server_type=$1
|
||||
local bind_port=$2
|
||||
local log_facility=$3
|
||||
for node_number in {1..4};do
|
||||
node_path=${SWIFT_DRIVE_LOCATION}/${node_number}/node
|
||||
sed -e "s/%NODE_PATH%/${node_path}/;s/%BIND_PORT%/${bind_port}/;s/%LOG_FACILITY%/${log_facility}/" \
|
||||
$FILES/swift-${server_type}-server.conf > /etc/swift/${server_type}-server/${node_number}.conf
|
||||
bind_port=$(( ${bind_port} + 10 ))
|
||||
log_facility=$(( ${log_facility} + 1 ))
|
||||
done
|
||||
}
|
||||
generate_swift_configuration object 6010 2
|
||||
generate_swift_configuration container 6011 2
|
||||
generate_swift_configuration account 6012 2
|
||||
|
||||
fi
|
||||
|
||||
# Volume Service
|
||||
# --------------
|
||||
|
||||
|
|
4
stackrc
4
stackrc
|
@ -2,6 +2,10 @@
|
|||
NOVA_REPO=https://github.com/cloudbuilders/nova.git
|
||||
NOVA_BRANCH=diablo
|
||||
|
||||
# storage service
|
||||
SWIFT_REPO=https://github.com/openstack/swift.git
|
||||
SWIFT_BRANCH=diablo
|
||||
|
||||
# image catalog service
|
||||
GLANCE_REPO=https://github.com/cloudbuilders/glance.git
|
||||
GLANCE_BRANCH=diablo
|
||||
|
|
Loading…
Reference in a new issue