Support injecting mount-point meta info

Volumes need to know where they're going to be mounted. But really,
it's not the volume that needs to know that - it's the user associating
volumes and servers. Make it something that can be injected into server
metadata.
This commit is contained in:
Monty Taylor 2014-10-14 21:43:50 -07:00
parent 86f2c2b7a9
commit 313fb397d5
1 changed files with 7 additions and 1 deletions

View File

@ -74,7 +74,7 @@ def get_groups_from_server(cloud, server, server_vars):
return groups
def get_hostvars_from_server(cloud, server):
def get_hostvars_from_server(cloud, server, mounts=None):
server_vars = dict()
# Fist, add an IP address
if (cloud.private):
@ -105,6 +105,12 @@ def get_hostvars_from_server(cloud, server):
server_vars['volumes'] = [
obj_to_dict(f) for f in cloud.get_volumes(server)]
if mounts:
for mount in mounts:
for vol in server_vars['volumes']:
if vol['display_name'] == mount['display_name']:
if 'mount' in mount:
vol['mount'] = mount['mount']
az = server_vars.get('OS-EXT-AZ:availability_zone', None)
if az: