Swift storage heat templates
authorRichard Su <rwsu@redhat.com>
Wed, 5 Mar 2014 22:58:22 +0000 (14:58 -0800)
committerGerrit Code Review <review@openstack.org>
Mon, 10 Mar 2014 22:00:42 +0000 (22:00 +0000)
Updated the existing swift-source template to properly list all
swift devices.

Created a new swift-storage-source template to add additional
swift-storage only nodes.

The default SWIFTSTORAGESCALE is 0. Change this number to add
additional swift storage nodes.

Change-Id: Ia05f4ad44593316430d60541106d23b032c3e760

Makefile
swift-source.yaml
swift-storage-source.yaml [new file with mode: 0644]

index 93ff852..d3424e4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -12,8 +12,8 @@ overcloud_source_deps = nova-compute-instance.yaml
 
 all: $(generated_templates)
 
-overcloud.yaml: overcloud-source.yaml swift-source.yaml ssl-source.yaml $(overcloud_source_deps)
-       python ./tripleo_heat_merge/merge.py --scale NovaCompute=$${COMPUTESCALE:-'1'} overcloud-source.yaml swift-source.yaml ssl-source.yaml > $@.tmp
+overcloud.yaml: overcloud-source.yaml swift-source.yaml swift-storage-source.yaml ssl-source.yaml $(overcloud_source_deps)
+       python ./tripleo_heat_merge/merge.py --scale NovaCompute=$${COMPUTESCALE:-'1'} --scale SwiftStorage=$${SWIFTSTORAGESCALE='0'} overcloud-source.yaml swift-source.yaml swift-storage-source.yaml ssl-source.yaml > $@.tmp
        mv $@.tmp $@
 
 overcloud-with-block-storage.yaml: overcloud-source.yaml nova-compute-instance.yaml swift-source.yaml block-storage.yaml
index 0a6bf64..8661154 100644 (file)
@@ -17,16 +17,33 @@ Resources:
       swift:
         devices:
           Fn::Join:
-            - ''
-            - - 'r1z1-'
-              - Fn::Select:
-                - 0
+          - ', '
+          - - Fn::Join:
+              - ''
+              - - 'r1z1-'
                 - Fn::Select:
-                  - 'ctlplane'
-                  - Fn::GetAtt:
-                    - notCompute0
-                    - networks
-              - ':%PORT%/d1'
+                  - 0
+                  - Fn::Select:
+                    - 'ctlplane'
+                    - Fn::GetAtt:
+                      - notCompute0
+                      - networks
+                - ':%PORT%/d1'
+            - Fn::Join:
+              - ', '
+              - Merge::Map:
+                  SwiftStorage0:
+                    Fn::Join:
+                    - ''
+                    - - 'r1z1-'
+                      - Fn::Select:
+                        - 0
+                        - Fn::Select:
+                          - 'ctlplane'
+                          - Fn::GetAtt:
+                            - SwiftStorage0
+                            - networks
+                      - ':%PORT%/d1'
         hash:
           Ref: SwiftHashSuffix
         part-power: 10
diff --git a/swift-storage-source.yaml b/swift-storage-source.yaml
new file mode 100644 (file)
index 0000000..92e11e6
--- /dev/null
@@ -0,0 +1,121 @@
+HeatTemplateFormatVersion: '2012-12-12'
+Description: 'Common Swift Storage Configuration'
+Parameters:
+  SwiftStorageImage:
+    Type: String
+    Default: overcloud-swift-storage
+  OvercloudSwiftStorageFlavor:
+    Default: baremetal
+    Description: Flavor for Swift storage nodes to request when deploying.
+    Type: String
+  NeutronNetworkType:
+    Type: String
+    Default: 'gre'
+Resources:
+  SwiftStorageAccessPolicy:
+    Type: OS::Heat::AccessPolicy
+    Properties:
+      AllowedResources:
+      - SwiftStorage0
+      - SwiftStorage0Config
+  SwiftStorageUser:
+    Type: AWS::IAM::User
+    Properties:
+      Policies: [ { Ref: SwiftStorageAccessPolicy } ]
+  SwiftStorage0Key:
+    Type: AWS::IAM::AccessKey
+    Properties:
+      UserName:
+        Ref: SwiftStorageUser
+  SwiftStorage0CompletionCondition:
+    Type: AWS::CloudFormation::WaitCondition
+    DependsOn: notCompute0Config
+    Properties:
+      Handle: {Ref: SwiftStorage0CompletionHandle}
+      Count: '1'
+      Timeout: '1800'
+  SwiftStorage0CompletionHandle:
+    Type: AWS::CloudFormation::WaitConditionHandle
+  SwiftStorage0:
+    Type: OS::Nova::Server
+    Properties:
+      image:
+        {Ref: SwiftStorageImage}
+      flavor: {Ref: OvercloudSwiftStorageFlavor}
+      key_name: {Ref: KeyName}
+    Metadata:
+      os-collect-config:
+        cfn:
+          access_key_id:
+            Ref: SwiftStorage0Key
+          secret_access_key:
+            Fn::GetAtt: [ SwiftStorage0Key, SecretAccessKey ]
+          stack_name: {Ref: 'AWS::StackName'}
+          path: SwiftStorage0Config.Metadata
+      OpenStack::ImageBuilder::Elements: [ swift ]
+  SwiftStorage0Config:
+    Type: AWS::AutoScaling::LaunchConfiguration
+    Properties:
+      InstanceType: '0'
+      ImageId: '0'
+    Metadata:
+      completion-handle:
+        Ref: SwiftStorage0CompletionHandle
+      os-collect-config:
+        cfn:
+          access_key_id:
+            Ref: SwiftStorage0Key
+          secret_access_key:
+            Fn::GetAtt: [ SwiftStorage0Key, SecretAccessKey ]
+          stack_name: {Ref: 'AWS::StackName'}
+          path: SwiftStorage0Config.Metadata
+      admin-password: {Ref: AdminPassword}
+      neutron:
+        ovs:
+          local_ip:
+            Fn::Select:
+              - 0
+              - Fn::Select:
+                - ctlplane
+                - Fn::GetAtt:
+                  - SwiftStorage0
+                  - networks
+          tenant_network_type: {Ref: NeutronNetworkType}
+        service-password:
+          Ref: NeutronPassword
+      swift:
+        devices:
+          Fn::Join:
+          - ', '
+          - - Fn::Join:
+              - ''
+              - - 'r1z1-'
+                - Fn::Select:
+                  - 0
+                  - Fn::Select:
+                    - 'ctlplane'
+                    - Fn::GetAtt:
+                      - notCompute0
+                      - networks
+                - ':%PORT%/d1'
+            - Fn::Join:
+              - ', '
+              - Merge::Map:
+                  SwiftStorage0:
+                    Fn::Join:
+                    - ''
+                    - - 'r1z1-'
+                      - Fn::Select:
+                        - 0
+                        - Fn::Select:
+                          - 'ctlplane'
+                          - Fn::GetAtt:
+                            - SwiftStorage0
+                            - networks
+                      - ':%PORT%/d1'
+        hash:
+          Ref: SwiftHashSuffix
+        part-power: 10
+        replicas: 1
+        service-password:
+          Ref: SwiftPassword