From 4734ccc2cea3ef1c20548ec5526e8312f23d8d91 Mon Sep 17 00:00:00 2001 From: Edward Hope-Morley Date: Tue, 21 Oct 2014 12:45:36 +0100 Subject: [PATCH] updated README and added logging --- README.md | 12 ++++++++++-- hooks/swift_hooks.py | 15 ++++++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e600038..9614831 100644 --- a/README.md +++ b/README.md @@ -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. + diff --git a/hooks/swift_hooks.py b/hooks/swift_hooks.py index 9c1ba32..1d33e58 100755 --- a/hooks/swift_hooks.py +++ b/hooks/swift_hooks.py @@ -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')