After creating a Virsh Pod in MAAS, I cannot delete the pod and get the follow stacktrace showing in the UI:
<ProtectedError instance at 0x7f66abefbdc8 with str error: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/django/db/models/fields/related.py", line 600, in __get__ rel_obj = getattr(instance, self.cache_name) AttributeError: 'Subnet' object has no attribute '_vlan_cache' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/twisted/python/reflect.py", line 443, in safe_str return str(o) File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 141, in __repr__ return repr(data) File "/usr/lib/python3/dist-packages/django/db/models/base.py", line 496, in __repr__ u = six.text_type(self) File "/usr/lib/python3/dist-packages/maasserver/models/subnet.py", line 434, in __str__ self.name, self.cidr, self.vlan.vid) File "/usr/lib/python3/dist-packages/django/db/models/fields/related.py", line 613, in __get__ qs = qs.filter(**params) File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 679, in filter return self._filter_or_exclude(False, *args, **kwargs) File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 697, in _filter_or_exclude clone.query.add_q(Q(*args, **kwargs)) File "/usr/lib/python3/dist-packages/django/db/models/sql/query.py", line 1310, in add_q clause, require_inner = self._add_q(where_part, self.used_aliases) File "/usr/lib/python3/dist-packages/django/db/models/sql/query.py", line 1338, in _add_q allow_joins=allow_joins, split_subq=split_subq, File "/usr/lib/python3/dist-packages/django/db/models/sql/query.py", line 1156, in build_filter value, lookups, used_joins = self.prepare_lookup_value(value, lookups, can_reuse, allow_joins) File "/usr/lib/python3/dist-packages/django/db/models/sql/query.py", line 1021, in prepare_lookup_value if (connections[DEFAULT_DB_ALIAS].features.interprets_empty_strings_as_nulls and File "/usr/lib/python3/dist-packages/maasserver/utils/orm.py", line 836, in __getattr__ "disabled." % threading.currentThread().name) RuntimeError: Database connections in this thread (MainThread) are disabled. >
The stacktraces when trying to delete the Pod in regiond.log are:
==> /var/log/maas/regiond.log <==
2017-11-20 15:47:59 maasserver.websockets.protocol: [critical] Error on request (2969) pod.delete: <ProtectedError instance at 0x7f66cb73fd68 with str error:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/django/db/models/fields/related.py", line 600, in __get__
rel_obj = getattr(instance, self.cache_name)
AttributeError: 'Subnet' object has no attribute '_vlan_cache'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/twisted/python/reflect.py", line 443, in safe_str
return str(o)
File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 141, in __repr__
return repr(data)
File "/usr/lib/python3/dist-packages/django/db/models/base.py", line 496, in __repr__
u = six.text_type(self)
File "/usr/lib/python3/dist-packages/maasserver/models/subnet.py", line 434, in __str__
self.name, self.cidr, self.vlan.vid)
File "/usr/lib/python3/dist-packages/django/db/models/fields/related.py", line 613, in __get__
qs = qs.filter(**params)
File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 679, in filter
return self._filter_or_exclude(False, *args, **kwargs)
File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 697, in _filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))
File "/usr/lib/python3/dist-packages/django/db/models/sql/query.py", line 1310, in add_q
clause, require_inner = self._add_q(where_part, self.used_aliases)
File "/usr/lib/python3/dist-packages/django/db/models/sql/query.py", line 1338, in _add_q
allow_joins=allow_joins, split_subq=split_subq,
File "/usr/lib/python3/dist-packages/django/db/models/sql/query.py", line 1156, in build_filter
value, lookups, used_joins = self.prepare_lookup_value(value, lookups, can_reuse, allow_joins)
File "/usr/lib/python3/dist-packages/django/db/models/sql/query.py", line 1021, in prepare_lookup_value
if (connections[DEFAULT_DB_ALIAS].features.interprets_empty_strings_as_nulls and
File "/usr/lib/python3/dist-packages/maasserver/utils/orm.py", line 836, in __getattr__
"disabled." % threading.currentThread().name)
RuntimeError: Database connections in this thread (MainThread) are disabled.
>
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 842, 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 875, in callInContext
return func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/provisioningserver/utils/twisted.py", line 232, in wrapper
result = func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/maasserver/utils/orm.py", line 754, in call_within_transaction
return func_outside_txn(*args, **kwargs)
File "/usr/lib/python3/dist-packages/maasserver/utils/orm.py", line 561, 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/models/bmc.py", line 1029, in perform_deletion
super(BMC, pod).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 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: <ProtectedError instance at 0x7f66cb73fd68 with str error:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/django/db/models/fields/related.py", line 600, in __get__
rel_obj = getattr(instance, self.cache_name)
AttributeError: 'Subnet' object has no attribute '_vlan_cache'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/twisted/python/reflect.py", line 443, in safe_str
return str(o)
File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 141, in __repr__
return repr(data)
File "/usr/lib/python3/dist-packages/django/db/models/base.py", line 496, in __repr__
u = six.text_type(self)
File "/usr/lib/python3/dist-packages/maasserver/models/subnet.py", line 434, in __str__
self.name, self.cidr, self.vlan.vid)
File "/usr/lib/python3/dist-packages/django/db/models/fields/related.py", line 613, in __get__
qs = qs.filter(**params)
File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 679, in filter
return self._filter_or_exclude(False, *args, **kwargs)
File "/usr/lib/python3/dist-packages/django/db/models/query.py", line 697, in _filter_or_exclude
clone.query.add_q(Q(*args, **kwargs))
File "/usr/lib/python3/dist-packages/django/db/models/sql/query.py", line 1310, in add_q
clause, require_inner = self._add_q(where_part, self.used_aliases)
File "/usr/lib/python3/dist-packages/django/db/models/sql/query.py", line 1338, in _add_q
allow_joins=allow_joins, split_subq=split_subq,
File "/usr/lib/python3/dist-packages/django/db/models/sql/query.py", line 1156, in build_filter
value, lookups, used_joins = self.prepare_lookup_value(value, lookups, can_reuse, allow_joins)
File "/usr/lib/python3/dist-packages/django/db/models/sql/query.py", line 1021, in prepare_lookup_value
if (connections[DEFAULT_DB_ALIAS].features.interprets_empty_strings_as_nulls and
File "/usr/lib/python3/dist-packages/maasserver/utils/orm.py", line 836, in __getattr__
"disabled." % threading.currentThread().name)
RuntimeError: Database connections in this thread (MainThread) are disabled.
>
On a fresh install (new db as well), I am still getting an error on delete but it is the more compact UI error of:
Performing delete failed: ("Cannot delete some instances of model 'VLAN' because they are referenced through a protected foreign key: 'PhysicalInterf ace.vlan' ", [<PhysicalInter face: name=ens3, type=physical, mac=52: 54:00:c3: 99:ac, id=1>])
With regiond.log:
==> /var/log/ maas/regiond. log <== websockets. protocol: [critical] Error on request (248) pod.delete: ("Cannot delete some instances of model 'VLAN' because they are referenced through a protected foreign key: 'PhysicalInterf ace.vlan' ", [<PhysicalInter face: name=ens3, type=physical, mac=52: 54:00:c3: 99:ac, id=1>])
2017-11-20 22:25:44 maasserver.
Traceback (most recent call last): python3. 5/threading. py", line 862, in run _target( *self._ args, **self._kwargs) python3/ dist-packages/ provisioningser ver/utils/ twisted. py", line 842, in worker python3/ dist-packages/ twisted/ _threads/ _threadworker. py", line 46, in work python3/ dist-packages/ twisted/ _threads/ _team.py" , line 190, in doWork python3/ dist-packages/ twisted/ python/ threadpool. py", line 246, in inContext python3/ dist-packages/ twisted/ python/ threadpool. py", line 262, in <lambda> theWork = lambda: context.call(ctx, func, *args, **kw) python3/ dist-packages/ twisted/ python/ context. py", line 118, in callWithContext text(). callWithContext (ctx, func, *args, **kw) python3/ dist-packages/ twisted/ python/ context. py", line 81, in callWithContext python3/ dist-packages/ provisioningser ver/utils/ twisted. py", line 875, in callInContext python3/ dist-packages/ provisioningser ver/utils/ twisted. py", line 232, in wrapper python3/ dist-packages/ maasserver/ utils/orm. py", line 754, in call_within_ transaction txn(*args, **kwargs) python3/ dist-packages/ maasserver/ utils/orm. py", line 561, in retrier python3. 5/contextlib. py", line 30, in inner python3/ dist-packages/ maasserver/ models/ bmc.py" , line 1029, in perform_deletion python3/ dist-packages/ django/ db/models/ base.py" , line 895, in delete collect( [self]) python3/ dist-packages/ django/ db/models/ deletion. py", line 229, in collect rel.on_ delete( self, field, sub_objs, self.using) python3/ dist-packages/ django/ db/models/ deletion. py", line 18, in CASCADE attr=field. name, nullable= field.null) python3/ dist-packages/ django/ db/models/ deletion. py", line 229, in collect rel.on_ delete( self, field, sub_objs, self.using) python3/ dist-packages/ django/ db/models/ deletion. py", line 18, in CASCADE
File "/usr/lib/
self.
File "/usr/lib/
return target()
File "/usr/lib/
task()
File "/usr/lib/
task()
--- <exception caught here> ---
File "/usr/lib/
result = inContext.theWork()
File "/usr/lib/
inContext.
File "/usr/lib/
return self.currentCon
File "/usr/lib/
return func(*args,**kw)
File "/usr/lib/
return func(*args, **kwargs)
File "/usr/lib/
result = func(*args, **kwargs)
File "/usr/lib/
return func_outside_
File "/usr/lib/
return func(*args, **kwargs)
File "/usr/lib/
return func(*args, **kwds)
File "/usr/lib/
super(BMC, pod).delete()
File "/usr/lib/
collector.
File "/usr/lib/
field.
File "/usr/lib/
source_
File "/usr/lib/
field.
File "/usr/lib/
source_...