Comment 5 for bug 1958451

Revision history for this message
Alexsander de Souza (alexsander-souza) wrote :

we found two issues while debugging this:

1) the user forces an IPMI version

maas root machines create hostname=test-13 \
    zone=zone1 architecture=arm64/generic \
    mac_addresses=XX:XX:XX:XX:XX:XX \
    power_type=ipmi \
    power_parameters_power_address=XXX.XXX.XXX.XXX \
    power_parameters_power_user=admin \
    power_parameters_power_pass=admin \
    power_parameters_power_driver=LAN \
    power_parameters_power_boot_type=efi

The observed behaviour is the machine powers up, commissioning is successful and then MAAS fails to power it off. What actually happens is that MAAS powers up the machine with the used-supplied power-parameters, runs 30-bmc-config with the default parameter values (maas_auto_ipmi_user and maas_auto_ipmi_user_password) and overwrites the user values with the detected ones (changing the power driver to LAN_2), and then it fails to power it off because the new values are invalid.

The fix is to change the script to use existing power parameters if present.

2) the user skips BMC configuration adding skip_bmc_config=1 to the command line

MAAS is running the script even when unsolicited in some scenarios. I'm still looking for what triggers this bug. The observed behaviour is that MAAS crashes when the script reports back its results, which is unexpected because the script status is skipped:

2022-02-04 16:13:35 maasserver: [error] ################################ Exception: ################################
2022-02-04 16:13:35 maasserver: [error] Traceback (most recent call last):
  File "/snap/maas/18203/usr/lib/python3/dist-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/snap/maas/18203/lib/python3.8/site-packages/maasserver/utils/views.py", line 284, in view_atomic_with_post_commit_savepoint
    return view_atomic(*args, **kwargs)
  File "/usr/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/snap/maas/18203/lib/python3.8/site-packages/maasserver/api/support.py", line 56, in __call__
    response = super().__call__(request, *args, **kwargs)
  File "/snap/maas/18203/usr/lib/python3/dist-packages/django/views/decorators/vary.py", line 20, in inner_func
    response = func(*args, **kwargs)
  File "/snap/maas/18203/usr/lib/python3.8/dist-packages/piston3/resource.py", line 197, in __call__
    result = self.error_handler(e, request, meth, em_format)
  File "/snap/maas/18203/usr/lib/python3.8/dist-packages/piston3/resource.py", line 195, in __call__
    result = meth(request, *args, **kwargs)
  File "/snap/maas/18203/lib/python3.8/site-packages/maasserver/api/support.py", line 308, in dispatch
    return function(self, request, *args, **kwargs)
  File "/snap/maas/18203/lib/python3.8/site-packages/metadataserver/api.py", line 817, in signal
    target_status = process(node, request, status)
  File "/snap/maas/18203/lib/python3.8/site-packages/metadataserver/api.py", line 641, in _process_commissioning
    self._store_results(
  File "/snap/maas/18203/lib/python3.8/site-packages/metadataserver/api.py", line 529, in _store_results
    script_result.store_result(
  File "/snap/maas/18203/lib/python3.8/site-packages/metadataserver/models/scriptresult.py", line 274, in store_result
    assert self.status in SCRIPT_STATUS_RUNNING_OR_PENDING
AssertionError