diff --git a/openstack_dashboard/dashboards/project/volumes/forms.py b/openstack_dashboard/dashboards/project/volumes/forms.py index eb813cc64f8..519a0969505 100644 --- a/openstack_dashboard/dashboards/project/volumes/forms.py +++ b/openstack_dashboard/dashboards/project/volumes/forms.py @@ -291,7 +291,7 @@ def __init__(self, *args, **kwargs): "OPENSTACK_HYPERVISOR_FEATURES", {}) can_set_mount_point = hypervisor_features.get("can_set_mount_point", - True) + False) if not can_set_mount_point: self.fields['device'].widget = forms.widgets.HiddenInput() self.fields['device'].required = False diff --git a/openstack_dashboard/dashboards/project/volumes/tests.py b/openstack_dashboard/dashboards/project/volumes/tests.py index 29bf2fef040..de0e40bff67 100644 --- a/openstack_dashboard/dashboards/project/volumes/tests.py +++ b/openstack_dashboard/dashboards/project/volumes/tests.py @@ -679,6 +679,9 @@ def test_delete_volume_error_existing_snapshot(self): @test.create_stubs({cinder: ('volume_get',), api.nova: ('server_list',)}) def test_edit_attachments(self): + PREV = settings.OPENSTACK_HYPERVISOR_FEATURES['can_set_mount_point'] + settings.OPENSTACK_HYPERVISOR_FEATURES['can_set_mount_point'] = True + volume = self.volumes.first() servers = [s for s in self.servers.list() if s.tenant_id == self.request.user.tenant_id] @@ -697,11 +700,10 @@ def test_edit_attachments(self): self.assertEqual(res.status_code, 200) self.assertTrue(isinstance(form.fields['device'].widget, widgets.TextInput)) + settings.OPENSTACK_HYPERVISOR_FEATURES['can_set_mount_point'] = PREV @test.create_stubs({cinder: ('volume_get',), api.nova: ('server_list',)}) def test_edit_attachments_cannot_set_mount_point(self): - PREV = settings.OPENSTACK_HYPERVISOR_FEATURES['can_set_mount_point'] - settings.OPENSTACK_HYPERVISOR_FEATURES['can_set_mount_point'] = False volume = self.volumes.first() servers = [s for s in self.servers.list() @@ -717,7 +719,6 @@ def test_edit_attachments_cannot_set_mount_point(self): form = res.context['form'] self.assertTrue(isinstance(form.fields['device'].widget, widgets.HiddenInput)) - settings.OPENSTACK_HYPERVISOR_FEATURES['can_set_mount_point'] = PREV @test.create_stubs({cinder: ('volume_get',), api.nova: ('server_get', 'server_list',), diff --git a/openstack_dashboard/test/settings.py b/openstack_dashboard/test/settings.py index 5b22bcc70bc..fbe4c64ac45 100644 --- a/openstack_dashboard/test/settings.py +++ b/openstack_dashboard/test/settings.py @@ -115,7 +115,7 @@ } OPENSTACK_HYPERVISOR_FEATURES = { - 'can_set_mount_point': True, + 'can_set_mount_point': False, 'can_set_password': True, }