f490260de7
We are using cinder block devices more and more. Update launch node so that it can attach a preexisting cinder volume against a new nova server on first boot. This will allow puppet or other config management to format and mount that block device into the VMs filesystem. Change-Id: Ic121cdc06dcbea0e38e8d0ff8946e999af3d727e
37 lines
1.1 KiB
Bash
37 lines
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
# Copyright 2014 Hewlett-Packard Development Company, L.P.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
# Sigh. nova volume-attach is not immediate, but there is no status to track
|
|
sleep 120
|
|
|
|
if [ -b /dev/vdc ]; then
|
|
DEV='/dev/vdc'
|
|
elif [ -b /dev/xvdb ]; then
|
|
DEV='/dev/xvdb'
|
|
else
|
|
echo "Could not mount volume"
|
|
exit 1
|
|
fi
|
|
if ! blkid | grep $DEV | grep ext4 ; then
|
|
mkfs.ext4 ${DEV}
|
|
fi
|
|
perl -nle "m,${DEV}, || print" -i /etc/fstab
|
|
if [ ! -d /srv ] ; then
|
|
mkdir -p /srv
|
|
fi
|
|
echo "${DEV} /srv ext4 errors=remount-ro,barrier=0 0 2" >> /etc/fstab
|
|
mount -a
|