1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#!/bin/sh
set -e
#set -x
# Just in case, make sure lsb_release is installed
if ! [ -x /usr/bin/lsb_release ] ; then
apt-get install lsb-release
fi
SUITE_NAME=$(lsb_release -c -s)
if [ "${SUITE_NAME}" = "stretch" ] || [ "${SUITE_NAME}" = "buster" ] ; then
systemctl restart virtlogd
sleep 2
systemctl restart libvirtd
sleep 2
fi
# Only old install of OCI have a /etc/nova/secret.xml.
# Newer ones have /etc/nova/libvirt-secret-<UUID>.{secret,xml}
# and do not need what's below.
if [ -e /etc/ceph/ceph.client.openstack.keyring ] && [ -e /etc/nova/secret.xml ] ; then
LIBVIRT_SECRET=$(cat /etc/ceph/ceph.client.openstack.keyring | grep key | awk '{print $3}')
LIBVIRT_UUID=$(xpath -e "//secret/uuid/text()" /etc/nova/secret.xml 2> /dev/null)
TMP_FILE=$(mktemp)
virsh secret-list >${TMP_FILE}
if ! grep -q ${LIBVIRT_UUID} ${TMP_FILE} ; then
virsh secret-define --file /etc/nova/secret.xml
fi
if ! virsh secret-get-value --secret ${LIBVIRT_UUID} >/dev/null 2>&1; then
virsh secret-set-value --secret ${LIBVIRT_UUID} ${LIBVIRT_SECRET}
fi
fi
if [ "${SUITE_NAME}" = "stretch" ] || [ "${SUITE_NAME}" = "buster" ] ; then
systemctl restart nova-compute
#else
# With Bullseye and beyond, TCP and TLS must be
# activated by enabling the libvirtd-tcp.socket
# and libvirtd-tls.socket thingy.
# systemctl enable libvirtd-tcp.socket
# systemctl enable libvirtd-tls.socket
# systemctl restart libvirtd.service
fi
|