55
55
"""Attach a nova device to the C{instance-id} requested by the relation
57
57
Optionally the relation can specify:
59
60
- C{size} to request a specific volume size
62
63
instance_id = hookenv.relation_get('instance-id')
64
66
hookenv.log("Waiting for relation to define instance-id", INFO)
66
68
volume_id = hookenv.relation_get('volume-id') # optional
67
69
size = hookenv.relation_get('size') # optional
68
70
device_path = nova_util.attach_nova_volume(
71
instance_id=instance_id, volume_id=volume_id, size=size,
71
74
# Volume is attached, send the path back to the remote storage unit
72
75
hookenv.relation_set(relation_settings={"block-device-path": device_path})