Support multiple Cinder backend types

This is the first step in supporting multiple Cinder backend types at
once.  It initially converts the existing hard-coded multi-lvm support
to a new cinder_backends driver form.  Eventually the cinder_plugins
will be converted to this form so they can be enabled more than just
one at a time using CINDER_ENABLED_BACKENDS.

The default configuration should be identical to the previous defaults,
including for both True and False values of CINDER_MULTI_LVM_BACKEND.

The existing cinder_plugins are expected to be removed when this is
complete. They should continue to work until they have been converted.

Add wait for c-api to ensure it is started before continuing.

Change-Id: I93b8ef32832269d730c76a6dc24ddb4f20c6d9df
diff --git a/lib/cinder_backends/nfs b/lib/cinder_backends/nfs
new file mode 100644
index 0000000..7648788
--- /dev/null
+++ b/lib/cinder_backends/nfs
@@ -0,0 +1,43 @@
+# lib/cinder_backends/nfs
+# Configure the nfs backend
+
+# Enable with:
+#
+#   CINDER_ENABLED_BACKENDS+=,nfs:<volume-type-name>
+
+# Dependencies:
+#
+# - ``functions`` file
+# - ``cinder`` configurations
+
+# CINDER_CONF
+# CINDER_CONF_DIR
+# CINDER_NFS_SERVERPATH - contents of nfs shares config file
+
+# configure_cinder_backend_nfs - Configure Cinder for NFS backends
+
+# Save trace setting
+NFS_XTRACE=$(set +o | grep xtrace)
+set +o xtrace
+
+
+# Entry Points
+# ------------
+
+# configure_cinder_backend_nfs - Set config files, create data dirs, etc
+function configure_cinder_backend_nfs {
+    local be_name=$1
+    iniset $CINDER_CONF $be_name volume_backend_name $be_name
+    iniset $CINDER_CONF $be_name volume_driver "cinder.volume.drivers.nfs.NfsDriver"
+    iniset $CINDER_CONF $be_name nfs_shares_config "$CINDER_CONF_DIR/nfs-shares-$be_name.conf"
+
+    echo "$CINDER_NFS_SERVERPATH" | tee "$CINDER_CONF_DIR/nfs-shares-$be_name.conf"
+}
+
+
+# Restore xtrace
+$NFS_XTRACE
+
+# Local variables:
+# mode: shell-script
+# End: