deb-murano/meta/io.murano/Classes/SharedIp.yaml
Alexander Tivelkov 98bb793b38 Enforced AUTO replacement_policy for sharedIp port
In Openstack releases prior to Kilo Heat recreates all the Neutron Ports
during the stack update regardless of the port resource being actually
updated or not. This is done intentionally to workaround the bug in nova
(https://bugs.launchpad.net/nova/+bug/1158684)
However, this approach may cause issues when the stack is updated after
the instance and the port are created (which happens during many Murano
env deployments). To control port re-creation logic Heat allows to
explicitly specify the replacement_policy property for OS::Neutron::Port
resource: if set to AUTO it forbids Heat to recreate the port if it was
not modified.

For regular instances and their ports we are already using this setting.
However, for the ports created for SharedIps this was not true, thus
causing issues on pre-kilo deployments. This patch fixes it.

On deployments using Kilo+ Heat this patch has no effect, as the default
value of replacenent_policy is already AUTO in this releases.

Change-Id: Ib87961a4f2285bf622df50828ecd2ad98365a910
Closes-Bug: #1488105
2015-08-26 18:17:33 +03:00

89 lines
2.9 KiB
YAML

Namespaces:
=: io.murano
Name: SharedIp
Properties:
assignFloatingIp:
Contract: $.bool().notNull()
Default: false
virtualIp:
Contract: $.string()
Usage: Out
floatingIpAddress:
Contract: $.string()
Usage: Out
Workflow:
initialize:
Body:
- $.environment: $.find(Environment).require()
- $.network: $.environment.defaultNetworks.environment
- $.instances: []
deploy:
Body:
- If: not $.getAttr(deployed, false)
Then:
- $reporter: $.environment.reporter
- $.network.deploy()
- $aapPortName: format('AllowedAddressPairsPort-{0}', $.id())
- $template:
heat_template_version: '2013-05-23'
resources:
$aapPortName:
type: 'OS::Neutron::Port'
properties:
network_id: $.network.describe().netRef
replacement_policy: AUTO
fixed_ips:
- subnet_id: $.network.describe().subnetRef
outputs:
$aapPortName+'-virtualIp':
value:
get_attr: [$aapPortName, fixed_ips, 0, ip_address]
description: format('SharedIP Address of SharedIp group {0}', $.id())
- $.environment.stack.updateTemplate($template)
- If: $.assignFloatingIp
Then:
- $extNetId: $.network.describe().floatingIpNeRef
- $fip_name: format('Shared-Floating-ip-{0}', $.id())
- $template:
resources:
$fip_name:
type: 'OS::Neutron::FloatingIP'
properties:
floating_network_id: $extNetId
port_id:
get_resource: $aapPortName
outputs:
$fip_name + '-val':
value:
get_attr: [$fip_name, floating_ip_address]
description: Shared Floating IP assigned
- $.environment.stack.updateTemplate($template)
- $reporter.report($this, 'Allocating shared ip address')
- $.environment.stack.push()
- $outputs: $.environment.stack.output()
- $.virtualIp: $outputs.get(format('AllowedAddressPairsPort-{0}-virtualIp', $.id()))
- $.floatingIpAddress: $outputs.get(format('Shared-Floating-ip-{0}-val', $.id()))
- $reporter.report($this, format('Shared IP allocated at {0}', $.virtualIp))
- If: $.assignFloatingIp
Then:
- $reporter.report($this, format('Floating shared IP is {0}', $.floatingIpAddress))
- $.setAttr(deployed, true)
getSharedIpRef:
Body:
- $aapPortName: format('AllowedAddressPairsPort-{0}', $.id())
- Return:
get_attr: [$aapPortName, fixed_ips, 0, ip_address]