Skip to content

Commit 438ff6e

Browse files
author
Mohammed AbuAisha
committed
CYBL-876 Fix issue with re-attach port to server when update deployment
1 parent 3e712d3 commit 438ff6e

File tree

4 files changed

+12
-33
lines changed

4 files changed

+12
-33
lines changed

CHANGELOG.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2.14.11:
2+
- Fix issue with re-attach port to server on deployment update.
13
2.14.10:
24
- Fix issue with create keypair resource when public key is provided.
35
2.14.9:

neutron_plugin/port.py

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
set_neutron_runtime_properties,
3737
create_object_dict,
3838
COMMON_RUNTIME_PROPERTIES_KEYS,
39-
OPENSTACK_ID_PROPERTY,
4039
is_external_relationship_not_conditionally_created)
4140

4241
from neutron_plugin.network import NETWORK_OPENSTACK_TYPE
@@ -137,7 +136,6 @@ def create(neutron_client, args, **kwargs):
137136
@with_nova_client
138137
@with_neutron_client
139138
def attach(nova_client, neutron_client, **kwargs):
140-
141139
if is_external_relationship(ctx):
142140
ctx.logger.info('Not attaching port from server since '
143141
'external port and server are being used')
@@ -146,33 +144,13 @@ def attach(nova_client, neutron_client, **kwargs):
146144
server_id = get_openstack_id(ctx.source)
147145
port_id = get_openstack_id(ctx.target)
148146
port = neutron_client.show_port(port_id)
149-
server = nova_client.servers.get(server_id)
150-
network = neutron_client.show_network(port['port']['network_id'])
151-
network_name = network['network']['name']
152-
153-
floating_ip_address = None
154-
for target in ctx.target.instance.relationships:
155-
if target.type == PORT_ADDRESS_REL_TYPE:
156-
target_instance = target.target.instance
157-
floatingip_id = \
158-
target_instance.runtime_properties[OPENSTACK_ID_PROPERTY]
159-
floating_ip = neutron_client.show_floatingip(floatingip_id)
160-
floating_ip_address = \
161-
floating_ip['floatingip']['floating_ip_address']
162-
163-
server_addresses = \
164-
[addr['addr'] for addr in server.addresses[network_name]]
165-
166-
if floating_ip_address and floating_ip_address not in server_addresses:
167-
ctx.logger.info('We will attach floating ip {0} to server {1}'
168-
.format(floating_ip_address, server_id))
169-
server.add_floating_ip(floating_ip_address)
170-
return ctx.operation.retry(
171-
message='Waiting for the floating ip {0} to '
172-
'attach to server {1}..'
173-
.format(floating_ip_address,
174-
server_id),
175-
retry_after=10)
147+
148+
# If port is attached to floating ip then once the port is attached to
149+
# the server, the floating ip will be assigned to the server directly,
150+
# in case of healing/deployment update it is not necessary to attach
151+
# floating ip associated with assigned port to server and will raise
152+
# error in since the port is not yet attached the server in case of
153+
# healing/deployment update the port
176154
change = {
177155
PORT_OPENSTACK_TYPE: {
178156
'device_id': server_id,
@@ -240,7 +218,6 @@ def delete(neutron_client, **kwargs):
240218
@with_nova_client
241219
@with_neutron_client
242220
def detach(nova_client, neutron_client, **kwargs):
243-
244221
if is_external_relationship(ctx):
245222
ctx.logger.info('Not detaching port from server since '
246223
'external port and server are being used')

plugin.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
plugins:
66
openstack:
77
executor: central_deployment_agent
8-
source: https://github.com/cloudify-cosmo/cloudify-openstack-plugin/archive/2.14.10.zip
8+
source: https://github.com/cloudify-cosmo/cloudify-openstack-plugin/archive/2.14.11.zip
99
package_name: cloudify-openstack-plugin
10-
package_version: '2.14.10'
10+
package_version: '2.14.11'
1111

1212
data_types:
1313
cloudify.openstack.types.custom_configuration:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
setup(
2020
zip_safe=True,
2121
name='cloudify-openstack-plugin',
22-
version='2.14.10',
22+
version='2.14.11',
2323
author='Cloudify',
2424
author_email='[email protected]',
2525
packages=[

0 commit comments

Comments
 (0)