Add support for Docker as Nova hypervisor

* Add basic support for hypervisor plugins in lib/nova_plugins
* Add lib/nova_plugins/hypervisor-docker to use Docker as a Nova
  hypervisor.
* Add tools/install_docker.sh to install the Docker daemon and
  registry container, download base image and import
* Configure Nova to use docker plugin
* Add docker exercise and skip unsupported ones

Nova blueprint: new-hypervisor-docker

Change-Id: I9e7065b562dce2ce853def583ab1165886612227
diff --git a/lib/nova b/lib/nova
index 842c098..3486aa8 100644
--- a/lib/nova
+++ b/lib/nova
@@ -169,6 +169,13 @@
     fi
 
     sudo rm -rf $NOVA_STATE_PATH $NOVA_AUTH_CACHE_DIR
+
+    # NOTE(dtroyer): This really should be called from here but due to the way
+    #                nova abuses the _cleanup() function we're moving it
+    #                directly into cleanup.sh until this can be fixed.
+    #if is_service_enabled n-cpu && [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then
+    #    cleanup_nova_hypervisor
+    #fi
 }
 
 # configure_nova_rootwrap() - configure Nova's rootwrap
@@ -650,7 +657,9 @@
 # install_nova() - Collect source and prepare
 function install_nova() {
     if is_service_enabled n-cpu; then
-        if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then
+        if [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then
+            install_nova_hypervisor
+        elif [[ "$VIRT_DRIVER" = 'libvirt' ]]; then
             if is_ubuntu; then
                 install_package kvm
                 install_package libvirt-bin
@@ -728,6 +737,9 @@
            screen_it n-cpu "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-compute --config-file $NOVA_CONF_BOTTOM"
        done
     else
+        if is_service_enabled n-cpu && [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then
+            start_nova_hypervisor
+        fi
         screen_it n-cpu "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-compute --config-file $NOVA_CONF_BOTTOM"
     fi
     screen_it n-crt "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cert"
@@ -754,6 +766,9 @@
     for serv in n-api n-cpu n-crt n-net n-sch n-novnc n-xvnc n-cauth n-spice n-cond n-cond n-cell n-cell n-api-meta; do
         screen -S $SCREEN_NAME -p $serv -X kill
     done
+    if is_service_enabled n-cpu && [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then
+        stop_nova_hypervisor
+    fi
 }