Merge "Unable to attach volume to instance"

This commit is contained in:
Jenkins 2015-09-23 21:41:04 +00:00 committed by Gerrit Code Review
commit f22095ad3a
1 changed files with 5 additions and 1 deletions

View File

@ -469,11 +469,15 @@ class AttachForm(forms.SelfHandlingForm):
# The name of the instance in the choices list has the ID appended to
# it, so let's slice that off...
instance_name = instance_name.rsplit(" (")[0]
# api requires non-empty device name or None
device = data.get('device') or None
try:
attach = api.nova.instance_volume_attach(request,
data['volume_id'],
data['instance'],
data.get('device', ''))
device)
volume = cinder.volume_get(request, data['volume_id'])
message = _('Attaching volume %(vol)s to instance '
'%(inst)s on %(dev)s.') % {"vol": volume.name,