diff --git a/horizon/dashboards/nova/volumes/forms.py b/horizon/dashboards/nova/volumes/forms.py index 650050968a..f5d6678e17 100644 --- a/horizon/dashboards/nova/volumes/forms.py +++ b/horizon/dashboards/nova/volumes/forms.py @@ -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 ' diff --git a/horizon/static/horizon/js/horizon.forms.js b/horizon/static/horizon/js/horizon.forms.js index 8ee609e203..d441ad7a49 100644 --- a/horizon/static/horizon/js/horizon.forms.js +++ b/horizon/static/horizon/js/horizon.forms.js @@ -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/"); });