Merge "Add pre-install phase for extras.d plugins"
diff --git a/extras.d/README.md b/extras.d/README.md
index 1dd17da..7c2e4fe 100644
--- a/extras.d/README.md
+++ b/extras.d/README.md
@@ -22,9 +22,24 @@
     stack: called by stack.sh.  There are four possible values for
         the second arg to distinguish the phase stack.sh is in:
 
-        arg 2:  install | post-config | extra | post-extra
+        arg 2:  pre-install | install | post-config | extra
 
     unstack: called by unstack.sh
 
     clean: called by clean.sh.  Remember, clean.sh also calls unstack.sh
         so that work need not be repeated.
+
+The `stack` phase sub-phases are called from `stack.sh` in the following places:
+
+    pre-install - After all system prerequisites have been installed but before any
+        DevStack-specific services are installed (including database and rpc).
+
+    install - After all OpenStack services have been installed and configured
+        but before any OpenStack services have been started.  Changes to OpenStack
+        service configurations should be done here.
+
+    post-config - After OpenStack services have been initialized but still before
+        they have been started. (This is probably mis-named, think of it as post-init.)
+
+    extra - After everything is started.
+
diff --git a/stack.sh b/stack.sh
index f3d8d44..d095063 100755
--- a/stack.sh
+++ b/stack.sh
@@ -668,6 +668,18 @@
 # Do the ugly hacks for borken packages and distros
 $TOP_DIR/tools/fixup_stuff.sh
 
+
+# Extras Pre-install
+# ------------------
+
+# Phase: pre-install
+if [[ -d $TOP_DIR/extras.d ]]; then
+    for i in $TOP_DIR/extras.d/*.sh; do
+        [[ -r $i ]] && source $i stack pre-install
+    done
+fi
+
+
 install_rpc_backend
 
 if is_service_enabled $DATABASE_BACKENDS; then