Set VIRSH_DEFAULT_CONNECT_URI in Ironic scripts
Ironic setup scripts that interface with virsh should default to always connecting to the 'qemu:///system' URI. Adds LIBVIRT_CONNECT_URI that ends up exported as VIRSH_DEFAULT_CONNECT_URI in scripts that require it. Change-Id: Ib660bd51a8c7bfe96e14aab4b6d3a6e83a5a4220
This commit is contained in:
parent
9f59782a36
commit
bd93f02850
@ -8,10 +8,13 @@
|
|||||||
set -exu
|
set -exu
|
||||||
|
|
||||||
LIBVIRT_STORAGE_POOL=${LIBVIRT_STORAGE_POOL:-"default"}
|
LIBVIRT_STORAGE_POOL=${LIBVIRT_STORAGE_POOL:-"default"}
|
||||||
|
LIBVIRT_CONNECT_URI=${LIBVIRT_CONNECT_URI:-"qemu:///system"}
|
||||||
|
|
||||||
VM_COUNT=$1
|
VM_COUNT=$1
|
||||||
NETWORK_BRIDGE=$2
|
NETWORK_BRIDGE=$2
|
||||||
|
|
||||||
|
export VIRSH_DEFAULT_CONNECT_URI=$LIBVIRT_CONNECT_URI
|
||||||
|
|
||||||
for (( idx=0; idx<$VM_COUNT; idx++ )); do
|
for (( idx=0; idx<$VM_COUNT; idx++ )); do
|
||||||
NAME="baremetal${NETWORK_BRIDGE}_${idx}"
|
NAME="baremetal${NETWORK_BRIDGE}_${idx}"
|
||||||
VOL_NAME="baremetal${NETWORK_BRIDGE}-${idx}.qcow2"
|
VOL_NAME="baremetal${NETWORK_BRIDGE}-${idx}.qcow2"
|
||||||
|
@ -27,6 +27,9 @@ EMULATOR=$7
|
|||||||
|
|
||||||
LIBVIRT_NIC_DRIVER=${LIBVIRT_NIC_DRIVER:-"e1000"}
|
LIBVIRT_NIC_DRIVER=${LIBVIRT_NIC_DRIVER:-"e1000"}
|
||||||
LIBVIRT_STORAGE_POOL=${LIBVIRT_STORAGE_POOL:-"default"}
|
LIBVIRT_STORAGE_POOL=${LIBVIRT_STORAGE_POOL:-"default"}
|
||||||
|
LIBVIRT_CONNECT_URI=${LIBVIRT_CONNECT_URI:-"qemu:///system"}
|
||||||
|
|
||||||
|
export VIRSH_DEFAULT_CONNECT_URI=$LIBVIRT_CONNECT_URI
|
||||||
|
|
||||||
if ! virsh pool-list --all | grep -q $LIBVIRT_STORAGE_POOL; then
|
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-define-as --name $LIBVIRT_STORAGE_POOL dir --target /var/lib/libvirt/images >&2
|
||||||
|
@ -7,11 +7,15 @@
|
|||||||
|
|
||||||
set -exu
|
set -exu
|
||||||
|
|
||||||
|
LIBVIRT_CONNECT_URI=${LIBVIRT_CONNECT_URI:-"qemu:///system"}
|
||||||
|
|
||||||
# Keep track of the devstack directory
|
# Keep track of the devstack directory
|
||||||
TOP_DIR=$(cd $(dirname "$0")/.. && pwd)
|
TOP_DIR=$(cd $(dirname "$0")/.. && pwd)
|
||||||
BRIDGE_SUFFIX=${1:-''}
|
BRIDGE_SUFFIX=${1:-''}
|
||||||
BRIDGE_NAME=brbm$BRIDGE_SUFFIX
|
BRIDGE_NAME=brbm$BRIDGE_SUFFIX
|
||||||
|
|
||||||
|
export VIRSH_DEFAULT_CONNECT_URI="$LIBVIRT_CONNECT_URI"
|
||||||
|
|
||||||
# Only add bridge if missing
|
# Only add bridge if missing
|
||||||
(sudo ovs-vsctl list-br | grep ${BRIDGE_NAME}$) || sudo ovs-vsctl add-br ${BRIDGE_NAME}
|
(sudo ovs-vsctl list-br | grep ${BRIDGE_NAME}$) || sudo ovs-vsctl add-br ${BRIDGE_NAME}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user