summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-03-21 15:39:12 +0000
committerGerrit Code Review <review@openstack.org>2019-03-21 15:39:12 +0000
commitd4d1a0132ab110f38ee3868c6625c2734a137019 (patch)
treea09021c8345a55a779cd3dfbdf4da7b973000fca
parent971b1ed13ebfe77eaa6badf862d1833f4c09fe2f (diff)
parent62d40c17e55901e80009c8f78f38f37abc6f665d (diff)
downloadironic-d4d1a0132ab110f38ee3868c6625c2734a137019.tar.gz
Merge "Add systemd unit for vbmcd in devstack"12.1.0
-rw-r--r--devstack/lib/ironic34
-rwxr-xr-xdevstack/tools/ironic/scripts/cleanup-node.sh2
-rwxr-xr-xdevstack/tools/ironic/scripts/create-node.sh6
3 files changed, 36 insertions, 6 deletions
diff --git a/devstack/lib/ironic b/devstack/lib/ironic
index 5c959eedc..5f2ea5ee3 100644
--- a/devstack/lib/ironic
+++ b/devstack/lib/ironic
@@ -336,6 +336,7 @@ IRONIC_IS_HARDWARE=$(trueorfalse False IRONIC_IS_HARDWARE)
IRONIC_VBMC_PORT_RANGE_START=${IRONIC_VBMC_PORT_RANGE_START:-6230}
IRONIC_VBMC_CONFIG_FILE=${IRONIC_VBMC_CONFIG_FILE:-$HOME/.vbmc/virtualbmc.conf}
IRONIC_VBMC_LOGFILE=${IRONIC_VBMC_LOGFILE:-$IRONIC_VM_LOG_DIR/virtualbmc.log}
+IRONIC_VBMC_SYSTEMD_SERVICE=devstack@virtualbmc.service
# Virtual PDU configs
IRONIC_VPDU_CONFIG_FILE=${IRONIC_VPDU_CONFIG_FILE:-$HOME/.vpdu/virtualpdu.conf}
@@ -723,6 +724,25 @@ function setup_syslinux_modules {
fi
}
+function start_virtualbmc {
+ $SYSTEMCTL start $IRONIC_VBMC_SYSTEMD_SERVICE
+}
+
+function stop_virtualbmc {
+ $SYSTEMCTL stop $IRONIC_VBMC_SYSTEMD_SERVICE
+}
+
+function cleanup_virtualbmc {
+ stop_virtualbmc
+
+ $SYSTEMCTL disable $IRONIC_VBMC_SYSTEMD_SERVICE
+
+ local unitfile="$SYSTEMD_DIR/$IRONIC_VBMC_SYSTEMD_SERVICE"
+ sudo rm -f $unitfile
+
+ $SYSTEMCTL daemon-reload
+}
+
function setup_virtualbmc {
# Install pyghmi from source, if requested, otherwise it will be
# downloaded as part of the virtualbmc installation
@@ -747,8 +767,18 @@ function setup_virtualbmc {
iniset $IRONIC_VBMC_CONFIG_FILE log debug True
iniset $IRONIC_VBMC_CONFIG_FILE log logfile $IRONIC_VBMC_LOGFILE
-}
+ local cmd
+
+ cmd=$(which vbmcd)
+ cmd+=" --foreground"
+
+ write_user_unit_file $IRONIC_VBMC_SYSTEMD_SERVICE "$cmd" "" "root"
+
+ $SYSTEMCTL enable $IRONIC_VBMC_SYSTEMD_SERVICE
+
+ start_virtualbmc
+}
function setup_virtualpdu {
if use_library_from_git "virtualpdu"; then
@@ -2457,7 +2487,7 @@ function cleanup_baremetal_basic_ops {
done
done
- sudo killall vbmc || true
+ cleanup_virtualbmc
sudo ovs-vsctl --if-exists del-br $IRONIC_VM_NETWORK_BRIDGE
diff --git a/devstack/tools/ironic/scripts/cleanup-node.sh b/devstack/tools/ironic/scripts/cleanup-node.sh
index e594c282b..466b7059b 100755
--- a/devstack/tools/ironic/scripts/cleanup-node.sh
+++ b/devstack/tools/ironic/scripts/cleanup-node.sh
@@ -23,7 +23,7 @@ virsh list --inactive | grep -q $NAME && virsh undefine $NAME --nvram
# Delete the Virtual BMC
if [[ $(type -P vbmc) != "" ]]; then
- sudo vbmc list | grep -a $NAME && sudo vbmc delete $NAME
+ vbmc list | grep -a $NAME && vbmc delete $NAME
fi
if virsh pool-list | grep -q $LIBVIRT_STORAGE_POOL ; then
diff --git a/devstack/tools/ironic/scripts/create-node.sh b/devstack/tools/ironic/scripts/create-node.sh
index a26452282..077d21246 100755
--- a/devstack/tools/ironic/scripts/create-node.sh
+++ b/devstack/tools/ironic/scripts/create-node.sh
@@ -129,10 +129,10 @@ if ! virsh list --all | grep -q $NAME; then
--disk-format $DISK_FORMAT $VM_LOGGING --engine $ENGINE $UEFI_OPTS $vm_opts \
--interface-count $INTERFACE_COUNT $MAC_ADDRESS >&2
- # Createa Virtual BMC for the node if IPMI is used
+ # Create Virtual BMC for the node if IPMI is used
if [[ $(type -P vbmc) != "" ]]; then
- sudo vbmc add $NAME --port $VBMC_PORT
- sudo vbmc start $NAME
+ vbmc add $NAME --port $VBMC_PORT
+ vbmc start $NAME
fi
fi