soft power off not working

Bug #2058662 reported by Jacopo Rota
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Committed
High
Anton Troyanov
3.5
Fix Committed
High
Anton Troyanov
maas-ui
Fix Committed
High
Peter Makowski

Bug Description

In 3.5.0, if I click `Soft power off` in the UI it disconnects and no workflows are scheduled in temporal to actually shut down the server

Revision history for this message
Jacopo Rota (r00ta) wrote :
Changed in maas:
importance: Undecided → High
importance: High → Medium
importance: Medium → High
Revision history for this message
Jacopo Rota (r00ta) wrote :
Download full text (4.9 KiB)

from the regiond logs

tical]
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: Traceback (most recent call last):
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: File "/snap/maas/34304/usr/lib/python3/dist-packages/twisted/python/log.py", line 96, in callWithLogger
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: return callWithContext({"system": lp}, func, *args, **kw)
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: File "/snap/maas/34304/usr/lib/python3/dist-packages/twisted/python/log.py", line 80, in callWithContext
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: return context.call({ILogContext: newCtx}, func, *args, **kw)
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: File "/snap/maas/34304/usr/lib/python3/dist-packages/twisted/python/context.py", line 117, in callWithContext
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: return self.currentContext().callWithContext(ctx, func, *args, **kw)
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: File "/snap/maas/34304/usr/lib/python3/dist-packages/twisted/python/context.py", line 82, in callWithContext
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: return func(*args, **kw)
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: --- <exception caught here> ---
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: File "/snap/maas/34304/usr/lib/python3/dist-packages/twisted/internet/asyncioreactor.py", line 138, in _readOrWrite
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: why = method()
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: File "/snap/maas/34304/usr/lib/python3/dist-packages/twisted/internet/unix.py", line 193, in doRead
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: return self._dataReceived(data)
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: File "/snap/maas/34304/usr/lib/python3/dist-packages/twisted/internet/tcp.py", line 252, in _dataReceived
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: rval = self.protocol.dataReceived(data)
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: File "/snap/maas/34304/lib/python3.10/site-packages/maasserver/websockets/websockets.py", line 426, in dataReceived
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: self._parseFrames()
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: File "/snap/maas/34304/lib/python3.10/site-packages/maasserver/websockets/websockets.py", line 399, in _parseFrames
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: self._receiver.frameReceived(opcode, data, fin)
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: File "/snap/maas/34304/lib/python3.10/site-packages/maasserver/websockets/websockets.py", line 480, in frameReceived
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: self._wrappedProtocol.dataReceived(content)
mar 21 15:39:06 r00ta-ThinkPad-T420 maas-regiond[553101]: File "/sna...

Read more...

Changed in maas-ui:
status: New → Invalid
Revision history for this message
Peter Makowski (petermakowski) wrote :

This is most likely on the back-end side. Below you can see the websocket message we send for this action, which seems correct.

{
  "action": "off",
  "filter": {
    "id": [
      [id]
    ]
  },
  "extra": {
    "stop_mode": "soft"
  }
}

When attempting to soft power off, the websocket doesn't even respond with an error message, but drops the connection immediately.

no longer affects: maas-ui/3.5
Changed in maas:
milestone: 3.5.0 → 3.6.0
Changed in maas:
assignee: nobody → Eline Maaike De Weerd (emdw)
Revision history for this message
Jacopo Rota (r00ta) wrote :

After better looking into this I ended up that it should be a UI issue: the hard power off websocket action sends a payload

```
{
  "method": "machine.action",
  "type": 0,
  "params": {
    "action": "off",
    "extra": {},
    "system_id": "weswxk"
  },
  "request_id": 41
}
```

while the soft power off

```
{
  "method": "machine.soft_power_off",
  "type": 0,
  "params": {
    "action": "off",
    "extra": {
      "stop_mode": "soft"
    },
    "system_id": "weswxk"
  },
  "request_id": 45
}
```

the method should be `"method": "machine.action"` instead of `"method": "machine.soft_power_off"`

Changed in maas:
status: Triaged → Invalid
assignee: Eline Maaike De Weerd (emdw) → nobody
milestone: 3.6.0 → none
Changed in maas-ui:
status: Invalid → New
importance: Undecided → High
Changed in maas:
milestone: none → 3.6.0
Changed in maas-ui:
status: New → Triaged
Changed in maas-ui:
assignee: nobody → Peter Makowski (petermakowski)
Changed in maas-ui:
status: Triaged → In Progress
milestone: none → 3.5.0
Revision history for this message
Peter Makowski (petermakowski) wrote :
Changed in maas:
status: Invalid → Triaged
assignee: nobody → Anton Troyanov (troyanov)
Changed in maas-ui:
status: In Progress → Fix Committed
Changed in maas:
status: Triaged → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.