File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -393,6 +393,10 @@ function init_cinder {
393393 fi
394394
395395 if type init_cinder_backend_${be_type} > /dev/null 2>&1 ; then
396+ # Always init the default volume group for lvm.
397+ if [[ " $be_type " == " lvm" ]]; then
398+ init_default_lvm_volume_group
399+ fi
396400 init_cinder_backend_${be_type} ${be_name}
397401 fi
398402 done
Original file line number Diff line number Diff line change @@ -117,6 +117,25 @@ function init_lvm_volume_group {
117117 _clean_lvm_volume_group $vg
118118}
119119
120+ # Sentinal value to ensure that init of default lvm volume group is
121+ # only performed once across calls of init_default_lvm_volume_group.
122+ _DEFAULT_LVM_INIT=${_DEFAULT_LVM_INIT:-0}
123+
124+ # init_default_lvm_volume_group() initializes a default volume group
125+ # intended to be shared between cinder and nova. It is idempotent;
126+ # the init of the default volume group is guaranteed to be performed
127+ # only once so that either or both of the dependent services can
128+ # safely call this function.
129+ #
130+ # Usage: init_default_lvm_volume_group()
131+ function init_default_lvm_volume_group {
132+ if [[ "$_DEFAULT_LVM_INIT" = "0" ]]; then
133+ init_lvm_volume_group $DEFAULT_VOLUME_GROUP_NAME $VOLUME_BACKING_FILE_SIZE
134+ _DEFAULT_LVM_INIT=1
135+ fi
136+ }
137+
138+
120139# Restore xtrace
121140$MY_XTRACE
122141
Original file line number Diff line number Diff line change @@ -640,6 +640,10 @@ function init_nova {
640640
641641 create_nova_cache_dir
642642 create_nova_keys_dir
643+
644+ if [[ " $NOVA_BACKEND " == " LVM" ]]; then
645+ init_default_lvm_volume_group
646+ fi
643647}
644648
645649# install_novaclient() - Collect source and prepare
Original file line number Diff line number Diff line change @@ -918,10 +918,6 @@ init_service_check
918918# A better kind of sysstat, with the top process per time slice
919919start_dstat
920920
921- # Initialize default LVM volume group
922- # -----------------------------------
923- init_lvm_volume_group $DEFAULT_VOLUME_GROUP_NAME $VOLUME_BACKING_FILE_SIZE
924-
925921# Start Services
926922# ==============
927923
You can’t perform that action at this time.
0 commit comments