From c60a82dfaa552bfe7840e61521fdc4a8625b1882 Mon Sep 17 00:00:00 2001 From: BubaVV Date: Mon, 27 May 2019 14:51:42 +0300 Subject: [PATCH] Fixes creating nondefault type volumes from volume Horizon ignores volume type of source volume and tries to set default type to newly created volume. Proposed patch makes Horizon inherit volume type from the source Closes-bug: #1830759 Closes-bug: #1599225 Change-Id: Ice18259a59d1b7e347ffab89ca931985d49e6895 --- openstack_dashboard/dashboards/project/volumes/forms.py | 1 + openstack_dashboard/dashboards/project/volumes/tests.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/openstack_dashboard/dashboards/project/volumes/forms.py b/openstack_dashboard/dashboards/project/volumes/forms.py index 868719ff04..6692f6cebd 100644 --- a/openstack_dashboard/dashboards/project/volumes/forms.py +++ b/openstack_dashboard/dashboards/project/volumes/forms.py @@ -402,6 +402,7 @@ class CreateForm(forms.SelfHandlingForm): # Create from volume volume = self.get_volume(request, data["volume_source"]) volume_id = volume.id + volume_type = None if data['size'] < volume.size: error_message = (_('The volume size cannot be less than ' diff --git a/openstack_dashboard/dashboards/project/volumes/tests.py b/openstack_dashboard/dashboards/project/volumes/tests.py index 01e459074f..3c45a42afc 100644 --- a/openstack_dashboard/dashboards/project/volumes/tests.py +++ b/openstack_dashboard/dashboards/project/volumes/tests.py @@ -537,7 +537,7 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): filters={'visibility': 'shared', 'status': 'active'}) self.mock_volume_create.assert_called_once_with( test.IsHttpRequest(), formData['size'], formData['name'], - formData['description'], '', metadata={}, snapshot_id=None, + formData['description'], None, metadata={}, snapshot_id=None, group_id=None, image_id=None, availability_zone=None, source_volid=volume.id) self.mock_group_list.assert_called_once_with(test.IsHttpRequest())