Config & deployments to update overcloud packages
authorSteve Baker <sbaker@redhat.com>
Mon, 4 May 2015 23:25:40 +0000 (11:25 +1200)
committerJan Provaznik <jprovazn@redhat.com>
Mon, 8 Jun 2015 14:07:26 +0000 (16:07 +0200)
This change adds config and deployment resources to trigger package
updates on nodes. The deployments are triggered by doing a stack-update
and setting one of the parameters to a unique value.

The intent is that rolling update will be controlled by setting
breakpoints on all of the UpdateDeployment resources inside the
role resource groups.

Change-Id: I56bbf944ecd6cbdbf116021b8a53f9f9111c134f

15 files changed:
ceph-storage.yaml
cinder-storage.yaml
compute.yaml
controller.yaml
extraconfig/tasks/yum_update.sh [new file with mode: 0755]
extraconfig/tasks/yum_update.yaml [new file with mode: 0644]
overcloud-resource-registry-puppet.yaml
overcloud-resource-registry.yaml
overcloud-without-mergepy.yaml
puppet/ceph-storage-puppet.yaml
puppet/cinder-storage-puppet.yaml
puppet/compute-puppet.yaml
puppet/controller-puppet.yaml
puppet/swift-storage-puppet.yaml
swift-storage.yaml

index 05d8092..138e6ea 100644 (file)
@@ -33,6 +33,12 @@ parameters:
     description: Mapping of service_name -> network name. Typically set
                  via parameter_defaults in the resource registry.
     type: json
+  UpdateIdentifier:
+    default: ''
+    type: string
+    description: >
+      Setting to a previously unused value during stack-update will trigger
+      package update on all nodes
 
 resources:
   CephStorage:
index aee67c9..9541ed1 100644 (file)
@@ -100,6 +100,13 @@ parameters:
     description: The user password for SNMPd with readonly rights running on all Overcloud nodes
     type: string
     hidden: true
+  UpdateIdentifier:
+    default: ''
+    type: string
+    description: >
+      Setting to a previously unused value during stack-update will trigger
+      package update on all nodes
+
 resources:
   BlockStorage:
     type: OS::Nova::Server
index f434c27..abd5910 100644 (file)
@@ -248,6 +248,12 @@ parameters:
     description: Mapping of service_name -> network name. Typically set
                  via parameter_defaults in the resource registry.
     type: json
+  UpdateIdentifier:
+    default: ''
+    type: string
+    description: >
+      Setting to a previously unused value during stack-update will trigger
+      package update on all nodes
 
 resources:
 
index 82cff3f..51dba07 100644 (file)
@@ -438,6 +438,12 @@ parameters:
     description: Mapping of service_name -> network name. Typically set
                  via parameter_defaults in the resource registry.
     type: json
+  UpdateIdentifier:
+    default: ''
+    type: string
+    description: >
+      Setting to a previously unused value during stack-update will trigger
+      package update on all nodes
 
 resources:
 
