Change flat network name for nosdn fdio scenario
[apex-tripleo-heat-templates.git] / puppet / services / neutron-sriov-agent.yaml
index d3c82d8..5c52ecf 100644 (file)
@@ -1,9 +1,13 @@
-heat_template_version: ocata
+heat_template_version: pike
 
 description: >
   OpenStack Neutron SR-IOV nic agent configured with Puppet
 
 parameters:
+  ServiceData:
+    default: {}
+    description: Dictionary packing service data
+    type: json
   ServiceNetMap:
     default: {}
     description: >
@@ -14,6 +18,14 @@ parameters:
   DefaultPasswords:
     default: {}
     type: json
+  RoleName:
+    default: ''
+    description: Role name on which the service is applied
+    type: string
+  RoleParameters:
+    default: {}
+    description: Parameters specific to the role
+    type: json
   EndpointMap:
     default: {}
     description: Mapping of service endpoint -> protocol. Typically set
@@ -51,9 +63,30 @@ resources:
   NeutronBase:
     type: ./neutron-base.yaml
     properties:
+      ServiceData: {get_param: ServiceData}
       ServiceNetMap: {get_param: ServiceNetMap}
       DefaultPasswords: {get_param: DefaultPasswords}
       EndpointMap: {get_param: EndpointMap}
+      RoleName: {get_param: RoleName}
+      RoleParameters: {get_param: RoleParameters}
+
+  # Merging role-specific parameters (RoleParameters) with the default parameters.
+  # RoleParameters will have the precedence over the default parameters.
+  RoleParametersValue:
+    type: OS::Heat::Value
+    properties:
+      type: json
+      value:
+        map_replace:
+          - map_replace:
+            - neutron::agents::ml2::sriov::physical_device_mappings: NeutronPhysicalDevMappings
+              neutron::agents::ml2::sriov::exclude_devices: NeutronExcludeDevices
+              tripleo::host::sriov::number_of_vfs: NeutronSriovNumVFs
+            - values: {get_param: [RoleParameters]}
+          - values:
+              NeutronPhysicalDevMappings: {get_param: NeutronPhysicalDevMappings}
+              NeutronExcludeDevices: {get_param: NeutronExcludeDevices}
+              NeutronSriovNumVFs: {get_param: NeutronSriovNumVFs}
 
 outputs:
   role_data:
@@ -63,8 +96,20 @@ outputs:
       config_settings:
         map_merge:
           - get_attr: [NeutronBase, role_data, config_settings]
-          - neutron::agents::ml2::sriov::physical_device_mappings: {get_param: NeutronPhysicalDevMappings}
-            neutron::agents::ml2::sriov::exclude_devices: {get_param: NeutronExcludeDevices}
-            tripleo::host::sriov::number_of_vfs: {get_param: NeutronSriovNumVFs}
+          - get_attr: [RoleParametersValue, value]
       step_config: |
         include ::tripleo::profile::base::neutron::sriov
+      upgrade_tasks:
+        - name: Check if neutron_sriov_agent is deployed
+          command: systemctl is-enabled neutron-sriov-nic-agent
+          tags: common
+          ignore_errors: True
+          register: neutron_sriov_nic_agent_enabled
+        - name: "PreUpgrade step0,validation: Check service neutron-server is running"
+          shell: /usr/bin/systemctl show 'neutron-sriov-nic-agent' --property ActiveState | grep '\bactive\b'
+          when: neutron_sriov_nic_agent_enabled.rc == 0
+          tags: step0,validation
+        - name: Stop neutron_sriov_nic_agent service
+          tags: step1
+          when: neutron_sriov_nic_agent_enabled.rc == 0
+          service: name=neutron-sriov-nic-agent state=stopped