Refactor swift installation

* Optimize loops
* Move install steps to the lib/swift

Change-Id: Ie8a74b2627395620ccb0501171fa0150ee7497f2
diff --git a/unstack.sh b/unstack.sh
index 0040cf1..20ba17b 100755
--- a/unstack.sh
+++ b/unstack.sh
@@ -27,6 +27,7 @@
 # Get project function libraries
 source $TOP_DIR/lib/cinder
 source $TOP_DIR/lib/horizon
+source $TOP_DIR/lib/swift
 
 # Determine what system we are running on.  This provides ``os_VENDOR``,
 # ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME``
@@ -47,7 +48,7 @@
 
 # Swift runs daemons
 if is_service_enabled swift; then
-    swift-init all stop 2>/dev/null || true
+    stop_swift
 fi
 
 # Apache has the WSGI processes