Merge "Split disk creation out of configure_swift()"
This commit is contained in:
commit
a173376ea1
5
lib/nova
5
lib/nova
@ -663,6 +663,11 @@ function start_nova() {
|
|||||||
screen_it n-xvnc "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-xvpvncproxy --config-file $NOVA_CONF"
|
screen_it n-xvnc "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-xvpvncproxy --config-file $NOVA_CONF"
|
||||||
screen_it n-spice "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-spicehtml5proxy --config-file $NOVA_CONF --web $SPICE_DIR"
|
screen_it n-spice "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-spicehtml5proxy --config-file $NOVA_CONF --web $SPICE_DIR"
|
||||||
screen_it n-cauth "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-consoleauth"
|
screen_it n-cauth "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-consoleauth"
|
||||||
|
|
||||||
|
# Starting the nova-objectstore only if swift3 service is not enabled.
|
||||||
|
# Swift will act as s3 objectstore.
|
||||||
|
is_service_enabled swift3 || \
|
||||||
|
screen_it n-obj "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-objectstore"
|
||||||
}
|
}
|
||||||
|
|
||||||
# stop_nova() - Stop running processes (non-screen)
|
# stop_nova() - Stop running processes (non-screen)
|
||||||
|
104
lib/swift
104
lib/swift
@ -111,54 +111,8 @@ function configure_swift() {
|
|||||||
# Make sure to kill all swift processes first
|
# Make sure to kill all swift processes first
|
||||||
swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true
|
swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true
|
||||||
|
|
||||||
# First do a bit of setup by creating the directories and
|
sudo mkdir -p ${SWIFT_CONF_DIR}/{object,container,account}-server
|
||||||
# changing the permissions so we can run it as our user.
|
sudo chown -R $USER: ${SWIFT_CONF_DIR}
|
||||||
|
|
||||||
USER_GROUP=$(id -g)
|
|
||||||
sudo mkdir -p ${SWIFT_DATA_DIR}/{drives,cache,run,logs}
|
|
||||||
sudo chown -R $USER:${USER_GROUP} ${SWIFT_DATA_DIR}
|
|
||||||
|
|
||||||
# Create a loopback disk and format it to XFS.
|
|
||||||
if [[ -e ${SWIFT_DATA_DIR}/drives/images/swift.img ]]; then
|
|
||||||
if egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then
|
|
||||||
sudo umount ${SWIFT_DATA_DIR}/drives/sdb1
|
|
||||||
sudo rm -f ${SWIFT_DATA_DIR}/drives/images/swift.img
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p ${SWIFT_DATA_DIR}/drives/images
|
|
||||||
sudo touch ${SWIFT_DATA_DIR}/drives/images/swift.img
|
|
||||||
sudo chown $USER: ${SWIFT_DATA_DIR}/drives/images/swift.img
|
|
||||||
|
|
||||||
dd if=/dev/zero of=${SWIFT_DATA_DIR}/drives/images/swift.img \
|
|
||||||
bs=1024 count=0 seek=${SWIFT_LOOPBACK_DISK_SIZE}
|
|
||||||
|
|
||||||
# Make a fresh XFS filesystem
|
|
||||||
mkfs.xfs -f -i size=1024 ${SWIFT_DATA_DIR}/drives/images/swift.img
|
|
||||||
|
|
||||||
# Mount the disk with mount options to make it as efficient as possible
|
|
||||||
mkdir -p ${SWIFT_DATA_DIR}/drives/sdb1
|
|
||||||
if ! egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then
|
|
||||||
sudo mount -t xfs -o loop,noatime,nodiratime,nobarrier,logbufs=8 \
|
|
||||||
${SWIFT_DATA_DIR}/drives/images/swift.img ${SWIFT_DATA_DIR}/drives/sdb1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create a link to the above mount and
|
|
||||||
# create all of the directories needed to emulate a few different servers
|
|
||||||
for node_number in ${SWIFT_REPLICAS_SEQ}; do
|
|
||||||
sudo ln -sf ${SWIFT_DATA_DIR}/drives/sdb1/$node_number ${SWIFT_DATA_DIR}/$node_number;
|
|
||||||
drive=${SWIFT_DATA_DIR}/drives/sdb1/${node_number}
|
|
||||||
node=${SWIFT_DATA_DIR}/${node_number}/node
|
|
||||||
node_device=${node}/sdb1
|
|
||||||
[[ -d $node ]] && continue
|
|
||||||
[[ -d $drive ]] && continue
|
|
||||||
sudo install -o ${USER} -g $USER_GROUP -d $drive
|
|
||||||
sudo install -o ${USER} -g $USER_GROUP -d $node_device
|
|
||||||
sudo chown -R $USER: ${node}
|
|
||||||
done
|
|
||||||
|
|
||||||
sudo mkdir -p ${SWIFT_CONF_DIR}/{object,container,account}-server
|
|
||||||
sudo chown -R $USER: ${SWIFT_CONF_DIR}
|
|
||||||
|
|
||||||
if [[ "$SWIFT_CONF_DIR" != "/etc/swift" ]]; then
|
if [[ "$SWIFT_CONF_DIR" != "/etc/swift" ]]; then
|
||||||
# Some swift tools are hard-coded to use ``/etc/swift`` and are apparently not going to be fixed.
|
# Some swift tools are hard-coded to use ``/etc/swift`` and are apparently not going to be fixed.
|
||||||
@ -332,12 +286,66 @@ function configure_swiftclient() {
|
|||||||
setup_develop $SWIFTCLIENT_DIR
|
setup_develop $SWIFTCLIENT_DIR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# create_swift_disk - Create Swift backing disk
|
||||||
|
function create_swift_disk() {
|
||||||
|
local node_number
|
||||||
|
|
||||||
|
# First do a bit of setup by creating the directories and
|
||||||
|
# changing the permissions so we can run it as our user.
|
||||||
|
|
||||||
|
USER_GROUP=$(id -g)
|
||||||
|
sudo mkdir -p ${SWIFT_DATA_DIR}/{drives,cache,run,logs}
|
||||||
|
sudo chown -R $USER:${USER_GROUP} ${SWIFT_DATA_DIR}
|
||||||
|
|
||||||
|
# Create a loopback disk and format it to XFS.
|
||||||
|
if [[ -e ${SWIFT_DATA_DIR}/drives/images/swift.img ]]; then
|
||||||
|
if egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then
|
||||||
|
sudo umount ${SWIFT_DATA_DIR}/drives/sdb1
|
||||||
|
sudo rm -f ${SWIFT_DATA_DIR}/drives/images/swift.img
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p ${SWIFT_DATA_DIR}/drives/images
|
||||||
|
sudo touch ${SWIFT_DATA_DIR}/drives/images/swift.img
|
||||||
|
sudo chown $USER: ${SWIFT_DATA_DIR}/drives/images/swift.img
|
||||||
|
|
||||||
|
dd if=/dev/zero of=${SWIFT_DATA_DIR}/drives/images/swift.img \
|
||||||
|
bs=1024 count=0 seek=${SWIFT_LOOPBACK_DISK_SIZE}
|
||||||
|
|
||||||
|
# Make a fresh XFS filesystem
|
||||||
|
mkfs.xfs -f -i size=1024 ${SWIFT_DATA_DIR}/drives/images/swift.img
|
||||||
|
|
||||||
|
# Mount the disk with mount options to make it as efficient as possible
|
||||||
|
mkdir -p ${SWIFT_DATA_DIR}/drives/sdb1
|
||||||
|
if ! egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then
|
||||||
|
sudo mount -t xfs -o loop,noatime,nodiratime,nobarrier,logbufs=8 \
|
||||||
|
${SWIFT_DATA_DIR}/drives/images/swift.img ${SWIFT_DATA_DIR}/drives/sdb1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create a link to the above mount and
|
||||||
|
# create all of the directories needed to emulate a few different servers
|
||||||
|
for node_number in ${SWIFT_REPLICAS_SEQ}; do
|
||||||
|
sudo ln -sf ${SWIFT_DATA_DIR}/drives/sdb1/$node_number ${SWIFT_DATA_DIR}/$node_number;
|
||||||
|
drive=${SWIFT_DATA_DIR}/drives/sdb1/${node_number}
|
||||||
|
node=${SWIFT_DATA_DIR}/${node_number}/node
|
||||||
|
node_device=${node}/sdb1
|
||||||
|
[[ -d $node ]] && continue
|
||||||
|
[[ -d $drive ]] && continue
|
||||||
|
sudo install -o ${USER} -g $USER_GROUP -d $drive
|
||||||
|
sudo install -o ${USER} -g $USER_GROUP -d $node_device
|
||||||
|
sudo chown -R $USER: ${node}
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# init_swift() - Initialize rings
|
# init_swift() - Initialize rings
|
||||||
function init_swift() {
|
function init_swift() {
|
||||||
local node_number
|
local node_number
|
||||||
# Make sure to kill all swift processes first
|
# Make sure to kill all swift processes first
|
||||||
swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true
|
swift-init --run-dir=${SWIFT_DATA_DIR}/run all stop || true
|
||||||
|
|
||||||
|
# Forcibly re-create the backing filesystem
|
||||||
|
create_swift_disk
|
||||||
|
|
||||||
# This is where we create three different rings for swift with
|
# This is where we create three different rings for swift with
|
||||||
# different object servers binding on different ports.
|
# different object servers binding on different ports.
|
||||||
pushd ${SWIFT_CONF_DIR} >/dev/null && {
|
pushd ${SWIFT_CONF_DIR} >/dev/null && {
|
||||||
|
6
stack.sh
6
stack.sh
@ -1055,12 +1055,6 @@ if is_service_enabled ceilometer; then
|
|||||||
start_ceilometer
|
start_ceilometer
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Starting the nova-objectstore only if swift3 service is not enabled.
|
|
||||||
# Swift will act as s3 objectstore.
|
|
||||||
is_service_enabled swift3 || \
|
|
||||||
screen_it n-obj "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-objectstore"
|
|
||||||
|
|
||||||
|
|
||||||
# Configure and launch heat engine, api and metadata
|
# Configure and launch heat engine, api and metadata
|
||||||
if is_service_enabled heat; then
|
if is_service_enabled heat; then
|
||||||
# Initialize heat, including replacing nova flavors
|
# Initialize heat, including replacing nova flavors
|
||||||
|
Loading…
Reference in New Issue
Block a user