From 7cdda47a2237392df2f0e1742acc54a23c2a7e1e Mon Sep 17 00:00:00 2001 From: Vasyl Saienko Date: Thu, 13 Apr 2017 10:48:37 +0300 Subject: [PATCH] [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 --- devstack/lib/ironic | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/devstack/lib/ironic b/devstack/lib/ironic index 7dd509d631..d657016d72 100644 --- a/devstack/lib/ironic +++ b/devstack/lib/ironic @@ -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 }