MaaS 3.1 beta 3 feature "enlist deployed machines" feature fails on 64-bit MAC addresses

Bug #1947892 reported by Ben Huntley
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
New
Undecided
Unassigned

Bug Description

Following instructions from section "How to update hardware information for a deployed machine" in the MaaS 3.1 beta 3 documentation (https://maas.io/docs/snap/3.1/ui/whats-new-in-maas) fails during `./maas-run-scripts report-results` when deployed enlisted machine has a network device with a 64-bit MAC address.

MaaS region server is running MAAS 3.1.0~beta3 on Ubuntu 20.04, installed from Deb. Rack controller is also running MAAS 3.1.0~beta3 on Ubuntu 20.04. Host being enlisted/comissioned is running Ubuntu 18.04.6.

Error is reproduced by running the following on a system with a 64-bit MAC address network device:
```
wget http://$MAAS_IP:5240/MAAS/maas-run-scripts
chmod 755 maas-run-scripts
./maas-run-scripts report-results --config $(hostname)-creds.yaml
```

Stack trace from error shown below, pulled from MaaS region server log /var/log/maas/regiond.log:
```
2021-10-20 09:56:20 metadataserver.api: [critical] myhost.domain.com(pqkbyr): commissioning script '50-maas-01-commissioning' failed during post-processing.
        Traceback (most recent call last):
          File "/usr/lib/python3/dist-packages/metadataserver/api.py", line 817, in signal
            target_status = process(node, request, status)
          File "/usr/lib/python3/dist-packages/metadataserver/api.py", line 641, in _process_commissioning
            self._store_results(
          File "/usr/lib/python3/dist-packages/metadataserver/api.py", line 529, in _store_results
            script_result.store_result(
          File "/usr/lib/python3/dist-packages/metadataserver/models/scriptresult.py", line 376, in store_result
            signal_status = try_or_log_event(
        --- <exception caught here> ---
          File "/usr/lib/python3/dist-packages/metadataserver/api.py", line 447, in try_or_log_event
            func(*args, **kwargs)
          File "/usr/lib/python3/dist-packages/metadataserver/builtin_scripts/hooks.py", line 954, in process_lxd_results
            _process_lxd_resources(node, data)
          File "/usr/lib/python3/dist-packages/metadataserver/builtin_scripts/hooks.py", line 587, in _process_lxd_resources
            network_devices = update_node_network_information(node, data, numa_nodes)
          File "/usr/lib/python3/dist-packages/metadataserver/builtin_scripts/hooks.py", line 221, in update_node_network_information
            update_node_interfaces(node, data)
          File "/usr/lib/python3/dist-packages/provisioningserver/utils/twisted.py", line 202, in wrapper
            result = func(*args, **kwargs)
          File "/usr/lib/python3/dist-packages/maasserver/utils/orm.py", line 740, in call_within_transaction return func_within_txn(*args, **kwargs)
          File "/usr/lib/python3.8/contextlib.py", line 75, in inner
            return func(*args, **kwds)
          File "/usr/lib/python3/dist-packages/metadataserver/builtin_scripts/network.py", line 101, in update_node_interfaces
            interface = update_interface(
          File "/usr/lib/python3/dist-packages/metadataserver/builtin_scripts/network.py", line 171, in update_interface
            return update_physical_interface(
          File "/usr/lib/python3/dist-packages/metadataserver/builtin_scripts/network.py", line 207, in update_physical_interface
            PhysicalInterface.objects.filter(node=node, name=name).exclude(
          File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 710, in delete
            collector.collect(del_query)
          File "/usr/lib/python3/dist-packages/django/db/models/deletion.py", line 191, in collect
            new_objs = self.add(objs, source, nullable,
          File "/usr/lib/python3/dist-packages/django/db/models/deletion.py", line 88, in add
            if not objs:
          File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 278, in __bool__
            self._fetch_all()
          File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 1242, in _fetch_all
            self._result_cache = list(self._iterable_class(self))
          File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 55, in __iter__
            results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
          File "/usr/lib/python3/dist-packages/django/db/models/sql/compiler.py", line 1140, in execute_sql
            cursor.execute(sql, params)
          File "/usr/lib/python3/dist-packages/maasserver/prometheus/middleware.py", line 22, in execute
            return super().execute(sql, params=params)
          File "/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 67, in execute
            return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
          File "/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
            return executor(sql, params, many, context)
          File "/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 84, in _execute
            return self.cursor.execute(sql, params)
          File "/usr/lib/python3/dist-packages/django/db/utils.py", line 89, in __exit__
            raise dj_exc_value.with_traceback(traceback) from exc_value
          File "/usr/lib/python3/dist-packages/django/db/backends/utils.py", line 84, in _execute
            return self.cursor.execute(sql, params)
        django.db.utils.DataError: invalid input syntax for type macaddr: "00:00:xx:xx:xx:xx:00:00:00:00:00:00:xx:xx:xx:xx:xx:xx:xx:xx"
        LINE 1: ...0 AND NOT ("maasserver_interface"."mac_address" = '00:00:xx:...
                                                                     ^
```

In our environment, these devices are typically Infiniband devices which MaaS does not necessarily need to be aware of. It would be a fine fix for our use-case if this exception were caught, a warning was left in the Commissioning log, and MaaS continued with commission skipping this network device.

Revision history for this message
Alberto Donato (ack) wrote :

This is similar to LP:1939456. MAAS doesn't currently support infiniband devices and fails if the MAC is not 48 bits.

We should at least skip those MACs so that the commissioning process doesn't fail

Revision history for this message
Ben Huntley (benhunt) wrote :

Any word if this can be considered for MaaS 3.2? It seems like it would be easy to implement to skip MAC addresses if not 48 bits, and it's a complete blocker for our adoption of the Commission Deployed Machines feature, which we would love to use.

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.