Format storage as xfs and mount it. Also, fetch ring when built.
This commit is contained in:
parent
a60e6d4913
commit
54b673e230
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
set -ue
|
||||
set -u
|
||||
|
||||
DEFAULT_ETH=$(ip route | grep default | awk '{ print $5 }')
|
||||
IP=$(ifconfig $DEFAULT_ETH | grep 'inet addr' | awk '{ print $2 }' | cut -d: -f2)
|
||||
|
@ -10,6 +10,8 @@ STORAGE_LOCAL_NET_IP=$IP
|
|||
|
||||
PACKAGES="swift swift-account swift-container swift-object xfsprogs"
|
||||
|
||||
DEVICE=xvda2
|
||||
|
||||
function set_swift_hash {
|
||||
# TODO: Do this with augeas and put in a utility function for use elsewhere
|
||||
cat >/etc/swift/swift.conf <<EOF
|
||||
|
@ -71,3 +73,17 @@ for i in $subconf ; do
|
|||
echo -e "[$1-$i]\n" >>/etc/swift/$1-server.conf
|
||||
done
|
||||
}
|
||||
|
||||
function setup_storage {
|
||||
# TODO: remove previous lines from fstab
|
||||
mkdir -p /srv/node
|
||||
cat /proc/mounts | grep $DEVICE >/dev/null
|
||||
if [[ $? == 0 ]] ; then
|
||||
umount $(cat /proc/mounts | grep $DEVICE | awk '{ print $2 }')
|
||||
fi
|
||||
mkfs.xfs -f -i size=1024 /dev/$DEVICE
|
||||
echo "/dev/$DEVICE /srv/node/$DEVICE xfs noatime,nodiratime,nobarrier,logbufs=8 0 0" >> /etc/fstab
|
||||
mkdir -p /srv/node/$DEVICE
|
||||
mount /srv/node/$DEVICE
|
||||
chown -R swift:swift /srv/node
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/bin/bash
|
||||
set -ue
|
||||
# test
|
||||
set -u
|
||||
FORMULA_DIR=$(dirname $0)
|
||||
ARG0=${0##*/}
|
||||
|
||||
|
@ -19,20 +20,29 @@ function install_hook {
|
|||
DEBIAN_FRONTEND=noninteractive apt-get -y install $i
|
||||
done
|
||||
[[ ! -d /etc/swift ]] && mkdir /etc/swift
|
||||
chown swift:swift /etc/swift
|
||||
configure_rsyncd
|
||||
setup_storage
|
||||
for i in account container object ; do create_server_conf $i ; done
|
||||
set_swift_hash "TESTINGHASH"
|
||||
}
|
||||
|
||||
function proxy_joined {
|
||||
relation-set zone=1
|
||||
relation-set ip=$IP
|
||||
relation-set device=xvde2
|
||||
relation-set zone=1 hostname=$(hostname -f) device=$DEVICE
|
||||
}
|
||||
|
||||
function proxy_changed {
|
||||
URL=`relation-get update_url`
|
||||
[[ -z $URL ]] && exit 0
|
||||
echo "$URL" >>/tmp/url
|
||||
rm -rf /etc/swift/*.gz
|
||||
for i in account object container ; do
|
||||
cd /etc/swift
|
||||
echo "Fetching $URL/$i.ring.gz"
|
||||
wget $URL/$i.ring.gz
|
||||
done
|
||||
chown swift -R /etc/swift
|
||||
swift-init all start
|
||||
}
|
||||
|
||||
case $ARG0 in
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
ensemble: formula
|
||||
name: swift-storage
|
||||
revision: 7
|
||||
revision: 19
|
||||
summary: "Swift storage node"
|
||||
description: |
|
||||
Contains swift-object, swift-container and swift-account servers.
|
||||
|
@ -10,3 +10,6 @@ provides:
|
|||
requires:
|
||||
swift-proxy:
|
||||
interface: swift
|
||||
peers:
|
||||
swift-ring:
|
||||
interface: swift
|
||||
|
|
Loading…
Reference in New Issue