Upgrades: initialization command/snippet
authorJiri Stransky <jistr@redhat.com>
Wed, 9 Mar 2016 10:18:40 +0000 (11:18 +0100)
committerJiri Stransky <jistr@redhat.com>
Wed, 9 Mar 2016 12:58:20 +0000 (13:58 +0100)
This allows to run a command or a script snippet on all overcloud nodes
at the beginning of the upgrade. The intended use is to switch to a new
set of repositories on the overcloud. This is done differently in
different contexts (e.g. upstream vs. downstream), but generally it
should be simple enough to not warrant creation of switchable
"UpgradeInit" resource in the resource registry, and a string
command/snippet parameter should suffice.

Change-Id: I72271170d3f53a5179b3212ec9bae9a6204e29e6

environments/major-upgrade-pacemaker-init.yaml [moved from environments/major-upgrade-script-delivery.yaml with 94% similarity]
extraconfig/tasks/major_upgrade_pacemaker_init.yaml [moved from extraconfig/tasks/major_upgrade_script_delivery.yaml with 58% similarity]

@@ -2,7 +2,7 @@ parameter_defaults:
   UpgradeLevelNovaCompute: liberty
 
 resource_registry:
-  OS::TripleO::Tasks::UpdateWorkflow: ../extraconfig/tasks/major_upgrade_script_delivery.yaml
+  OS::TripleO::Tasks::UpdateWorkflow: ../extraconfig/tasks/major_upgrade_pacemaker_init.yaml
   OS::TripleO::Tasks::PackageUpdate:  ../extraconfig/tasks/yum_update_noop.yaml
   OS::TripleO::ControllerPostDeployment: OS::Heat::None
   OS::TripleO::ComputePostDeployment: OS::Heat::None
@@ -17,12 +17,64 @@ parameters:
     type: json
     description: input values for the software deployments
 
+  UpgradeInitCommand:
+    type: string
+    description: |
+      Command or script snippet to run on all overcloud nodes to
+      initialize the upgrade process. E.g. a repository switch.
+    default: ''
   UpgradeLevelNovaCompute:
     type: string
     description: Nova Compute upgrade level
     default: ''
 
 resources:
+
+  UpgradeInitConfig:
+    type: OS::Heat::SoftwareConfig
+    properties:
+      group: script
+      config:
+        list_join:
+        - ''
+        - - "#!/bin/bash\n\n"
+          - get_param: UpgradeInitCommand
+
+  UpgradeInitControllerDeployment:
+    type: OS::Heat::SoftwareDeploymentGroup
+    properties:
+      servers:  {get_param: controller_servers}
+      config: {get_resource: UpgradeInitConfig}
+      input_values: {get_param: input_values}
+
+  UpgradeInitComputeDeployment:
+    type: OS::Heat::SoftwareDeploymentGroup
+    properties:
+      servers:  {get_param: compute_servers}
+      config: {get_resource: UpgradeInitConfig}
+      input_values: {get_param: input_values}
+
+  UpgradeInitBlockStorageDeployment:
+    type: OS::Heat::SoftwareDeploymentGroup
+    properties:
+      servers:  {get_param: blockstorage_servers}
+      config: {get_resource: UpgradeInitConfig}
+      input_values: {get_param: input_values}
+
+  UpgradeInitObjectStorageDeployment:
+    type: OS::Heat::SoftwareDeploymentGroup
+    properties:
+      servers:  {get_param: objectstorage_servers}
+      config: {get_resource: UpgradeInitConfig}
+      input_values: {get_param: input_values}
+
+  UpgradeInitCephStorageDeployment:
+    type: OS::Heat::SoftwareDeploymentGroup
+    properties:
+      servers:  {get_param: cephstorage_servers}
+      config: {get_resource: UpgradeInitConfig}
+      input_values: {get_param: input_values}
+
   # TODO(jistr): for Mitaka->Newton upgrades and further we can use
   # map_merge with input_values instead of feeding params into scripts
   # via str_replace on bash snippets