Merge lp:~roadmr/charms/precise/storage/volume-label-option into lp:charms/storage

Proposed by Daniel Manrique
Status: Merged
Merged at revision: 42
Proposed branch: lp:~roadmr/charms/precise/storage/volume-label-option
Merge into: lp:charms/storage
Diff against target: 32 lines (+10/-1)
2 files modified
config.yaml (+7/-0)
hooks/storage-provider.d/block-storage-broker/block-storage-relation-changed (+3/-1)
To merge this branch: bzr merge lp:~roadmr/charms/precise/storage/volume-label-option
Reviewer Review Type Date Requested Status
Charles Butler (community) Approve
Review via email: mp+269931@code.launchpad.net

Commit message

Add volume_label option.

If given, this is the name of the volume that will be requested from block_storage_broker.
Otherwise, a default name will be chosen by the storage charm and requested from block_storage_broker.

Description of the change

Add volume_label option.

If given, this is the name of the volume that will be requested from block_storage_broker. Otherwise, a default name will be chosen by the storage charm and requested from block_storage_broker.

This is necessary in environments where two services may request conflicting volume names, and so is a workaround/indirect solution for https://bugs.launchpad.net/charms/+source/block-storage-broker/+bug/1487636.

I didn't add any unit tests since I couldn't figure out how, but I'd be happy to add them if someone can help me with ideas on how to test this (I did test it manually on a live environment, of course).

To post a comment you must log in.
Revision history for this message
Charles Butler (lazypower) wrote :

+1 LGTM

Thanks for the contribution Daniel

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2015-06-25 18:19:30 +0000
3+++ config.yaml 2015-09-02 14:48:06 +0000
4@@ -26,6 +26,13 @@
5 description: |
6 The volume size in GB to request from the block-storage-broker.
7 default: 5
8+ volume_label:
9+ type: string
10+ description: |
11+ The volume label to use. If not specified, a label of "$(unit)
12+ $(availability zone) volume" will be automatically requested from
13+ block-storage-broker.
14+ default: ""
15 device_timeout:
16 type: int
17 description: |
18
19=== modified file 'hooks/storage-provider.d/block-storage-broker/block-storage-relation-changed'
20--- hooks/storage-provider.d/block-storage-broker/block-storage-relation-changed 2015-06-25 18:19:30 +0000
21+++ hooks/storage-provider.d/block-storage-broker/block-storage-relation-changed 2015-09-02 14:48:06 +0000
22@@ -17,7 +17,9 @@
23 relids = hookenv.relation_ids("data")
24 for relid in relids:
25 for unit in hookenv.related_units(relid):
26- label = "%s %s volume" % (unit, availability_zone)
27+ label = config_data.get("volume_label", None)
28+ if not label:
29+ label = "%s %s volume" % (unit, availability_zone)
30 if volume_map is not None:
31 # Grab the volume_label for our instance if it exists so we can
32 # request that volume-id from the block-storage-broker

Subscribers

People subscribed via source and target branches

to all changes: