Merge "Do not check name duplication when creating a volume group"
This commit is contained in:
commit
77be569561
|
@ -28,7 +28,6 @@ class VolumeGroupTests(test.TestCase):
|
|||
'extension_supported',
|
||||
'availability_zone_list',
|
||||
'volume_type_list',
|
||||
'group_list',
|
||||
'group_type_list',
|
||||
'group_create',
|
||||
]})
|
||||
|
@ -52,7 +51,6 @@ class VolumeGroupTests(test.TestCase):
|
|||
self.mock_availability_zone_list.return_value = \
|
||||
self.cinder_availability_zones.list()
|
||||
self.mock_volume_type_list.return_value = volume_types
|
||||
self.mock_group_list.return_value = self.cinder_groups.list()
|
||||
self.mock_group_type_list.return_value = self.cinder_group_types.list()
|
||||
self.mock_group_create.return_value = group
|
||||
|
||||
|
@ -67,7 +65,6 @@ class VolumeGroupTests(test.TestCase):
|
|||
test.IsHttpRequest())
|
||||
self.mock_volume_type_list.assert_called_once_with(
|
||||
test.IsHttpRequest())
|
||||
self.mock_group_list.assert_called_once_with(test.IsHttpRequest())
|
||||
self.mock_group_type_list.assert_called_once_with(test.IsHttpRequest())
|
||||
self.mock_group_create.assert_called_once_with(
|
||||
test.IsHttpRequest(),
|
||||
|
@ -81,7 +78,6 @@ class VolumeGroupTests(test.TestCase):
|
|||
'extension_supported',
|
||||
'availability_zone_list',
|
||||
'volume_type_list',
|
||||
'group_list',
|
||||
'group_type_list',
|
||||
'group_create',
|
||||
]})
|
||||
|
@ -104,7 +100,6 @@ class VolumeGroupTests(test.TestCase):
|
|||
self.mock_availability_zone_list.return_value = \
|
||||
self.cinder_availability_zones.list()
|
||||
self.mock_volume_type_list.return_value = volume_types
|
||||
self.mock_group_list.return_value = self.cinder_groups.list()
|
||||
self.mock_group_type_list.return_value = self.cinder_group_types.list()
|
||||
self.mock_group_create.side_effect = self.exceptions.cinder
|
||||
|
||||
|
@ -121,7 +116,6 @@ class VolumeGroupTests(test.TestCase):
|
|||
test.IsHttpRequest())
|
||||
self.mock_volume_type_list.assert_called_once_with(
|
||||
test.IsHttpRequest())
|
||||
self.mock_group_list.assert_called_once_with(test.IsHttpRequest())
|
||||
self.mock_group_type_list.assert_called_once_with(test.IsHttpRequest())
|
||||
self.mock_group_create.assert_called_once_with(
|
||||
test.IsHttpRequest(),
|
||||
|
|
|
@ -100,32 +100,6 @@ class AddGroupInfoAction(workflows.Action):
|
|||
"same back end.")
|
||||
slug = "set_group_info"
|
||||
|
||||
def clean(self):
|
||||
cleaned_data = super(AddGroupInfoAction, self).clean()
|
||||
name = cleaned_data.get('name')
|
||||
|
||||
try:
|
||||
groups = cinder.group_list(self.request)
|
||||
except Exception:
|
||||
msg = _('Unable to get group list')
|
||||
exceptions.check_message(["Connection", "refused"], msg)
|
||||
raise
|
||||
|
||||
if groups is not None and name is not None:
|
||||
for group in groups:
|
||||
if group.name.lower() == name.lower():
|
||||
# ensure new name has reasonable length
|
||||
formatted_name = name
|
||||
if len(name) > 20:
|
||||
formatted_name = name[:14] + "..." + name[-3:]
|
||||
raise forms.ValidationError(
|
||||
_('The name "%s" is already used by '
|
||||
'another group.')
|
||||
% formatted_name
|
||||
)
|
||||
|
||||
return cleaned_data
|
||||
|
||||
|
||||
class AddGroupInfoStep(workflows.Step):
|
||||
action_class = AddGroupInfoAction
|
||||
|
|
Loading…
Reference in New Issue