[hopem, r=thedac] Be tolerant of swift-storage-relation not ready yet. Closes-Bug: 1510940

This commit is contained in:
David Ames
2015-11-06 13:30:44 -08:00
2 changed files with 16 additions and 3 deletions

View File

@@ -210,9 +210,11 @@ def storage_changed():
if config('prefer-ipv6'):
host_ip = format_ipv6_addr(addr)
if not host_ip:
errmsg = ("Did not get IPv6 address from storage relation "
"(got=%s)" % (addr))
raise SwiftProxyCharmException(errmsg)
msg = ("Did not get IPv6 address from storage relation "
"(got=%s)" % (addr))
log(msg, level=WARNING)
host_ip = addr
return
else:
host_ip = openstack.get_host_ip(addr)

View File

@@ -60,6 +60,7 @@ from charmhelpers.core.host import (
from charmhelpers.contrib.network.ip import (
format_ipv6_addr,
get_ipv6_addr,
is_ipv6,
)
from charmhelpers.core.decorators import (
retry_on_exception,
@@ -1057,6 +1058,16 @@ def assess_status(configs):
status_set('blocked', 'Not enough storage zones for minimum replicas')
return
if config('prefer-ipv6'):
for rid in relation_ids('swift-storage'):
for unit in related_units(rid):
addr = relation_get(attribute='private-address', unit=unit,
rid=rid)
if not is_ipv6(addr):
status_set('blocked', 'Did not get IPv6 address from '
'storage relation (got=%s)' % (addr))
return
if relation_ids('identity-service'):
required_interfaces['identity'] = ['identity-service']