Comment 0 for bug 1570995

Revision history for this message
Andres Rodriguez (andreserl) wrote :

I had a machine in MAAS which I deployed. After deployment, I manually installed maas-rack-controller and pointed it to the Region Controller, so a new rack appeared.

I tried to delete this new rack controller and came across this error in the UI:

The delete action for 1 controller failed with error: ("Cannot delete some instances of model 'VLAN' because they are referenced through a protected foreign key: 'PhysicalInterface.vlan'", [<PhysicalInterface: name=usb0, type=physical, mac=00:0e:c6:88:b7:9f>, <PhysicalInterface: name=enp0s25, type=physical, mac=b8:ae:ed:7d:17:d2>, <PhysicalInterface: name=enp0s25, type=physical, mac=b8:ae:ed:7d:16:d0>, <PhysicalInterface: name=enp0s25, type=physical, mac=b8:ae:ed:7c:4d:75>, <PhysicalInterface: name=enp0s25, type=physical, mac=b8:ae:ed:7e:b4:99>])

logs:

==> /var/log/maas/regiond.log <==
2016-04-15 13:45:19 [-] Error on request (118) controller.action: ("Cannot delete some instances of model 'VLAN' because they are referenced through a protected foreign key: 'PhysicalInterface.vlan'", [<PhysicalInterface: name=usb0, type=physical, mac=00:0e:c6:88:b7:9f>, <PhysicalInterface: name=enp0s25, type=physical, mac=b8:ae:ed:7d:17:d2>, <PhysicalInterface: name=enp0s25, type=physical, mac=b8:ae:ed:7d:16:d0>, <PhysicalInterface: name=enp0s25, type=physical, mac=b8:ae:ed:7c:4d:75>, <PhysicalInterface: name=enp0s25, type=physical, mac=b8:ae:ed:7e:b4:99>])
        Traceback (most recent call last):
          File "/usr/lib/python3.5/threading.py", line 862, in run
            self._target(*self._args, **self._kwargs)
          File "/usr/lib/python3/dist-packages/provisioningserver/utils/twisted.py", line 841, in worker
            return target()
          File "/usr/lib/python3/dist-packages/twisted/_threads/_threadworker.py", line 46, in work
            task()
          File "/usr/lib/python3/dist-packages/twisted/_threads/_team.py", line 190, in doWork
            task()
        --- <exception caught here> ---
          File "/usr/lib/python3/dist-packages/twisted/python/threadpool.py", line 246, in inContext
            result = inContext.theWork()
          File "/usr/lib/python3/dist-packages/twisted/python/threadpool.py", line 262, in <lambda>
            inContext.theWork = lambda: context.call(ctx, func, *args, **kw)
          File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 118, in callWithContext
            return self.currentContext().callWithContext(ctx, func, *args, **kw)
          File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 81, in callWithContext
            return func(*args,**kw)
          File "/usr/lib/python3/dist-packages/provisioningserver/utils/twisted.py", line 874, in callInContext
            return func(*args, **kwargs)
          File "/usr/lib/python3/dist-packages/maasserver/utils/orm.py", line 516, in call_within_transaction
            return func_outside_txn(*args, **kwargs)
          File "/usr/lib/python3/dist-packages/maasserver/utils/orm.py", line 343, in retrier
            return func(*args, **kwargs)
          File "/usr/lib/python3.5/contextlib.py", line 30, in inner
            return func(*args, **kwds)
          File "/usr/lib/python3/dist-packages/maasserver/websockets/handlers/machine.py", line 676, in action
            return action.execute(**extra_params)
          File "/usr/lib/python3/dist-packages/maasserver/node_action.py", line 193, in execute
            self.node.delete()
          File "/usr/lib/python3/dist-packages/maasserver/models/node.py", line 1692, in delete
            super(Node, self).delete()
          File "/usr/lib/python3/dist-packages/django/db/models/base.py", line 895, in delete
            collector.collect([self])
          File "/usr/lib/python3/dist-packages/django/db/models/deletion.py", line 229, in collect
            field.rel.on_delete(self, field, sub_objs, self.using)
          File "/usr/lib/python3/dist-packages/django/db/models/deletion.py", line 18, in CASCADE
            source_attr=field.name, nullable=field.null)
          File "/usr/lib/python3/dist-packages/django/db/models/deletion.py", line 229, in collect
            field.rel.on_delete(self, field, sub_objs, self.using)
          File "/usr/lib/python3/dist-packages/django/db/models/deletion.py", line 28, in PROTECT
            sub_objs
        django.db.models.deletion.ProtectedError: ("Cannot delete some instances of model 'VLAN' because they are referenced through a protected foreign key: 'PhysicalInterface.vlan'", [<PhysicalInterface: name=usb0, type=physical, mac=00:0e:c6:88:b7:9f>, <PhysicalInterface: name=enp0s25, type=physical, mac=b8:ae:ed:7d:17:d2>, <PhysicalInterface: name=enp0s25, type=physical, mac=b8:ae:ed:7d:16:d0>, <PhysicalInterface: name=enp0s25, type=physical, mac=b8:ae:ed:7c:4d:75>, <PhysicalInterface: name=enp0s25, type=physical, mac=b8:ae:ed:7e:b4:99>])