From 4c9cf5f00e5b978e77678de6c4c257e733f4c46d Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Wed, 8 Aug 2018 21:06:39 +0900 Subject: [PATCH] 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 --- .../dashboards/project/volume_groups/workflows.py | 13 ++++++++++--- .../generic-volumes-support-407406de8233c912.yaml | 5 +++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/openstack_dashboard/dashboards/project/volume_groups/workflows.py b/openstack_dashboard/dashboards/project/volume_groups/workflows.py index 12a0aad19e..67a066cad9 100644 --- a/openstack_dashboard/dashboards/project/volume_groups/workflows.py +++ b/openstack_dashboard/dashboards/project/volume_groups/workflows.py @@ -77,12 +77,19 @@ class AddGroupInfoAction(workflows.Action): self.fields['availability_zone'].choices = \ availability_zones(request) 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 - in api.cinder.group_type_list(request)] - group_types.insert(0, ("", _("Select group type"))) - self.fields['group_type'].choices = group_types + in api.cinder.group_type_list(request) + if t.name != 'default_cgsnapshot_type'] except Exception: 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): name = _("Group Information") diff --git a/releasenotes/notes/generic-volumes-support-407406de8233c912.yaml b/releasenotes/notes/generic-volumes-support-407406de8233c912.yaml index bf284d538d..2a747d1b3b 100644 --- a/releasenotes/notes/generic-volumes-support-407406de8233c912.yaml +++ b/releasenotes/notes/generic-volumes-support-407406de8233c912.yaml @@ -5,3 +5,8 @@ features: Cinder generic groups is now supported. Consistency groups views will be disabled if the generic group support is available. User is able to 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.