Skip to content

Commit

Permalink
Merge pull request #290 from cloudify-cosmo/issue-289
Browse files Browse the repository at this point in the history
fixes #289
  • Loading branch information
EarthmanT authored Dec 2, 2018
2 parents bc7fc2f + 654429c commit d41fd3f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
2.14.4:
- By default, don't allow using an existing floating IP if it had already been allocated.
2.14.3:
- Fix check subnet cidr for fixed ip.
2.14.2:
Expand Down
8 changes: 7 additions & 1 deletion openstack_plugin_common/floatingip.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# * limitations under the License.

from cloudify import ctx
from cloudify.exceptions import RecoverableError
from openstack_plugin_common import (
delete_resource_and_runtime_properties,
use_external_resource,
Expand All @@ -22,7 +23,6 @@
OPENSTACK_ID_PROPERTY,
OPENSTACK_TYPE_PROPERTY)


FLOATINGIP_OPENSTACK_TYPE = 'floatingip'

# Runtime properties
Expand All @@ -35,6 +35,12 @@ def use_external_floatingip(client, ip_field_name, ext_fip_ip_extractor):
external_fip = use_external_resource(
ctx, client, FLOATINGIP_OPENSTACK_TYPE, ip_field_name)
if external_fip:
if ctx.node.properties['allow_reallocation'] \
and external_fip['status'] == 'ACTIVE':
raise RecoverableError(
'Floating IP address {0} is already associated'.format(
external_fip['floating_ip_address'])
)
ctx.instance.runtime_properties[IP_ADDRESS_PROPERTY] = \
ext_fip_ip_extractor(external_fip)
return True
Expand Down
12 changes: 10 additions & 2 deletions plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
plugins:
openstack:
executor: central_deployment_agent
source: https://github.com/cloudify-cosmo/cloudify-openstack-plugin/archive/2.14.3.zip
source: https://github.com/cloudify-cosmo/cloudify-openstack-plugin/archive/2.14.4.zip
package_name: cloudify-openstack-plugin
package_version: '2.14.3'
package_version: '2.14.4'

data_types:
cloudify.openstack.types.custom_configuration:
Expand Down Expand Up @@ -883,6 +883,14 @@ node_types:
description: >
a boolean for setting whether to create the resource or use an existing one.
See the using existing resources section.
allow_reallocation:
type: boolean
default: false
description: >
(Applicable only when use_external_resource is true)
If true, then allow using this floating IP even if it has already been allocated to
another instance. If false, and the floating IP is already allocated (that is, it is
in 'ACTIVE' state), a recoverable error is raised.
create_if_missing:
type: boolean
default: false
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
setup(
zip_safe=True,
name='cloudify-openstack-plugin',
version='2.14.3',
version='2.14.4',
author='Cloudify',
author_email='[email protected]',
packages=[
Expand Down

0 comments on commit d41fd3f

Please sign in to comment.