Add more upgrade tasks according to phases

Update README
Introduce:
 * horizon.upgrade.upgrade.pre
 * horizon.upgrade.upgrade.post
 * horizon.upgrade.verify

Change-Id: I4ab91ab4d79d792f77434e12d6823c6ba80ecb2b
diff --git a/README.rst b/README.rst
index f7a37aa..bd866d0 100644
--- a/README.rst
+++ b/README.rst
@@ -561,6 +561,67 @@
               id: myidp
               protocol: saml2
 
+
+Upgrades
+========
+
+Each openstack formula provide set of phases (logical bloks) that will help to
+build flexible upgrade orchestration logic for particular components. The list
+of phases and theirs descriptions are listed in table below:
+
++-------------------------------+------------------------------------------------------+
+| State                         | Description                                          |
++===============================+======================================================+
+| <app>.upgrade.service_running | Ensure that all services for particular application  |
+|                               | are enabled for autostart and running                |
++-------------------------------+------------------------------------------------------+
+| <app>.upgrade.service_stopped | Ensure that all services for particular application  |
+|                               | disabled for autostart and dead                      |
++-------------------------------+------------------------------------------------------+
+| <app>.upgrade.pkgs_latest     | Ensure that packages used by particular application  |
+|                               | are installed to latest available version.           |
+|                               | This will not upgrade data plane packages like qemu  |
+|                               | and openvswitch as usually minimal required version  |
+|                               | in openstack services is really old. The data plane  |
+|                               | packages should be upgraded separately by `apt-get   |
+|                               | upgrade` or `apt-get dist-upgrade`                   |
+|                               | Applying this state will not autostart service.      |
++-------------------------------+------------------------------------------------------+
+| <app>.upgrade.render_config   | Ensure configuration is rendered actual version.     +
++-------------------------------+------------------------------------------------------+
+| <app>.upgrade.pre             | We assume this state is applied on all nodes in the  |
+|                               | cloud before running upgrade.                        |
+|                               | Only non destructive actions will be applied during  |
+|                               | this phase. Perform service built in service check   |
+|                               | like (keystone-manage doctor and nova-status upgrade)|
++-------------------------------+------------------------------------------------------+
+| <app>.upgrade.upgrade.pre     | Mostly applicable for data plane nodes. During this  |
+|                               | phase resources will be gracefully removed from      |
+|                               | current node if it is allowed. Services for upgraded |
+|                               | application will be set to admin disabled state to   |
+|                               | make sure node will not participate in resources     |
+|                               | scheduling. For example on gtw nodes this will set   |
+|                               | all agents to admin disable state and will move all  |
+|                               | routers to other agents.                             |
++-------------------------------+------------------------------------------------------+
+| <app>.upgrade.upgrade         | This state will basically upgrade application on     |
+|                               | particular target. Stop services, render             |
+|                               | configuration, install new packages, run offline     |
+|                               | dbsync (for ctl), start services. Data plane should  |
+|                               | not be affected, only OpenStack python services.     |
++-------------------------------+------------------------------------------------------+
+| <app>.upgrade.upgrade.post    | Add services back to scheduling.                     |
++-------------------------------+------------------------------------------------------+
+| <app>.upgrade.post            | This phase should be launched only when upgrade of   |
+|                               | the cloud is completed. Cleanup temporary files,     |
+|                               | perform other post upgrade tasks.                    |
++-------------------------------+------------------------------------------------------+
+| <app>.upgrade.verify          | Here we will do basic health checks (API CRUD        |
+|                               | operations, verify do not have dead network          |
+|                               | agents/compute services)                             |
++-------------------------------+------------------------------------------------------+
+
+
 Read more
 =========
 
diff --git a/horizon/upgrade/upgrade/init.sls b/horizon/upgrade/upgrade/init.sls
index 203fb8b..e372805 100644
--- a/horizon/upgrade/upgrade/init.sls
+++ b/horizon/upgrade/upgrade/init.sls
@@ -6,7 +6,9 @@
     - text: "Running horizon.upgrade.upgrade"
 
 include:
+ - horizon.upgrade.upgrade.pre
  - horizon.upgrade.service_stopped
  - horizon.upgrade.pkgs_latest
  - horizon.upgrade.render_config
  - horizon.upgrade.service_running
+ - horizon.upgrade.upgrade.post
diff --git a/horizon/upgrade/upgrade/post.sls b/horizon/upgrade/upgrade/post.sls
new file mode 100644
index 0000000..44fa38f
--- /dev/null
+++ b/horizon/upgrade/upgrade/post.sls
@@ -0,0 +1,3 @@
+horizon_upgrade_uprade_post:
+  test.show_notification:
+    - text: "Running horizon.upgrade.upgrade.post"
diff --git a/horizon/upgrade/upgrade/pre.sls b/horizon/upgrade/upgrade/pre.sls
new file mode 100644
index 0000000..5b0d0ba
--- /dev/null
+++ b/horizon/upgrade/upgrade/pre.sls
@@ -0,0 +1,3 @@
+horizon_upgrade_upgrade_pre:
+  test.show_notification:
+    - text: "Running horizon.upgrade.upgrade.pre"
diff --git a/horizon/upgrade/verify/api.sls b/horizon/upgrade/verify/_api.sls
similarity index 90%
rename from horizon/upgrade/verify/api.sls
rename to horizon/upgrade/verify/_api.sls
index 72d5096..17dfabf 100644
--- a/horizon/upgrade/verify/api.sls
+++ b/horizon/upgrade/verify/_api.sls
@@ -3,7 +3,7 @@
 horizon_upgrade_verify_api:
   test.show_notification:
     - name: "dump_message_verify_api_horizon"
-    - text: "Running horizon.upgrade.verify.api"
+    - text: "Running horizon.upgrade.verify._api"
 
 {%- if server.get('enabled', false) %}
 {%- set horizon_server = '127.0.0.1' if server.get('bind', {}).get('address') == '0.0.0.0' else server.get('bind', {}).get('address') %}
diff --git a/horizon/upgrade/verify/init.sls b/horizon/upgrade/verify/init.sls
new file mode 100644
index 0000000..65f79c6
--- /dev/null
+++ b/horizon/upgrade/verify/init.sls
@@ -0,0 +1,2 @@
+include:
+ - horizon.upgrade.verify._api