From 63beab524368875820db453c244468105584bc85 Mon Sep 17 00:00:00 2001 From: Huan Xiong Date: Fri, 23 Mar 2018 14:42:37 +0000 Subject: [PATCH] init_cinder() shouldn't always create DEFAULT_VOLUME_GROUP_NAME DEFAULT_VOLUME_GROUP_NAME volume group is LVM ephemeral storage used by Nova. It is created by init_nova() if user sets NOVA_BACKEND to "LVM". However, init_cinder() is also hardcoded to create it, based on the asumption that CINDER_ENABLED_BACKENDS includes it. That assumption doesn't hold for the current code. What's more important, even if user wants to use DEFAULT_VOLUME_GROUP_NAME as one of cinder backends and adds it to CINDER_ENABLED_BACKENDS, the current code in init_cinder() are general enough and should work fine. This change removes relevant code in init_cinder(). It also moves DEFAULT_VOLUME_GROUP_NAME clean-up code from unstack.sh to cleanup_nova(). Change-Id: I53762f8eda6256f962cc4e1f1098406879bbcf5c --- lib/cinder | 4 ---- lib/nova | 4 ++++ unstack.sh | 4 ---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/cinder b/lib/cinder index 3a8097f894..e0b8971dcb 100644 --- a/lib/cinder +++ b/lib/cinder @@ -420,10 +420,6 @@ function init_cinder { be_type=${be%%:*} be_name=${be##*:} if type init_cinder_backend_${be_type} >/dev/null 2>&1; then - # Always init the default volume group for lvm. - if [[ "$be_type" == "lvm" ]]; then - init_default_lvm_volume_group - fi init_cinder_backend_${be_type} ${be_name} fi done diff --git a/lib/nova b/lib/nova index 56e309333b..ee682db86a 100644 --- a/lib/nova +++ b/lib/nova @@ -264,6 +264,10 @@ function cleanup_nova { stop_process "n-api-meta" remove_uwsgi_config "$NOVA_UWSGI_CONF" "$NOVA_UWSGI" remove_uwsgi_config "$NOVA_METADATA_UWSGI_CONF" "$NOVA_METADATA_UWSGI" + + if [[ "$NOVA_BACKEND" == "LVM" ]]; then + clean_lvm_volume_group $DEFAULT_VOLUME_GROUP_NAME + fi } # configure_nova() - Set config files, create data dirs, etc diff --git a/unstack.sh b/unstack.sh index ccea0ef585..cfbf22e0fa 100755 --- a/unstack.sh +++ b/unstack.sh @@ -175,9 +175,5 @@ fi # enabled backends. So if Cinder is enabled, and installed successfully we are # sure lvm2 (lvremove, /etc/lvm/lvm.conf, etc.) is here. if is_service_enabled cinder && is_package_installed lvm2; then - # Using /bin/true here indicates a BUG - maybe the - # DEFAULT_VOLUME_GROUP_NAME doesn't exist? We should - # isolate this further down in lib/cinder cleanup. - clean_lvm_volume_group $DEFAULT_VOLUME_GROUP_NAME || /bin/true clean_lvm_filter fi