canonical / maas-ui

The UI for MAAS (metal-as-a-service)
https://maas.io
Other
49 stars 48 forks source link

MAAS Web UI doesn't allow specifying soft stop_mode #2675

Closed webteam-app closed 1 year ago

webteam-app commented 3 years ago

Bug originally filed by afreiberger at https://bugs.launchpad.net/bugs/1928873

In the MAAS API and CLI, we can specify stop_mode=soft when performing a power-off, however, the Web UI automatically performs a hard power off when selecting Action -> Power Off.

It would be helpful for performing shutdown of a large number of nodes via the Web UI to be able to specify a software power-down rather than force power-off.

ltrager commented 3 years ago

One thing to keep in mind is that soft power off is currently only supported for IPMI power types. All other power types will do a hard power off even if soft is specified.

Caleb-Ellis commented 2 years ago

Will need to update the Power off form and UX consideration for:

amylily1011 commented 2 years ago

According to

maas  $profile machine power off
:param stop_mode: Optional.  Power-off mode. If 'soft',
perform a soft power down if the node's power type supports it,
otherwise perform a hard power off. For all values other than 'soft',
and by default, perform a hard power off. A soft power off generally
asks the OS to shutdown the system gracefully before powering off,
while a hard power off occurs immediately without any warning to the
OS.
:type stop_mode: String

You can shut down gracefully, or do a soft stop to machines. Since this is already available in the API, we will treat this as a feature parity.

  1. The Shut down button will only show up if one of the IPMI machine type is on and selected. Otherwise this action is disabled.

  2. The warning is not necessary in this case because Shut down... will only be available for selected machines that has the IPMI power type and it's on. Screen Shot 2022-07-06 at 5.12.05 PM.png

For inline actions, when an IPMI machine type is on, they can also execute this action individually on a single machine. Screen Shot 2022-07-06 at 5.30.34 PM.png

amylily1011 commented 2 years ago

Hi @huwshimi, I put together a very simple design for this bug. Can you review this and assign it to anyone available. :)

huwshimi commented 2 years ago

@amylily1011 I've put it into next iteration for someone to pick up.

One thing that will affect this is that once the new machine list has been implemented then both the power off and shut down options would be enabled in the take action menu for all selected machines (we won't know the power type and whether they are on) and if you click one of those we'd then show a count of how many of the selected machines can perform the power off/shut down. See: https://github.com/canonical-web-and-design/app-tribe/issues/1103.

amylily1011 commented 2 years ago

So if I understand correctly the flow looks like:

//Machine list page [I want to shut down X machines]

Select X machines --> take actions (not counts shown) ---> click: shut down (no counts shown) --> [got the count back from the API] --> confirmation form:" 3 out of x machines can not be shut down. Update selection" --> update selection ---> Confirm

For power off, it's the same flow but it will be a hard power off, regardless of machine types.

Is this the correct flow? (If so, I'll update the design 😄 ) @huwshimi

huwshimi commented 2 years ago

Select X machines --> take actions (not counts shown) ---> click: shut down (no counts shown) --> [got the count back from the API] --> confirmation form:" 3 out of x machines can not be shut down. Update selection" --> update selection ---> Confirm

There won't be an "update selection" step, it will just inform the user how many machines the action will be performed on.

Select X machines --> take actions (not counts shown) ---> click: shut down (no counts shown) --> [got the count back from the API] --> confirmation form:"3 out of x machines will be shut down." --> Confirm

I winder if we might also want to have some help text in the UI explaining the difference or even have a different label (maybe something like "soft power down" - we might need to ask someone what terminology would make sense to people).

amylily1011 commented 2 years ago

I've looked at the vocabularies used in the API and it seems to highlight the word soft. So for consistency with the language, here are the new screens. maas $profile machine power-off stop_mode=soft

A user can select between soft power off and power off. Screen Shot 2022-07-08 at 4 19 59 PM

When they select Soft power off they will be routed to this confirmation screen. Screen Shot 2022-07-08 at 4 20 08 PM

When they select Power off they will see this confirmation screen. Screen Shot 2022-07-08 at 4 32 28 PM

Here is the inline action: Screen Shot 2022-07-08 at 4 21 04 PM

Ready for second review @huwshimi .

huwshimi commented 2 years ago

@amylily1011 looks great!

anthonydillon commented 2 years ago

This issue is missing an estimate

petermakowski commented 1 year ago

@amylily1011 It won't be possible to display the "Soft power off X out of Y machines" in many cases for the bulk action (e.g. when selecting collapsed groups of machines or machines out of bound of the currently visible page). This is due to server-side filtering changes and the fact that the power_type filter is not supported by the machine.count websocket API.

How about we display a message that soft power off will be attempted if supported instead (rephrasing the original description from the API "perform a soft power down if the node's power type supports it, otherwise perform a hard power off"?

Might be also worth considering using a checkbox within the regular Power off action this instead of a separate "Soft power off" action item.

Inline action can be implemented as designed without issues.

amylily1011 commented 1 year ago

Since this is only subjected to IPMI power types, let's cut the scope to only show in the in-line action for now. Once the API supports this, we will have a reference for the bulk actions.

petermakowski commented 1 year ago

Since this is only subjected to IPMI power types, let's cut the scope to only show in the in-line action for now. Once the API supports this, we will have a reference for the bulk actions.

Unfortunately, it seems that the WebSocket API does not support the same parameters that the REST API does. This means that even the inline action won't work until resolved by the core team: https://bugs.launchpad.net/maas/+bug/1999152