Properly handle volumes in launch node

We can only get the volume attach device if we are attaching a volume.
Check if the volume is being attached and only determine the attachment
location in that case to avoid errors.

Story: 2000569
Change-Id: I4adc5e23abdfc0627a0850f845e2333d3bd25e63
This commit is contained in:
Clark Boylan 2016-05-02 14:57:43 -07:00
parent 03a687ee2d
commit ba4429022b

View File

@ -172,7 +172,12 @@ def build_server(cloud, name, image, flavor,
cloud.delete_keypair(key_name)
server = cloud.get_openstack_vars(server)
volume_device = cloud.get_volume_attach_device(volume, server['id'])
if volume:
volume = cloud.get_volume(volume)
volume_device = cloud.get_volume_attach_device(volume,
server['id'])
else:
volume_device = None
bootstrap_server(server, key, name, volume_device, keep,
mount_path, fs_label)
print('UUID=%s\nIPV4=%s\nIPV6=%s\n' % (