Allow empty device name.

Nova supports an empty device name as of https://review.openstack.org/#/c/10908
so we don't need to force one on people (which causes breakages and
confusion).

Change-Id: I92078ec3b434777b8558ac89a22209aa54dee657
This commit is contained in:
Gabriel Hurley 2012-08-09 18:12:45 -07:00
parent dfdb8375de
commit 87ef0db150
2 changed files with 7 additions and 2 deletions

View File

@ -123,7 +123,7 @@ class AttachForm(forms.SelfHandlingForm):
instance = forms.ChoiceField(label=_("Attach to Instance"),
help_text=_("Select an instance to "
"attach to."))
device = forms.CharField(label=_("Device Name"), initial="/dev/vdc")
device = forms.CharField(label=_("Device Name"))
def __init__(self, *args, **kwargs):
super(AttachForm, self).__init__(*args, **kwargs)
@ -136,6 +136,8 @@ class AttachForm(forms.SelfHandlingForm):
True)
if not can_set_mount_point:
self.fields['device'].widget = forms.widgets.HiddenInput()
self.fields['device'].required = False
# populate volume_id
volume = kwargs.get('initial', {}).get("volume", None)
if volume:
@ -171,7 +173,7 @@ class AttachForm(forms.SelfHandlingForm):
api.volume_attach(request,
data['volume_id'],
data['instance'],
data['device'])
data.get('device', ''))
vol_name = api.volume_get(request, data['volume_id']).display_name
message = _('Attaching volume %(vol)s to instance '

View File

@ -150,4 +150,7 @@ horizon.addInitFunction(function () {
// Table search box.
$(".table_search input").example("Filter");
// Volume attachment form.
$("#attach_volume_form #id_device").example("/dev/vdc/");
});