summaryrefslogtreecommitdiff
path: root/devstack
diff options
context:
space:
mode:
Diffstat (limited to 'devstack')
-rw-r--r--devstack/files/apache-ipxe-ironic.template4
-rw-r--r--devstack/lib/ironic42
-rwxr-xr-xdevstack/tools/ironic/scripts/create-node.sh17
3 files changed, 45 insertions, 18 deletions
diff --git a/devstack/files/apache-ipxe-ironic.template b/devstack/files/apache-ipxe-ironic.template
index ba182e582..3be47175c 100644
--- a/devstack/files/apache-ipxe-ironic.template
+++ b/devstack/files/apache-ipxe-ironic.template
@@ -9,8 +9,8 @@ Listen %PUBLICPORT%
Allow from all
Require all granted
</Directory>
- ErrorLog /var/log/apache2/ipxe_error.log
+ ErrorLog %APACHELOGDIR%/ipxe_error.log
ErrorLogFormat "%{cu}t [%-m:%l] [pid %P:tid %T] %7F: %E: [client\ %a] [frontend\ %A] %M% ,\ referer\ %{Referer}i"
LogLevel info
- CustomLog /var/log/apache2/ipxe_access.log "%{%Y-%m-%d}t %{%T}t.%{msec_frac}t [%l] %a \"%r\" %>s %b"
+ CustomLog %APACHELOGDIR%/ipxe_access.log "%{%Y-%m-%d}t %{%T}t.%{msec_frac}t [%l] %a \"%r\" %>s %b"
</VirtualHost>
diff --git a/devstack/lib/ironic b/devstack/lib/ironic
index cfd22a94c..c50a67fb2 100644
--- a/devstack/lib/ironic
+++ b/devstack/lib/ironic
@@ -367,6 +367,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
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:
# keystone and noauth.
IRONIC_AUTH_STRATEGY=${IRONIC_AUTH_STRATEGY:-keystone}
@@ -1083,6 +1086,7 @@ function _config_ironic_apache_ipxe {
sudo sed -e "
s|%PUBLICPORT%|$IRONIC_HTTP_PORT|g;
s|%HTTPROOT%|$IRONIC_HTTP_DIR|g;
+ s|%APACHELOGDIR%|$APACHE_LOG_DIR|g;
" -i $ipxe_apache_conf
enable_apache_site ipxe-ironic
}
@@ -1683,7 +1687,23 @@ function start_ironic_api {
# Starts Ironic conductor.
function start_ironic_conductor {
run_process ir-cond "$IRONIC_BIN_DIR/ironic-conductor --config-file=$IRONIC_CONF_FILE"
- # TODO(romcheg): Find a way to check whether the conductor has started.
+
+ # Wait up to 30 seconds for ironic-conductor to start and register itself
+ local attempt
+ local max_attempts=7
+ for attempt in $(seq 1 $max_attempts); do
+ if openstack baremetal driver list | grep -q $IRONIC_DEPLOY_DRIVER; then
+ break
+ fi
+
+ if [ $attempt -eq $max_attempts ]; then
+ die $LINENO "Driver $IRONIC_DEPLOY_DRIVER did not appear in the driver list"
+ fi
+
+ echo "Still waiting for ironic-conductor to start, current state:"
+ openstack baremetal driver list
+ sleep 5
+ done
}
# stop_ironic() - Stop running processes
@@ -1779,6 +1799,22 @@ an ANSI escape sequence.
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 {
# 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"
@@ -1812,6 +1848,8 @@ function create_bridge_and_vms {
vm_opts+=" -D virtio"
fi
+ initialize_libvirt_storage_pool
+
local bridge_mac
bridge_mac=$(ip link show dev $IRONIC_VM_NETWORK_BRIDGE | grep -Eo "ether [A-Za-z0-9:]+"|sed "s/ether\ //")
@@ -1822,7 +1860,7 @@ function create_bridge_and_vms {
-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 \
-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
if is_deployed_by_ipmi; then
diff --git a/devstack/tools/ironic/scripts/create-node.sh b/devstack/tools/ironic/scripts/create-node.sh
index aa823aaae..55b47858c 100755
--- a/devstack/tools/ironic/scripts/create-node.sh
+++ b/devstack/tools/ironic/scripts/create-node.sh
@@ -12,7 +12,7 @@ export PS4='+ ${BASH_SOURCE:-}:${FUNCNAME[0]:-}:L${LINENO:-}: '
# Keep track of the DevStack directory
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
n) NAME=$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;;
D) NIC_DRIVER=$OPTARG;;
v) VOLUME_COUNT=$OPTARG;;
+ P) STORAGE_POOL=$OPTARG;;
esac
done
@@ -46,23 +47,11 @@ if [ -z "$UEFI_LOADER" ] && [ ! -z "$UEFI_NVRAM" ]; then
fi
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"}
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
mkdir -p "$LOGDIR"
fi