Hide default_cgsnapshot_type from cinder group types

The generic group type named "default_cgsnapshot_type" is reserved
for the consistency group and we cannot use a generic group using
"default_cgsnapshot_type". "default_cgsnapshot_type" should not be
listed in "Group Type" selection in "Create Group" form.

In addition, "Group" and "Group Snapshot" panels make no sense
when there is no group type other than "default_cgsnapshot_type".
This commit adds a suggestion to hide "Group" and "Group Snapshot"
panels if there is no valid group type to the release notes.

Closes-Bug: #1785178
Change-Id: I2dce39bcbcf6bedc8dc0c94d11f3c0a85ea61490
This commit is contained in:
Akihiro Motoki 2018-08-08 21:06:39 +09:00
parent a4443f4be7
commit 4c9cf5f00e
2 changed files with 15 additions and 3 deletions

View File

@ -77,12 +77,19 @@ class AddGroupInfoAction(workflows.Action):
self.fields['availability_zone'].choices = \ self.fields['availability_zone'].choices = \
availability_zones(request) availability_zones(request)
try: try:
# Group type name 'default_cgsnapshot_type' is reserved for
# consistency group and it cannot be used for a group type.
# Let's exclude it.
group_types = [(t.id, t.name) for t group_types = [(t.id, t.name) for t
in api.cinder.group_type_list(request)] in api.cinder.group_type_list(request)
group_types.insert(0, ("", _("Select group type"))) if t.name != 'default_cgsnapshot_type']
self.fields['group_type'].choices = group_types
except Exception: except Exception:
exceptions.handle(request, _('Unable to retrieve group types.')) exceptions.handle(request, _('Unable to retrieve group types.'))
if group_types:
group_types.insert(0, ("", _("Select group type")))
else:
group_types.insert(0, ("", _("No valid group type")))
self.fields['group_type'].choices = group_types
class Meta(object): class Meta(object):
name = _("Group Information") name = _("Group Information")

View File

@ -5,3 +5,8 @@ features:
Cinder generic groups is now supported. Consistency groups views will be Cinder generic groups is now supported. Consistency groups views will be
disabled if the generic group support is available. User is able to disabled if the generic group support is available. User is able to
create generic groups and snapshots now. create generic groups and snapshots now.
Note that operators need to create at least one group type so that
users can use the generic group feature. Otherwise, it might be better
to disable the group and group snapshot panels by the horizon plugin
``enabled`` files.