Merge remote-tracking branch 'cloudbuilders/master'
Conflicts: stack.sh
This commit is contained in:
commit
698fc619b7
26
stack.sh
26
stack.sh
@ -91,8 +91,8 @@ if [[ $EUID -eq 0 ]]; then
|
|||||||
|
|
||||||
# since this script runs as a normal user, we need to give that user
|
# since this script runs as a normal user, we need to give that user
|
||||||
# ability to run sudo
|
# ability to run sudo
|
||||||
apt-get update
|
apt_get update
|
||||||
apt-get install -y sudo
|
apt_get install sudo
|
||||||
|
|
||||||
if ! getent passwd stack >/dev/null; then
|
if ! getent passwd stack >/dev/null; then
|
||||||
echo "Creating a user called stack"
|
echo "Creating a user called stack"
|
||||||
@ -144,6 +144,14 @@ if [ ! -n "$HOST_IP" ]; then
|
|||||||
HOST_IP=`LC_ALL=C /sbin/ifconfig | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
|
HOST_IP=`LC_ALL=C /sbin/ifconfig | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# apt-get wrapper to just get arguments set correctly
|
||||||
|
function apt_get() {
|
||||||
|
local sudo="sudo"
|
||||||
|
[ "$(id -u)" = "0" ] && sudo=""
|
||||||
|
$sudo DEBIAN_FRONTEND=noninteractive apt-get \
|
||||||
|
--option "Dpkg::Options::=--force-confold" --assume-yes "$@"
|
||||||
|
}
|
||||||
|
|
||||||
# Generic helper to configure passwords
|
# Generic helper to configure passwords
|
||||||
function read_password {
|
function read_password {
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
@ -284,8 +292,8 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
# install apt requirements
|
# install apt requirements
|
||||||
sudo apt-get update
|
apt_get update
|
||||||
sudo apt-get install -qqy `cat $FILES/apts/* | cut -d\# -f1 | grep -Ev "mysql-server|rabbitmq-server"`
|
apt_get install `cat $FILES/apts/* | cut -d\# -f1 | grep -Ev "mysql-server|rabbitmq-server"`
|
||||||
|
|
||||||
# install python requirements
|
# install python requirements
|
||||||
sudo PIP_DOWNLOAD_CACHE=/var/cache/pip pip install `cat $FILES/pips/*`
|
sudo PIP_DOWNLOAD_CACHE=/var/cache/pip pip install `cat $FILES/pips/*`
|
||||||
@ -352,7 +360,11 @@ cp $FILES/screenrc ~/.screenrc
|
|||||||
|
|
||||||
if [[ "$ENABLED_SERVICES" =~ "rabbit" ]]; then
|
if [[ "$ENABLED_SERVICES" =~ "rabbit" ]]; then
|
||||||
# Install and start rabbitmq-server
|
# Install and start rabbitmq-server
|
||||||
sudo apt-get install -y -q rabbitmq-server
|
# the temp file is necessary due to LP: #878600
|
||||||
|
tfile=$(mktemp)
|
||||||
|
apt_get install rabbitmq-server > "$tfile" 2>&1
|
||||||
|
cat "$tfile"
|
||||||
|
rm -f "$tfile"
|
||||||
# change the rabbit password since the default is "guest"
|
# change the rabbit password since the default is "guest"
|
||||||
sudo rabbitmqctl change_password guest $RABBIT_PASSWORD
|
sudo rabbitmqctl change_password guest $RABBIT_PASSWORD
|
||||||
fi
|
fi
|
||||||
@ -384,7 +396,7 @@ EOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Install and start mysql-server
|
# Install and start mysql-server
|
||||||
sudo apt-get -y -q install mysql-server
|
apt_get install mysql-server
|
||||||
# Update the DB to give user ‘$MYSQL_USER’@’%’ full control of the all databases:
|
# Update the DB to give user ‘$MYSQL_USER’@’%’ full control of the all databases:
|
||||||
sudo mysql -uroot -p$MYSQL_PASSWORD -h127.0.0.1 -e "GRANT ALL PRIVILEGES ON *.* TO '$MYSQL_USER'@'%' identified by '$MYSQL_PASSWORD';"
|
sudo mysql -uroot -p$MYSQL_PASSWORD -h127.0.0.1 -e "GRANT ALL PRIVILEGES ON *.* TO '$MYSQL_USER'@'%' identified by '$MYSQL_PASSWORD';"
|
||||||
|
|
||||||
@ -487,7 +499,7 @@ if [[ "$ENABLED_SERVICES" =~ "n-cpu" ]]; then
|
|||||||
# splitting a system into many smaller parts. LXC uses cgroups and chroot
|
# splitting a system into many smaller parts. LXC uses cgroups and chroot
|
||||||
# to simulate multiple systems.
|
# to simulate multiple systems.
|
||||||
if [[ "$LIBVIRT_TYPE" == "lxc" ]]; then
|
if [[ "$LIBVIRT_TYPE" == "lxc" ]]; then
|
||||||
sudo apt-get install lxc -y
|
apt_get install lxc
|
||||||
# lxc uses cgroups (a kernel interface via virtual filesystem) configured
|
# lxc uses cgroups (a kernel interface via virtual filesystem) configured
|
||||||
# and mounted to ``/cgroup``
|
# and mounted to ``/cgroup``
|
||||||
sudo mkdir -p /cgroup
|
sudo mkdir -p /cgroup
|
||||||
|
@ -52,13 +52,13 @@ BASE_IMAGE=$KVMSTACK_DIR/images/natty.raw
|
|||||||
BASE_IMAGE_COPY=$IMAGES_DIR/$DIST_NAME.raw.copy
|
BASE_IMAGE_COPY=$IMAGES_DIR/$DIST_NAME.raw.copy
|
||||||
|
|
||||||
# Name of our instance, used by libvirt
|
# Name of our instance, used by libvirt
|
||||||
VM_NAME=${VM_NAME:-kvmstack}
|
CONTAINER_NAME=${CONTAINER_NAME:-kvmstack}
|
||||||
|
|
||||||
# Mop up after previous runs
|
# Mop up after previous runs
|
||||||
virsh destroy $VM_NAME
|
virsh destroy $CONTAINER_NAME
|
||||||
|
|
||||||
# Where this vm is stored
|
# Where this vm is stored
|
||||||
VM_DIR=$KVMSTACK_DIR/instances/$VM_NAME
|
VM_DIR=$KVMSTACK_DIR/instances/$CONTAINER_NAME
|
||||||
|
|
||||||
# Create vm dir
|
# Create vm dir
|
||||||
mkdir -p $VM_DIR
|
mkdir -p $VM_DIR
|
||||||
@ -148,18 +148,11 @@ git_clone $OPENSTACKX_REPO $COPY_DIR/$DEST/openstackx $OPENSTACKX_BRANCH
|
|||||||
git_clone $KEYSTONE_REPO $COPY_DIR/$DEST/keystone $KEYSTONE_BRANCH
|
git_clone $KEYSTONE_REPO $COPY_DIR/$DEST/keystone $KEYSTONE_BRANCH
|
||||||
git_clone $NOVNC_REPO $COPY_DIR/$DEST/noVNC $NOVNC_BRANCH
|
git_clone $NOVNC_REPO $COPY_DIR/$DEST/noVNC $NOVNC_BRANCH
|
||||||
|
|
||||||
# Back to devstack
|
|
||||||
cd $TOP_DIR
|
|
||||||
|
|
||||||
# Unmount the filesystems
|
# Unmount the filesystems
|
||||||
unmount_images
|
unmount_images
|
||||||
|
|
||||||
# Clean up old runs
|
# Back to devstack
|
||||||
cd $VM_DIR
|
cd $TOP_DIR
|
||||||
rm -f $VM_DIR/disk
|
|
||||||
|
|
||||||
# Clean up old instance data
|
|
||||||
qemu-img create -f qcow2 -b $BASE_IMAGE_COPY disk
|
|
||||||
|
|
||||||
# Network configuration variables
|
# Network configuration variables
|
||||||
BRIDGE=${BRIDGE:-br0}
|
BRIDGE=${BRIDGE:-br0}
|
||||||
@ -168,14 +161,16 @@ CONTAINER_IP=${CONTAINER_IP:-192.168.1.50}
|
|||||||
CONTAINER_CIDR=${CONTAINER_CIDR:-$CONTAINER_IP/24}
|
CONTAINER_CIDR=${CONTAINER_CIDR:-$CONTAINER_IP/24}
|
||||||
CONTAINER_NETMASK=${CONTAINER_NETMASK:-255.255.255.0}
|
CONTAINER_NETMASK=${CONTAINER_NETMASK:-255.255.255.0}
|
||||||
CONTAINER_GATEWAY=${CONTAINER_GATEWAY:-192.168.1.1}
|
CONTAINER_GATEWAY=${CONTAINER_GATEWAY:-192.168.1.1}
|
||||||
CONTAINER_MAC=${CONTAINER_MAC:-02:16:3e:07:70:d7}
|
CONTAINER_MAC=${CONTAINER_MAC:-"02:16:3e:07:69:`printf '%02X' $(echo $CONTAINER_IP | sed "s/.*\.//")`"}
|
||||||
|
CONTAINER_RAM=${CONTAINER_RAM:-1524288}
|
||||||
|
CONTAINER_CORES=${CONTAINER_CORES:-1}
|
||||||
|
|
||||||
# libvirt.xml configuration
|
# libvirt.xml configuration
|
||||||
LIBVIRT_XML=libvirt.xml
|
LIBVIRT_XML=libvirt.xml
|
||||||
cat > $LIBVIRT_XML <<EOF
|
cat > $LIBVIRT_XML <<EOF
|
||||||
<domain type='kvm'>
|
<domain type='kvm'>
|
||||||
<name>$VM_NAME</name>
|
<name>$CONTAINER_NAME</name>
|
||||||
<memory>1524288</memory>
|
<memory>$CONTAINER_RAM</memory>
|
||||||
<os>
|
<os>
|
||||||
<type>hvm</type>
|
<type>hvm</type>
|
||||||
<bootmenu enable='yes'/>
|
<bootmenu enable='yes'/>
|
||||||
@ -183,7 +178,7 @@ cat > $LIBVIRT_XML <<EOF
|
|||||||
<features>
|
<features>
|
||||||
<acpi/>
|
<acpi/>
|
||||||
</features>
|
</features>
|
||||||
<vcpu>1</vcpu>
|
<vcpu>$CONTAINER_CORES</vcpu>
|
||||||
<devices>
|
<devices>
|
||||||
<disk type='file'>
|
<disk type='file'>
|
||||||
<driver type='qcow2'/>
|
<driver type='qcow2'/>
|
||||||
@ -231,8 +226,20 @@ NBD=${NBD:-/dev/nbd5}
|
|||||||
umount $ROOTFS || echo 'ok'
|
umount $ROOTFS || echo 'ok'
|
||||||
qemu-nbd -d $NBD || echo 'ok'
|
qemu-nbd -d $NBD || echo 'ok'
|
||||||
|
|
||||||
# Mount the instance
|
# Clean up old runs
|
||||||
|
cd $VM_DIR
|
||||||
|
rm -f $VM_DIR/disk
|
||||||
|
|
||||||
|
# Create our instance fs
|
||||||
|
qemu-img create -f qcow2 -b $BASE_IMAGE_COPY disk
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
|
||||||
qemu-nbd -c $NBD disk
|
qemu-nbd -c $NBD disk
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
# Mount the instance
|
||||||
mount $NBD $ROOTFS -o offset=32256 -t ext4
|
mount $NBD $ROOTFS -o offset=32256 -t ext4
|
||||||
|
|
||||||
# Configure instance network
|
# Configure instance network
|
||||||
|
Loading…
Reference in New Issue
Block a user