From 87ef0db150d241ea98d3b582c55139a253bb6152 Mon Sep 17 00:00:00 2001 From: Gabriel Hurley Date: Thu, 9 Aug 2012 18:12:45 -0700 Subject: [PATCH] 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 --- horizon/dashboards/nova/volumes/forms.py | 6 ++++-- horizon/static/horizon/js/horizon.forms.js | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) 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/"); });