Browse Source

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
Akihiro Motoki 8 months ago
parent
commit
4c9cf5f00e

+ 10
- 3
openstack_dashboard/dashboards/project/volume_groups/workflows.py View File

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

+ 5
- 0
releasenotes/notes/generic-volumes-support-407406de8233c912.yaml View File

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

Loading…
Cancel
Save