| ... | ... |
@@ -393,6 +393,10 @@ function init_cinder {
|
| 393 | 393 |
fi |
| 394 | 394 |
|
| 395 | 395 |
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 |
|
| 396 | 400 |
init_cinder_backend_${be_type} ${be_name}
|
| 397 | 401 |
fi |
| 398 | 402 |
done |
| ... | ... |
@@ -117,6 +117,25 @@ function init_lvm_volume_group {
|
| 117 | 117 |
_clean_lvm_volume_group $vg |
| 118 | 118 |
} |
| 119 | 119 |
|
| 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 |
+ |
|
| 120 | 139 |
# Restore xtrace |
| 121 | 140 |
$MY_XTRACE |
| 122 | 141 |
|
| ... | ... |
@@ -918,10 +918,6 @@ init_service_check |
| 918 | 918 |
# A better kind of sysstat, with the top process per time slice |
| 919 | 919 |
start_dstat |
| 920 | 920 |
|
| 921 |
-# Initialize default LVM volume group |
|
| 922 |
-# ----------------------------------- |
|
| 923 |
-init_lvm_volume_group $DEFAULT_VOLUME_GROUP_NAME $VOLUME_BACKING_FILE_SIZE |
|
| 924 |
- |
|
| 925 | 921 |
# Start Services |
| 926 | 922 |
# ============== |
| 927 | 923 |
|