diff --git a/extraconfig/tasks/yum_update.sh b/extraconfig/tasks/yum_update.sh
new file mode 100755 (executable)
index 0000000..3d4c772
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+# A heat-config-script which runs yum update during a stack-update.
+# Inputs:
+#   deploy_action - yum will only be run if this is UPDATE
+#   update_identifier - yum will only run for previously unused values of update_identifier
+#   command - yum sub-command to run, defaults to "update"
+#   command_arguments - yum command arguments, defaults to ""
+
+echo "Started yum_update.sh on server $deploy_server_id at `date`"
+
+if [[ -z "$update_identifier" ]]; then
+    echo "Not running due to unset update_identifier"
+    exit 0
+fi
+
+timestamp_dir=/var/lib/overcloud-yum-update
+mkdir -p $timestamp_dir
+
+# sanitise to remove unusual characters
+update_identifier=${update_identifier//[^a-zA-Z0-9-_]/}
+
+timestamp_file="$timestamp_dir/$update_identifier"
+if [[ -a "$timestamp_file" ]]; then
+    echo "Not running for already-run timestamp \"$update_identifier\""
+    exit 0
+fi
+touch "$timestamp_file"
+
+command=${command:-update}
+full_command="yum -y $command $command_arguments"
+echo "Running: $full_command"
+
+result=$($full_command)
+return_code=$?
+echo "$result"
+echo "yum return code: $return_code"
+
+echo "Finished yum_update.sh on server $deploy_server_id at `date`"
+
+exit $return_code
diff --git a/extraconfig/tasks/yum_update.yaml b/extraconfig/tasks/yum_update.yaml
new file mode 100644 (file)
index 0000000..e918149
--- /dev/null
@@ -0,0 +1,26 @@
+heat_template_version: 2014-10-16
+
+description: >
+  Software-config for performing package updates using yum
+
+resources:
+
+  config:
+    type: OS::Heat::SoftwareConfig
+    properties:
+      group: script
+      config: {get_file: yum_update.sh}
+      inputs:
+      - name: update_identifier
+        description: yum will only run for previously unused values of update_identifier
+        default: ''
+      - name: command
+        description: yum sub-command to run, defaults to "update"
+        default: update
+      - name: command_arguments
+        description: yum command arguments, defaults to ""
+        default: ''
+
+outputs:
+  OS::stack_id:
+    value: {get_resource: config}
\ No newline at end of file
index b7e0c1f..881ca79 100644 (file)
@@ -23,6 +23,7 @@ resource_registry:
   OS::TripleO::BootstrapNode::SoftwareConfig: puppet/bootstrap-config.yaml
   OS::TripleO::NodeUserData: firstboot/userdata_default.yaml
   OS::TripleO::NodeExtraConfigPost: extraconfig/post_deploy/default.yaml
+  OS::TripleO::Tasks::PackageUpdate: extraconfig/tasks/yum_update.yaml
 
   # TripleO overcloud networks
   OS::TripleO::Network: network/networks.yaml
index 3d92082..7be199d 100644 (file)
@@ -21,6 +21,7 @@ resource_registry:
   OS::TripleO::BootstrapNode::SoftwareConfig: bootstrap-config.yaml
   OS::TripleO::NodeUserData: firstboot/userdata_default.yaml
   OS::TripleO::NodeExtraConfigPost: extraconfig/post_deploy/default.yaml
+  OS::TripleO::Tasks::PackageUpdate: extraconfig/tasks/yum_update.yaml
 
   # TripleO overcloud networks
   OS::TripleO::Network: network/networks.yaml
index 61dcc3b..583634f 100644 (file)
@@ -562,6 +562,14 @@ parameters:
     constraints:
       - custom_constraint: nova.flavor
 
+# Identifiers to trigger tasks on nodes
+  UpdateIdentifier:
+    default: ''
+    type: string
+    description: >
+      Setting to a previously unused value during stack-update will trigger
+      package update on all nodes
+
 resources:
 
   HeatAuthEncryptionKey:
@@ -672,6 +680,7 @@ resources:
           MysqlVirtualIP: {get_attr: [VipMap, net_ip_map, {get_param: [ServiceNetMap, MysqlNetwork]}]}
           KeystonePublicApiVirtualIP: {get_attr: [VipMap, net_ip_map, {get_param: [ServiceNetMap, KeystonePublicApiNetwork]}]}
           NeutronApiVirtualIP: {get_attr: [VipMap, net_ip_map, {get_param: [ServiceNetMap, NeutronApiNetwork]}]}
+          UpdateIdentifier: {get_param: UpdateIdentifier}
 
   Compute:
     type: OS::Heat::ResourceGroup
@@ -729,6 +738,7 @@ resources:
           SnmpdReadonlyUserName: {get_param: SnmpdReadonlyUserName}
           SnmpdReadonlyUserPassword: {get_param: SnmpdReadonlyUserPassword}
           ServiceNetMap: {get_param: ServiceNetMap}
+          UpdateIdentifier: {get_param: UpdateIdentifier}
 
   BlockStorage:
     type: OS::Heat::ResourceGroup
@@ -753,6 +763,7 @@ resources:
           RabbitClientUseSSL: {get_param: RabbitClientUseSSL}
           RabbitClientPort: {get_param: RabbitClientPort}
           NtpServer: {get_param: NtpServer}
+          UpdateIdentifier: {get_param: UpdateIdentifier}
 
   ObjectStorage:
     type: OS::Heat::ResourceGroup
@@ -771,6 +782,7 @@ resources:
           Image: {get_param: SwiftStorageImage}
           Replicas: { get_param: SwiftReplicas}
           NtpServer: {get_param: NtpServer}
+          UpdateIdentifier: {get_param: UpdateIdentifier}
 
   CephStorage:
     type: OS::Heat::ResourceGroup
@@ -785,6 +797,7 @@ resources:
           Flavor: {get_param: OvercloudCephStorageFlavor}
           NtpServer: {get_param: NtpServer}
           ServiceNetMap: {get_param: ServiceNetMap}
+          UpdateIdentifier: {get_param: UpdateIdentifier}
 
   ControllerIpListMap:
     type: OS::TripleO::Network::Ports::NetIpListMap
index e3fa56b..1ab381a 100644 (file)
@@ -33,6 +33,12 @@ parameters:
     description: Mapping of service_name -> network name. Typically set
                  via parameter_defaults in the resource registry.
     type: json
+  UpdateIdentifier:
+    default: ''
+    type: string
+    description: >
+      Setting to a previously unused value during stack-update will trigger
+      package update on all nodes
 
 resources:
   CephStorage:
@@ -116,6 +122,18 @@ resources:
                 ceph::profile::params::cluster_network: {get_input: ceph_cluster_network}
                 ceph::profile::params::public_network: {get_input: ceph_public_network}
 
+  UpdateConfig:
+    type: OS::TripleO::Tasks::PackageUpdate
+
+  UpdateDeployment:
+    type: OS::Heat::SoftwareDeployment
+    properties:
+      config: {get_resource: UpdateConfig}
+      server: {get_resource: CephStorage}
+      input_values:
+        update_identifier:
+          get_param: UpdateIdentifier
+
 outputs:
   hosts_entry:
     value:
index 007a489..74df116 100644 (file)
@@ -111,6 +111,12 @@ parameters:
     default: 'false'
     description: Set to true to enable package installation via Puppet
     type: boolean
+  UpdateIdentifier:
+    default: ''
+    type: string
+    description: >
+      Setting to a previously unused value during stack-update will trigger
+      package update on all nodes
 
 resources:
   BlockStorage:
@@ -221,6 +227,18 @@ resources:
                 snmpd_readonly_user_name: {get_input: snmpd_readonly_user_name}
                 snmpd_readonly_user_password: {get_input: snmpd_readonly_user_password}
 
+  UpdateConfig:
+    type: OS::TripleO::Tasks::PackageUpdate
+
+  UpdateDeployment:
+    type: OS::Heat::SoftwareDeployment
+    properties:
+      config: {get_resource: UpdateConfig}
+      server: {get_resource: BlockStorage}
+      input_values:
+        update_identifier:
+          get_param: UpdateIdentifier
+
 outputs:
   hosts_entry:
     value:
index de888c7..12e701d 100644 (file)
@@ -252,6 +252,12 @@ parameters:
     description: Mapping of service_name -> network name. Typically set
                  via parameter_defaults in the resource registry.
     type: json
+  UpdateIdentifier:
+    default: ''
+    type: string
+    description: >
+      Setting to a previously unused value during stack-update will trigger
+      package update on all nodes
 
 resources:
 
@@ -466,6 +472,18 @@ resources:
               server: {get_param: NtpServer}
         enable_package_install: {get_param: EnablePackageInstall}
 
+  UpdateConfig:
+    type: OS::TripleO::Tasks::PackageUpdate
+
+  UpdateDeployment:
+    type: OS::Heat::SoftwareDeployment
+    properties:
+      config: {get_resource: UpdateConfig}
+      server: {get_resource: NovaCompute}
+      input_values:
+        update_identifier:
+          get_param: UpdateIdentifier
+
 outputs:
   ip_address:
     description: IP address of the server in the ctlplane network
index ff3f933..98c8f5d 100644 (file)
@@ -446,6 +446,12 @@ parameters:
     description: Mapping of service_name -> network name. Typically set
                  via parameter_defaults in the resource registry.
     type: json
+  UpdateIdentifier:
+    default: ''
+    type: string
+    description: >
+      Setting to a previously unused value during stack-update will trigger
+      package update on all nodes
 
 resources:
 
@@ -976,6 +982,18 @@ resources:
                 tripleo::loadbalancer::public_virtual_interface: {get_input: public_virtual_interface}
                 enable_package_install: {get_input: enable_package_install}
 
+  UpdateConfig:
+    type: OS::TripleO::Tasks::PackageUpdate
+
+  UpdateDeployment:
+    type: OS::Heat::SoftwareDeployment
+    properties:
+      config: {get_resource: UpdateConfig}
+      server: {get_resource: Controller}
+      input_values:
+        update_identifier:
+          get_param: UpdateIdentifier
+
 outputs:
   ip_address:
     description: IP address of the server in the ctlplane network
index 12292de..2268f41 100644 (file)
@@ -51,6 +51,12 @@ parameters:
     default: 'false'
     description: Set to true to enable package installation via Puppet
     type: boolean
+  UpdateIdentifier:
+    default: ''
+    type: string
+    description: >
+      Setting to a previously unused value during stack-update will trigger
+      package update on all nodes
 
 resources:
 
@@ -151,6 +157,18 @@ resources:
               server: {get_param: NtpServer}
         enable_package_install: {get_param: EnablePackageInstall}
 
+  UpdateConfig:
+    type: OS::TripleO::Tasks::PackageUpdate
+
+  UpdateDeployment:
+    type: OS::Heat::SoftwareDeployment
+    properties:
+      config: {get_resource: UpdateConfig}
+      server: {get_resource: SwiftStorage}
+      input_values:
+        update_identifier:
+          get_param: UpdateIdentifier
+
 outputs:
   hosts_entry:
     value:
index 68923ee..c281934 100644 (file)
@@ -82,6 +82,12 @@ parameters:
     description: The user password for SNMPd with readonly rights running on all Overcloud nodes
     type: string
     hidden: true
+  UpdateIdentifier:
+    default: ''
+    type: string
+    description: >
+      Setting to a previously unused value during stack-update will trigger
+      package update on all nodes
 
 resources:
   SwiftConfig: