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
=== modified file 'config.yaml'
--- config.yaml 2015-06-25 18:19:30 +0000
+++ config.yaml 2015-09-02 14:48:06 +0000
@@ -26,6 +26,13 @@
26 description: |26 description: |
27 The volume size in GB to request from the block-storage-broker.27 The volume size in GB to request from the block-storage-broker.
28 default: 528 default: 5
29 volume_label:
30 type: string
31 description: |
32 The volume label to use. If not specified, a label of "$(unit)
33 $(availability zone) volume" will be automatically requested from
34 block-storage-broker.
35 default: ""
29 device_timeout: 36 device_timeout:
30 type: int37 type: int
31 description: |38 description: |
3239
=== modified file 'hooks/storage-provider.d/block-storage-broker/block-storage-relation-changed'
--- hooks/storage-provider.d/block-storage-broker/block-storage-relation-changed 2015-06-25 18:19:30 +0000
+++ hooks/storage-provider.d/block-storage-broker/block-storage-relation-changed 2015-09-02 14:48:06 +0000
@@ -17,7 +17,9 @@
17relids = hookenv.relation_ids("data")17relids = hookenv.relation_ids("data")
18for relid in relids:18for relid in relids:
19 for unit in hookenv.related_units(relid):19 for unit in hookenv.related_units(relid):
20 label = "%s %s volume" % (unit, availability_zone)20 label = config_data.get("volume_label", None)
21 if not label:
22 label = "%s %s volume" % (unit, availability_zone)
21 if volume_map is not None:23 if volume_map is not None:
22 # Grab the volume_label for our instance if it exists so we can24 # Grab the volume_label for our instance if it exists so we can
23 # request that volume-id from the block-storage-broker25 # request that volume-id from the block-storage-broker

Subscribers

People subscribed via source and target branches

to all changes: