26 from openstack_dashboard import api |
26 from openstack_dashboard import api |
27 from openstack_dashboard.dashboards.admin.instances.forms import \ |
27 from openstack_dashboard.dashboards.admin.instances.forms import \ |
28 LiveMigrateForm |
28 LiveMigrateForm |
29 from openstack_dashboard.dashboards.admin.instances.tables import \ |
29 from openstack_dashboard.dashboards.admin.instances.tables import \ |
30 AdminInstancesTable, MigrateInstance |
30 AdminInstancesTable, MigrateInstance |
31 from openstack_dashboard.dashboards.project.access_and_security.tabs import \ |
|
32 AccessAndSecurityTabs, APIAccessTab, FloatingIPsTab, KeypairsTab |
|
33 from openstack_dashboard.dashboards.project.images.images.tables import \ |
31 from openstack_dashboard.dashboards.project.images.images.tables import \ |
34 ImagesTable, CreateVolumeFromImage |
32 ImagesTable, CreateVolumeFromImage |
35 from openstack_dashboard.dashboards.project.instances import tables \ |
33 from openstack_dashboard.dashboards.project.instances import tables \ |
36 as project_tables |
34 as project_tables |
37 from openstack_dashboard.dashboards.project.instances.tables import \ |
35 from openstack_dashboard.dashboards.project.instances.tables import \ |
38 InstancesTable, TogglePause, EditInstanceSecurityGroups |
36 InstancesTable, TogglePause |
39 from openstack_dashboard.dashboards.project.instances.workflows import \ |
37 from openstack_dashboard.dashboards.project.instances.workflows import \ |
40 create_instance, update_instance |
38 create_instance, update_instance |
41 |
|
42 |
|
43 # Remove Security Groups from the LaunchInstance workflow |
|
44 |
|
45 class SolarisSetAccessControlsAction(create_instance.SetAccessControlsAction): |
|
46 def __init__(self, request, *args, **kwargs): |
|
47 super(SolarisSetAccessControlsAction, self).__init__(request, |
|
48 *args, |
|
49 **kwargs) |
|
50 |
|
51 del self.fields['groups'] |
|
52 |
|
53 class Meta(object): |
|
54 name = _("Access & Security") |
|
55 help_text = _("Control access to your instance via key pairs, " |
|
56 "and other mechanisms.") |
|
57 |
|
58 def populate_groups_choices(self, request, context): |
|
59 return [] |
|
60 |
|
61 create_instance.SetAccessControls.action_class = SolarisSetAccessControlsAction |
|
62 |
39 |
63 |
40 |
64 # Bootargs feature: |
41 # Bootargs feature: |
65 # Add bootargs feature to 'SetAdvanced' workflow action. |
42 # Add bootargs feature to 'SetAdvanced' workflow action. |
66 # Part of Project/Compute/Instances/Launch Instance |
43 # Part of Project/Compute/Instances/Launch Instance |
166 action_class = UpdateInstanceBootargAction |
143 action_class = UpdateInstanceBootargAction |
167 depends_on = ("instance_id",) |
144 depends_on = ("instance_id",) |
168 contributes = ("bootargs", "bootargs_persist",) |
145 contributes = ("bootargs", "bootargs_persist",) |
169 |
146 |
170 |
147 |
171 # Remove 'UpdateInstanceSecurityGroups' from |
|
172 # Project/Compute/Instances/Actions/Edit Instance |
|
173 update_instance.UpdateInstance.default_steps = ( |
|
174 update_instance.UpdateInstanceInfo, |
|
175 ) |
|
176 |
|
177 # Bootargs feature: |
148 # Bootargs feature: |
178 # if locally configured to do so add UpdateInstanceBootarg |
149 # if locally configured to do so add UpdateInstanceBootarg |
179 # to Project/Compute/Instances/Actions/Edit Instance |
150 # to Project/Compute/Instances/Actions/Edit Instance |
180 if getattr(settings, 'SOLARIS_BOOTARGS', True): |
151 if getattr(settings, 'SOLARIS_BOOTARGS', True): |
181 update_instance.UpdateInstance.default_steps += ( |
152 update_instance.UpdateInstance.default_steps += ( |
182 UpdateInstanceBootarg, |
153 UpdateInstanceBootarg, |
183 ) |
154 ) |
184 |
155 |
185 # Remove 'SecurityGroupsTab' tab from Project/Compute/Access & Security |
|
186 AccessAndSecurityTabs.tabs = (KeypairsTab, FloatingIPsTab, APIAccessTab) |
|
187 |
|
188 # Remove 'TogglePause', 'MigrateInstance' actions from |
156 # Remove 'TogglePause', 'MigrateInstance' actions from |
189 # Admin/System/Instances/Actions |
157 # Admin/System/Instances/Actions |
190 temp = list(AdminInstancesTable._meta.row_actions) |
158 temp = list(AdminInstancesTable._meta.row_actions) |
191 temp.remove(MigrateInstance) |
159 temp.remove(MigrateInstance) |
192 temp.remove(TogglePause) |
160 temp.remove(TogglePause) |
193 AdminInstancesTable._meta.row_actions = tuple(temp) |
161 AdminInstancesTable._meta.row_actions = tuple(temp) |
194 |
162 |
195 # Remove 'EditInstanceSecurityGroups', 'TogglePause' actions from |
163 # Remove 'TogglePause' action from Project/Compute/Instances/Actions |
196 # Project/Compute/Instances/Actions |
|
197 temp = list(InstancesTable._meta.row_actions) |
164 temp = list(InstancesTable._meta.row_actions) |
198 temp.remove(EditInstanceSecurityGroups) |
|
199 temp.remove(TogglePause) |
165 temp.remove(TogglePause) |
200 InstancesTable._meta.row_actions = tuple(temp) |
166 InstancesTable._meta.row_actions = tuple(temp) |
201 |
167 |
202 # Set the available states for Create Snapshot to only be 'ACTIVE' |
168 # Set the available states for Create Snapshot to only be 'ACTIVE' |
203 project_tables.SNAPSHOT_READY_STATES = ('ACTIVE',) |
169 project_tables.SNAPSHOT_READY_STATES = ('ACTIVE',) |