[Devstack] Fix libvirt group usage

For unclear reason we set group ownership for tftp and http directories
to libvirt. This patch fixes that and use STACK_USER group there.

Also Recently [0] infra start installing libvirt from UCA
repository. The groups change with newer libvirt. Older Ubuntu used
'libvirtd', but now uses libvirt like Debian.
Update our local check that is needed for ironic standalone installation.

[0] c9a9e415b9a955525a407b78650f93e9193c8117

Change-Id: I2e4633a258e5f8a6bd442797dd4cfbf4894c798b
This commit is contained in:
Vasyl Saienko 2017-04-13 10:48:37 +03:00
parent 20815f5d87
commit 7cdda47a22

View File

@ -805,10 +805,10 @@ function cleanup_ironic {
function configure_ironic_dirs {
sudo install -d -o $STACK_USER $IRONIC_CONF_DIR $STACK_USER $IRONIC_DATA_DIR \
$IRONIC_STATE_PATH $IRONIC_TFTPBOOT_DIR $IRONIC_TFTPBOOT_DIR/pxelinux.cfg
sudo chown -R $STACK_USER:$LIBVIRT_GROUP $IRONIC_TFTPBOOT_DIR
sudo chown -R $STACK_USER:$STACK_USER $IRONIC_TFTPBOOT_DIR
if [[ "$IRONIC_IPXE_ENABLED" == "True" ]]; then
sudo install -d -o $STACK_USER -g $LIBVIRT_GROUP $IRONIC_HTTP_DIR
sudo install -d -o $STACK_USER -g $STACK_USER $IRONIC_HTTP_DIR
fi
if [ ! -f "$IRONIC_PXE_BOOT_IMAGE" ]; then
@ -957,16 +957,20 @@ function configure_ironic {
_config_ironic_apache_wsgi
fi
if [[ "$os_VENDOR" =~ (Debian|Ubuntu) ]]; then
# The groups change with newer libvirt. Older Ubuntu used
# 'libvirtd', but now uses libvirt like Debian. Do a quick check
# to see if libvirtd group already exists to handle grenade's case.
LIBVIRT_GROUP=$(cut -d ':' -f 1 /etc/group | grep 'libvirtd$' || true)
LIBVIRT_GROUP=${LIBVIRT_GROUP:-libvirt}
else
LIBVIRT_GROUP=libvirtd
fi
if ! getent group $LIBVIRT_GROUP >/dev/null; then
sudo groupadd $LIBVIRT_GROUP
fi
# NOTE(vsaienko) Add stack to libvirt group when installing without nova.
if ! is_service_enabled nova; then
if [[ "$os_VENDOR" =~ (Debian) ]]; then
LIBVIRT_GROUP=libvirt
else
LIBVIRT_GROUP=libvirtd
fi
if ! getent group $LIBVIRT_GROUP >/dev/null; then
sudo groupadd $LIBVIRT_GROUP
fi
add_user_to_group $STACK_USER $LIBVIRT_GROUP
fi
}