updated README and added logging

This commit is contained in:
Edward Hope-Morley 2014-10-21 12:45:36 +01:00
parent 88179fae69
commit 4734ccc2ce
2 changed files with 24 additions and 3 deletions

View File

@ -14,8 +14,8 @@ This charm was developed to support deploying multiple version of Swift on
Ubuntu Precise 12.04, as they relate to the release series of OpenStack. That
is, OpenStack Essex corresponds to Swift 1.4.8 while OpenStack Folsom shipped
1.7.4. This charm can be used to deploy either (and future) versions of Swift
onto an Ubuntu Precise 12.04, making use of the Ubuntu Cloud Archive when
needed.
onto an Ubuntu Precise 12.04 or Trusty 14.04 making use of the Ubuntu Cloud
Archive when needed.
Usage
-----
@ -130,3 +130,11 @@ required for any integration with other OpenStack components.
Swift may be used to as a storage backend for the Glance image service. To do
so, simply add a relation between swift-proxy and an existing Glance service
deployed using the cs:precise/glance charm.
**HACLUSTER**
When running multiple units of the swift-proxy service, especially if a
relation is added with hacluster, it is very important to ensure that all
proxy units have finished installing and the cluster has reached quorum prior to
joining swift-storage relations.

View File

@ -36,6 +36,7 @@ from charmhelpers.core.hookenv import (
relation_ids,
relation_get,
log,
INFO,
WARNING,
ERROR,
Hooks, UnregisteredHookError,
@ -145,6 +146,7 @@ def get_hostaddr():
def builders_synced():
for ring in SWIFT_RINGS.itervalues():
if not os.path.exists(ring):
log("Builder not yet synced - %s" % (ring))
return False
return True
@ -157,6 +159,7 @@ def balance_rings():
if balance_ring(ring):
log('Balanced ring %s' % ring)
new_ring = True
if not new_ring:
return
@ -229,6 +232,9 @@ def storage_changed():
if should_balance([r for r in SWIFT_RINGS.itervalues()]):
balance_rings()
else:
log("Not yet ready to balance rings - insufficient replicas?",
level=INFO)
# Notify peers that builders are available
for rid in relation_ids('cluster'):
@ -314,12 +320,19 @@ def cluster_changed():
return None
if builders_synced():
log("Ring builders synced - balancing rings and starting "
"proxy")
if should_balance([r for r in SWIFT_RINGS.itervalues()]):
balance_rings()
else:
log("Not yet ready to balance rings - "
"insufficient replicas?", level=INFO)
log('Ring builders synced - starting swift-poxy')
CONFIGS.write_all()
service_start('swift-proxy')
else:
log("Not all builders synced yet - waiting for peer sync "
"before starting proxy", level=INFO)
@hooks.hook('ha-relation-changed')