From b03921a393aed44fe0024b63c3b2aaa2c34b8b28 Mon Sep 17 00:00:00 2001 From: Drew Freiberger Date: Mon, 12 Jun 2017 17:37:02 -0500 Subject: [PATCH 1/2] Added private space binding to allow for override of unit's private-address if not using prefer_ipv6 --- README.md | 8 ++++++++ hooks/swift_storage_hooks.py | 7 +++++++ metadata.yaml | 2 ++ 3 files changed, 17 insertions(+) diff --git a/README.md b/README.md index b3b8020c..0b274a25 100644 --- a/README.md +++ b/README.md @@ -56,3 +56,11 @@ The 'openstack-origin' setting allows Swift to be installed from installation repositories and can be used to setup access to the Ubuntu Cloud Archive to support installing Swift versions more recent than what is shipped with Ubuntu 12.04 (1.4.8). For more information, see config.yaml. + +**Juju Spaces Awareness** + +The juju space binding for "private" has been added to the charm to allow +for override of the unit's default private-address advertised to it's proxy +relations. This is done in case swift-storage units are landed on machines +that have alternative networks defined that are not accessible from the +swift-proxy units it is to be related with. diff --git a/hooks/swift_storage_hooks.py b/hooks/swift_storage_hooks.py index f2ab78ae..82cf09f0 100755 --- a/hooks/swift_storage_hooks.py +++ b/hooks/swift_storage_hooks.py @@ -48,6 +48,7 @@ relation_set, relations_of_type, status_set, + network_get_primary_address, ) from charmhelpers.fetch import ( @@ -156,6 +157,12 @@ def swift_storage_relation_joined(rid=None): # Keep a reference of devices we are adding to the ring remember_devices(devs) + # Fix for lp:1697491 - Assign "private" binding to network you + # wish to relate with swift-proxy on. Fails back to unit def. + private_binding_address = network_get_primary_address('private') + if private_binding_address is not None: + rel_settings['private-address'] = private_binding_address + if config('prefer-ipv6'): rel_settings['private-address'] = get_ipv6_addr()[0] diff --git a/metadata.yaml b/metadata.yaml index 86af296d..144ba219 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -22,6 +22,8 @@ series: - zesty - trusty - yakkety +extra-bindings: + - private provides: nrpe-external-master: interface: nrpe-external-master From dd9189a04da0180ddd8e81634851f95e411e9163 Mon Sep 17 00:00:00 2001 From: Drew Freiberger Date: Mon, 12 Jun 2017 17:41:39 -0500 Subject: [PATCH 2/2] fixed metadata.yaml format for extra-bindings: private --- metadata.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.yaml b/metadata.yaml index 144ba219..71371cd1 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -23,7 +23,7 @@ series: - trusty - yakkety extra-bindings: - - private + private: provides: nrpe-external-master: interface: nrpe-external-master