CI: move libvirt images to /opt for standalone and multinode jobs

Moves the volume pool from / to /opt for the standalone and multinode
jobs, since on smaller nodes /opt is mounted from a larger ephemeral disk.

Change-Id: Idb4e235fd40ecd9829c3ad8a9dd1224f1c29a12e
This commit is contained in:
Dmitry Tantsur 2019-09-11 13:18:03 +02:00
parent aba282a7fc
commit 625c71d48d
3 changed files with 33 additions and 15 deletions

View File

@ -371,6 +371,9 @@ IRONIC_CONFIGURE_GLANCE_WITH_SWIFT=$(trueorfalse False IRONIC_CONFIGURE_GLANCE_W
# The path to the libvirt hooks directory, used if IRONIC_VM_LOG_ROTATE is True # The path to the libvirt hooks directory, used if IRONIC_VM_LOG_ROTATE is True
IRONIC_LIBVIRT_HOOKS_PATH=${IRONIC_LIBVIRT_HOOKS_PATH:-/etc/libvirt/hooks/} IRONIC_LIBVIRT_HOOKS_PATH=${IRONIC_LIBVIRT_HOOKS_PATH:-/etc/libvirt/hooks/}
LIBVIRT_STORAGE_POOL=${LIBVIRT_STORAGE_POOL:-"default"}
LIBVIRT_STORAGE_POOL_PATH=${LIBVIRT_STORAGE_POOL_PATH:-/var/lib/libvirt/images}
# The authentication strategy used by ironic-api. Valid values are: # The authentication strategy used by ironic-api. Valid values are:
# keystone and noauth. # keystone and noauth.
IRONIC_AUTH_STRATEGY=${IRONIC_AUTH_STRATEGY:-keystone} IRONIC_AUTH_STRATEGY=${IRONIC_AUTH_STRATEGY:-keystone}
@ -1790,6 +1793,22 @@ an ANSI escape sequence.
EOF EOF
} }
function initialize_libvirt_storage_pool {
[ -d $LIBVIRT_STORAGE_POOL_PATH ] || sudo mkdir -p $LIBVIRT_STORAGE_POOL_PATH
if ! sudo virsh pool-list --all | grep -q $LIBVIRT_STORAGE_POOL; then
sudo virsh pool-define-as --name $LIBVIRT_STORAGE_POOL dir \
--target $LIBVIRT_STORAGE_POOL_PATH >&2
sudo virsh pool-autostart $LIBVIRT_STORAGE_POOL >&2
sudo virsh pool-start $LIBVIRT_STORAGE_POOL >&2
fi
pool_state=$(sudo virsh pool-info $LIBVIRT_STORAGE_POOL | grep State | awk '{ print $2 }')
if [ "$pool_state" != "running" ] ; then
sudo virsh pool-start $LIBVIRT_STORAGE_POOL >&2
fi
}
function create_bridge_and_vms { function create_bridge_and_vms {
# Call libvirt setup scripts in a new shell to ensure any new group membership # Call libvirt setup scripts in a new shell to ensure any new group membership
sudo su $STACK_USER -c "$IRONIC_SCRIPTS_DIR/setup-network.sh $IRONIC_VM_NETWORK_BRIDGE $PUBLIC_BRIDGE_MTU" sudo su $STACK_USER -c "$IRONIC_SCRIPTS_DIR/setup-network.sh $IRONIC_VM_NETWORK_BRIDGE $PUBLIC_BRIDGE_MTU"
@ -1823,6 +1842,8 @@ function create_bridge_and_vms {
vm_opts+=" -D virtio" vm_opts+=" -D virtio"
fi fi
initialize_libvirt_storage_pool
local bridge_mac local bridge_mac
bridge_mac=$(ip link show dev $IRONIC_VM_NETWORK_BRIDGE | grep -Eo "ether [A-Za-z0-9:]+"|sed "s/ether\ //") bridge_mac=$(ip link show dev $IRONIC_VM_NETWORK_BRIDGE | grep -Eo "ether [A-Za-z0-9:]+"|sed "s/ether\ //")
@ -1833,7 +1854,7 @@ function create_bridge_and_vms {
-c $IRONIC_VM_SPECS_CPU -m $IRONIC_VM_SPECS_RAM -d $IRONIC_VM_SPECS_DISK \ -c $IRONIC_VM_SPECS_CPU -m $IRONIC_VM_SPECS_RAM -d $IRONIC_VM_SPECS_DISK \
-a $IRONIC_VM_SPECS_CPU_ARCH -b $IRONIC_VM_NETWORK_BRIDGE $vm_opts -p $vbmc_port -o $pdu_outlet \ -a $IRONIC_VM_SPECS_CPU_ARCH -b $IRONIC_VM_NETWORK_BRIDGE $vm_opts -p $vbmc_port -o $pdu_outlet \
-i $IRONIC_VM_INTERFACE_COUNT -f $IRONIC_VM_SPECS_DISK_FORMAT -M $PUBLIC_BRIDGE_MTU $log_arg \ -i $IRONIC_VM_INTERFACE_COUNT -f $IRONIC_VM_SPECS_DISK_FORMAT -M $PUBLIC_BRIDGE_MTU $log_arg \
-v $IRONIC_VM_VOLUME_COUNT >> $IRONIC_VM_MACS_CSV_FILE -v $IRONIC_VM_VOLUME_COUNT -P $LIBVIRT_STORAGE_POOL >> $IRONIC_VM_MACS_CSV_FILE
SUBSHELL SUBSHELL
if is_deployed_by_ipmi; then if is_deployed_by_ipmi; then

View File

@ -12,7 +12,7 @@ export PS4='+ ${BASH_SOURCE:-}:${FUNCNAME[0]:-}:L${LINENO:-}: '
# Keep track of the DevStack directory # Keep track of the DevStack directory
TOP_DIR=$(cd $(dirname "$0")/.. && pwd) TOP_DIR=$(cd $(dirname "$0")/.. && pwd)
while getopts "n:c:i:m:M:d:a:b:e:E:p:o:f:l:L:N:A:D:v:" arg; do while getopts "n:c:i:m:M:d:a:b:e:E:p:o:f:l:L:N:A:D:v:P:" arg; do
case $arg in case $arg in
n) NAME=$OPTARG;; n) NAME=$OPTARG;;
c) CPU=$OPTARG;; c) CPU=$OPTARG;;
@ -35,6 +35,7 @@ while getopts "n:c:i:m:M:d:a:b:e:E:p:o:f:l:L:N:A:D:v:" arg; do
A) MAC_ADDRESS=$OPTARG;; A) MAC_ADDRESS=$OPTARG;;
D) NIC_DRIVER=$OPTARG;; D) NIC_DRIVER=$OPTARG;;
v) VOLUME_COUNT=$OPTARG;; v) VOLUME_COUNT=$OPTARG;;
P) STORAGE_POOL=$OPTARG;;
esac esac
done done
@ -46,23 +47,11 @@ if [ -z "$UEFI_LOADER" ] && [ ! -z "$UEFI_NVRAM" ]; then
fi fi
LIBVIRT_NIC_DRIVER=${NIC_DRIVER:-"e1000"} LIBVIRT_NIC_DRIVER=${NIC_DRIVER:-"e1000"}
LIBVIRT_STORAGE_POOL=${LIBVIRT_STORAGE_POOL:-"default"} LIBVIRT_STORAGE_POOL=${STORAGE_POOL:-"default"}
LIBVIRT_CONNECT_URI=${LIBVIRT_CONNECT_URI:-"qemu:///system"} LIBVIRT_CONNECT_URI=${LIBVIRT_CONNECT_URI:-"qemu:///system"}
export VIRSH_DEFAULT_CONNECT_URI=$LIBVIRT_CONNECT_URI export VIRSH_DEFAULT_CONNECT_URI=$LIBVIRT_CONNECT_URI
if ! virsh pool-list --all | grep -q $LIBVIRT_STORAGE_POOL; then
virsh pool-define-as --name $LIBVIRT_STORAGE_POOL dir --target /var/lib/libvirt/images >&2
virsh pool-autostart $LIBVIRT_STORAGE_POOL >&2
virsh pool-start $LIBVIRT_STORAGE_POOL >&2
fi
pool_state=$(virsh pool-info $LIBVIRT_STORAGE_POOL | grep State | awk '{ print $2 }')
if [ "$pool_state" != "running" ] ; then
[ ! -d /var/lib/libvirt/images ] && sudo mkdir /var/lib/libvirt/images
virsh pool-start $LIBVIRT_STORAGE_POOL >&2
fi
if [ -n "$LOGDIR" ] ; then if [ -n "$LOGDIR" ] ; then
mkdir -p "$LOGDIR" mkdir -p "$LOGDIR"
fi fi

