summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasyl Saienko <vsaienko@mirantis.com>2017-04-13 10:48:37 +0300
committerRuby Loo <ruby.loo@intel.com>2017-08-30 12:36:24 -0400
commitcefee3da4e77ffc5c3120d27d02b741c3b60ceab (patch)
tree021a6bfa8899e47764d9b6b81657ebec6ea1cd6e
parent9c6fccee4087e247a631f7648b018b06c5d408ee (diff)
downloadironic-cefee3da4e77ffc5c3120d27d02b741c3b60ceab.tar.gz
[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 Conflicts: devstack/lib/ironic Change-Id: I2e4633a258e5f8a6bd442797dd4cfbf4894c798b (cherry picked from commit 7cdda47a2237392df2f0e1742acc54a23c2a7e1e)
-rw-r--r--devstack/lib/ironic24
1 files changed, 14 insertions, 10 deletions
diff --git a/devstack/lib/ironic b/devstack/lib/ironic
index fa5c45104..5aa8612bd 100644
--- a/devstack/lib/ironic
+++ b/devstack/lib/ironic
@@ -711,10 +711,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
@@ -862,16 +862,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
}