Merge lp:~raharper/charms/trusty/swift-proxy/next-unique-get-zone into lp:~openstack-charmers-archive/charms/trusty/swift-proxy/next

Proposed by Corey Bryant
Status: Merged
Merged at revision: 55
Proposed branch: lp:~raharper/charms/trusty/swift-proxy/next-unique-get-zone
Merge into: lp:~openstack-charmers-archive/charms/trusty/swift-proxy/next
Diff against target: 20 lines (+8/-2)
1 file modified
hooks/swift_utils.py (+8/-2)
To merge this branch: bzr merge lp:~raharper/charms/trusty/swift-proxy/next-unique-get-zone
Reviewer Review Type Date Requested Status
OpenStack Charmers Pending
Review via email: mp+227090@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Corey Bryant (corey.bryant) wrote :

Looks good to me.

Revision history for this message
Corey Bryant (corey.bryant) wrote :

Actually, one comment. It'd probably be useful to reference the bug in your commit. e.g. bzr commit --fixes lp:1342891 hooks/swift_utils.py

Revision history for this message
Ryan Harper (raharper) wrote :

I did that in my branch:

------------------------------------------------------------
revno: 54
fixes bug: https://launchpad.net/bugs/1342891
committer: Ryan Harper <email address hidden>
branch nick: next-fix-1342891
timestamp: Wed 2014-07-16 14:07:14 -0500
message:
  uniquify swift-storage device list for zone calculation.

This should show up after merging the branch with:

bzr log -n 0 | less

On Wed, Jul 16, 2014 at 2:30 PM, Corey Bryant <email address hidden>
wrote:

> Actually, one comment. It'd probably be useful to reference the bug in
> your commit. e.g. bzr commit --fixes lp:1342891 hooks/swift_utils.py
> --
>
> https://code.launchpad.net/~raharper/charms/trusty/swift-proxy/next-unique-get-zone/+merge/227090
> You are the owner of
> lp:~raharper/charms/trusty/swift-proxy/next-unique-get-zone.
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/swift_utils.py'
2--- hooks/swift_utils.py 2014-04-10 16:52:10 +0000
3+++ hooks/swift_utils.py 2014-07-16 19:11:22 +0000
4@@ -275,8 +275,14 @@
5 zones = [d['zone'] for d in ring_builder.devs]
6 if not zones:
7 return 1
8- if len(zones) < replicas:
9- return sorted(zones).pop() + 1
10+
11+ # zones is a per-device list, so we may have one
12+ # node with 3 devices in zone 1. For balancing
13+ # we need to track the unique zones being used
14+ # not necessarily the number of devices
15+ unique_zones = list(set(zones))
16+ if len(unique_zones) < replicas:
17+ return sorted(unique_zones).pop() + 1
18
19 zone_distrib = {}
20 for z in zones:

Subscribers

People subscribed via source and target branches