Merge "xenapi: separate disk for cinder volumes"
This commit is contained in:
commit
b3e8ea847f
35
lib/cinder
35
lib/cinder
@ -69,10 +69,12 @@ CINDER_PERIODIC_INTERVAL=${CINDER_PERIODIC_INTERVAL:-60}
|
||||
# Name of the lvm volume groups to use/create for iscsi volumes
|
||||
VOLUME_GROUP=${VOLUME_GROUP:-stack-volumes}
|
||||
VOLUME_BACKING_FILE=${VOLUME_BACKING_FILE:-$DATA_DIR/${VOLUME_GROUP}-backing-file}
|
||||
VOLUME_BACKING_DEVICE=${VOLUME_BACKING_DEVICE:-}
|
||||
|
||||
# VOLUME_GROUP2 is used only if CINDER_MULTI_LVM_BACKEND = True
|
||||
VOLUME_GROUP2=${VOLUME_GROUP2:-stack-volumes2}
|
||||
VOLUME_BACKING_FILE2=${VOLUME_BACKING_FILE2:-$DATA_DIR/${VOLUME_GROUP2}-backing-file}
|
||||
VOLUME_BACKING_DEVICE2=${VOLUME_BACKING_DEVICE2:-}
|
||||
|
||||
VOLUME_NAME_PREFIX=${VOLUME_NAME_PREFIX:-volume-}
|
||||
|
||||
@ -335,28 +337,35 @@ create_cinder_volume_group() {
|
||||
# ``/opt/stack/data``.
|
||||
|
||||
if ! sudo vgs $VOLUME_GROUP; then
|
||||
# Only create if the file doesn't already exists
|
||||
[[ -f $VOLUME_BACKING_FILE ]] || truncate -s $VOLUME_BACKING_FILE_SIZE $VOLUME_BACKING_FILE
|
||||
if [ -z "$VOLUME_BACKING_DEVICE" ]; then
|
||||
# Only create if the file doesn't already exists
|
||||
[[ -f $VOLUME_BACKING_FILE ]] || truncate -s $VOLUME_BACKING_FILE_SIZE $VOLUME_BACKING_FILE
|
||||
DEV=`sudo losetup -f --show $VOLUME_BACKING_FILE`
|
||||
|
||||
DEV=`sudo losetup -f --show $VOLUME_BACKING_FILE`
|
||||
|
||||
# Only create if the loopback device doesn't contain $VOLUME_GROUP
|
||||
if ! sudo vgs $VOLUME_GROUP; then
|
||||
sudo vgcreate $VOLUME_GROUP $DEV
|
||||
# Only create if the loopback device doesn't contain $VOLUME_GROUP
|
||||
if ! sudo vgs $VOLUME_GROUP; then
|
||||
sudo vgcreate $VOLUME_GROUP $DEV
|
||||
fi
|
||||
else
|
||||
sudo vgcreate $VOLUME_GROUP $VOLUME_BACKING_DEVICE
|
||||
fi
|
||||
fi
|
||||
if [ "$CINDER_MULTI_LVM_BACKEND" = "True" ]; then
|
||||
#set up the second volume if CINDER_MULTI_LVM_BACKEND is enabled
|
||||
|
||||
if ! sudo vgs $VOLUME_GROUP2; then
|
||||
# Only create if the file doesn't already exists
|
||||
[[ -f $VOLUME_BACKING_FILE2 ]] || truncate -s $VOLUME_BACKING_FILE_SIZE $VOLUME_BACKING_FILE2
|
||||
if [ -z "$VOLUME_BACKING_DEVICE2" ]; then
|
||||
# Only create if the file doesn't already exists
|
||||
[[ -f $VOLUME_BACKING_FILE2 ]] || truncate -s $VOLUME_BACKING_FILE_SIZE $VOLUME_BACKING_FILE2
|
||||
|
||||
DEV=`sudo losetup -f --show $VOLUME_BACKING_FILE2`
|
||||
DEV=`sudo losetup -f --show $VOLUME_BACKING_FILE2`
|
||||
|
||||
# Only create if the loopback device doesn't contain $VOLUME_GROUP
|
||||
if ! sudo vgs $VOLUME_GROUP2; then
|
||||
sudo vgcreate $VOLUME_GROUP2 $DEV
|
||||
# Only create if the loopback device doesn't contain $VOLUME_GROUP
|
||||
if ! sudo vgs $VOLUME_GROUP2; then
|
||||
sudo vgcreate $VOLUME_GROUP2 $DEV
|
||||
fi
|
||||
else
|
||||
sudo vgcreate $VOLUME_GROUP2 $VOLUME_BACKING_DEVICE2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -259,6 +259,19 @@ fi
|
||||
FLAT_NETWORK_BRIDGE=$(bridge_for "$VM_BRIDGE_OR_NET_NAME")
|
||||
append_kernel_cmdline "$GUEST_NAME" "flat_network_bridge=${FLAT_NETWORK_BRIDGE}"
|
||||
|
||||
# Add a separate xvdb, if it was requested
|
||||
if [[ "0" != "$XEN_XVDB_SIZE_GB" ]]; then
|
||||
vm=$(xe vm-list name-label="$GUEST_NAME" --minimal)
|
||||
|
||||
# Add a new disk
|
||||
localsr=$(get_local_sr)
|
||||
extra_vdi=$(xe vdi-create \
|
||||
name-label=xvdb-added-by-devstack \
|
||||
virtual-size="${XEN_XVDB_SIZE_GB}GiB" \
|
||||
sr-uuid=$localsr type=user)
|
||||
xe vbd-create vm-uuid=$vm vdi-uuid=$extra_vdi device=1
|
||||
fi
|
||||
|
||||
# create a snapshot before the first boot
|
||||
# to allow a quick re-run with the same settings
|
||||
xe vm-snapshot vm="$GUEST_NAME" new-name-label="$SNAME_FIRST_BOOT"
|
||||
|
@ -76,4 +76,14 @@ UBUNTU_INST_NAMESERVERS=""
|
||||
UBUNTU_INST_NETMASK=""
|
||||
UBUNTU_INST_GATEWAY=""
|
||||
|
||||
# Create a separate xvdb. Tis could be used as a backing device for cinder
|
||||
# volumes. Specify
|
||||
# XEN_XVDB_SIZE_GB=10
|
||||
# VOLUME_BACKING_DEVICE=/dev/xvdb
|
||||
# in your localrc to avoid kernel lockups:
|
||||
# https://bugs.launchpad.net/cinder/+bug/1023755
|
||||
#
|
||||
# Set the size to 0 to avoid creation of additional disk.
|
||||
XEN_XVDB_SIZE_GB=0
|
||||
|
||||
source ../../stackrc
|
||||
|
Loading…
Reference in New Issue
Block a user