View File

@ -110,6 +110,10 @@
IRONIC_RPC_TRANSPORT: json-rpc IRONIC_RPC_TRANSPORT: json-rpc
IRONIC_VM_COUNT: 6 IRONIC_VM_COUNT: 6
IRONIC_VM_VOLUME_COUNT: 2 IRONIC_VM_VOLUME_COUNT: 2
# We're using a lot of disk space in this job. Some testing nodes have
# a small root partition, so use /opt which is mounted from a bigger
# ephemeral partition on such nodes
LIBVIRT_STORAGE_POOL_PATH: /opt/libvirt/images
SWIFT_ENABLE_TEMPURLS: True SWIFT_ENABLE_TEMPURLS: True
SWIFT_TEMPURL_KEY: secretkey SWIFT_TEMPURL_KEY: secretkey
devstack_services: devstack_services:
@ -400,6 +404,10 @@
TEMPEST_PLUGINS: "{{ ansible_user_dir }}/src/opendev.org/openstack/ironic-tempest-plugin" TEMPEST_PLUGINS: "{{ ansible_user_dir }}/src/opendev.org/openstack/ironic-tempest-plugin"
TENANT_VLAN_RANGE: 100:150 TENANT_VLAN_RANGE: 100:150
VIRT_DRIVER: ironic VIRT_DRIVER: ironic
# We're using a lot of disk space in this job. Some testing nodes have
# a small root partition, so use /opt which is mounted from a bigger
# ephemeral partition on such nodes
LIBVIRT_STORAGE_POOL_PATH: /opt/libvirt/images
devstack_plugins: devstack_plugins:
ironic: https://opendev.org/openstack/ironic ironic: https://opendev.org/openstack/ironic
networking-generic-switch: https://opendev.org/openstack/networking-generic-switch networking-generic-switch: https://opendev.org/openstack/networking-generic-switch