maasserver.models.staticipaddress.MultipleObjectsReturned: get() returned more than one StaticIPAddress -- it returned 2!

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

Bug Description

Hello,

I have a strange problem while commissioning a node. The MAAS server thinks 50-maas-01-commissioning has failed, while cloud-init on the node indicates it's finished without any issues. The script's exit status is 0 (zero).

Our MAAS version is "3.3.4-13189-g.f88272d1e".

In the regiond.log, I found the following log.

2023-10-24 06:54:22 metadataserver.api: [critical] nodexx.maas(xxxxxx): commissioning script '50-maas-01-commissioning' failed during post-processing.
        Traceback (most recent call last):
          File "/snap/maas/28521/lib/python3.10/site-packages/metadataserver/api.py", line 860, in signal
            target_status = process(node, request, status)
          File "/snap/maas/28521/lib/python3.10/site-packages/metadataserver/api.py", line 682, in _process_commissioning
            self._store_results(
          File "/snap/maas/28521/lib/python3.10/site-packages/metadataserver/api.py", line 565, in _store_results
            script_result.store_result(
          File "/snap/maas/28521/lib/python3.10/site-packages/metadataserver/models/scriptresult.py", line 372, in store_result
            signal_status = try_or_log_event(
        --- <exception caught here> ---
          File "/snap/maas/28521/lib/python3.10/site-packages/metadataserver/api.py", line 483, in try_or_log_event
            func(*args, **kwargs)
          File "/snap/maas/28521/lib/python3.10/site-packages/metadataserver/builtin_scripts/hooks.py", line 1123, in process_lxd_results
            _process_lxd_resources(node, data)
          File "/snap/maas/28521/lib/python3.10/site-packages/metadataserver/builtin_scripts/hooks.py", line 636, in _process_lxd_resources
            network_devices = update_node_network_information(node, data, numa_nodes)
          File "/snap/maas/28521/lib/python3.10/site-packages/metadataserver/builtin_scripts/hooks.py", line 234, in update_node_network_information
            update_node_interfaces(node, data)
          File "/snap/maas/28521/lib/python3.10/site-packages/provisioningserver/utils/twisted.py", line 203, in wrapper
            result = func(*args, **kwargs)
          File "/snap/maas/28521/lib/python3.10/site-packages/maasserver/utils/orm.py", line 755, in call_within_transaction
            return func_within_txn(*args, **kwargs)
          File "/usr/lib/python3.10/contextlib.py", line 79, in inner
            return func(*args, **kwds)
          File "/snap/maas/28521/lib/python3.10/site-packages/metadataserver/builtin_scripts/network.py", line 116, in update_node_interfaces
            interface = update_interface(
          File "/snap/maas/28521/lib/python3.10/site-packages/metadataserver/builtin_scripts/network.py", line 195, in update_interface
            return update_physical_interface(
          File "/snap/maas/28521/lib/python3.10/site-packages/metadataserver/builtin_scripts/network.py", line 290, in update_physical_interface
            update_physical_links(node, interface, links, new_vlan, update_fields)
          File "/snap/maas/28521/lib/python3.10/site-packages/metadataserver/builtin_scripts/network.py", line 301, in update_physical_links
            update_ip_addresses = update_links(node, interface, links)
          File "/snap/maas/28521/lib/python3.10/site-packages/metadataserver/builtin_scripts/network.py", line 730, in update_links
            ip_address, created = StaticIPAddress.objects.update_or_create(
          File "/snap/maas/28521/usr/lib/python3/dist-packages/django/db/models/manager.py", line 85, in manager_method
            return getattr(self.get_queryset(), name)(*args, **kwargs)
          File "/snap/maas/28521/usr/lib/python3/dist-packages/django/db/models/query.py", line 608, in update_or_create
            obj, created = self.select_for_update().get_or_create(defaults, **kwargs)
          File "/snap/maas/28521/usr/lib/python3/dist-packages/django/db/models/query.py", line 581, in get_or_create
            return self.get(**kwargs), False
          File "/snap/maas/28521/usr/lib/python3/dist-packages/django/db/models/query.py", line 439, in get
            raise self.model.MultipleObjectsReturned(
        maasserver.models.staticipaddress.MultipleObjectsReturned: get() returned more than one StaticIPAddress -- it returned 2!

Could you help us fix the problem?

Koji (kj-tanaka)
description: updated
Revision history for this message
Koji (kj-tanaka) wrote (last edit ):

Is there a default limit of the size in the output of django/db/models/query.py?

Our new machines have more devices than regular machines...

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.