MAAS Version: 3.3/stable
If an interface (like a VF) is added using the hostdev type in virsh, "Refresh KVM Node" / maas admin vm-host [id] refresh exits with an error:
"Value 'hostdev' is not a valid choice."
Stack trace:
2023-10-17 16:29:07 maasserver.websockets.protocol: [critical] Error on request (99) pod.refresh: {"attachment_type": ["Value 'hostdev' is not a valid choice."]}
Traceback (most recent call last):
File "/snap/maas/28521/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 700, in errback
self._startRunCallbacks(fail)
File "/snap/maas/28521/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 763, in _startRunCallbacks
self._runCallbacks()
File "/snap/maas/28521/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 857, in _runCallbacks
current.result = callback( # type: ignore[misc]
File "/snap/maas/28521/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1750, in gotResult
current_context.run(_inlineCallbacks, r, gen, status)
--- <exception caught here> ---
File "/snap/maas/28521/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1656, in _inlineCallbacks
result = current_context.run(
File "/snap/maas/28521/usr/lib/python3/dist-packages/twisted/python/failure.py", line 489, in throwExceptionIntoGenerator
return g.throw(self.type, self.value, self.tb)
File "/snap/maas/28521/lib/python3.10/site-packages/maasserver/websockets/handlers/pod.py", line 285, in refresh
await discover_and_sync_vmhost_async(pod, self.user)
File "/snap/maas/28521/lib/python3.10/site-packages/maasserver/vmhost.py", line 139, in discover_and_sync_vmhost_async
await deferToDatabase(
File "/snap/maas/28521/usr/lib/python3/dist-packages/twisted/python/threadpool.py", line 244, in inContext
result = inContext.theWork() # type: ignore[attr-defined]
File "/snap/maas/28521/usr/lib/python3/dist-packages/twisted/python/threadpool.py", line 260, in <lambda>
inContext.theWork = lambda: context.call( # type: ignore[attr-defined]
File "/snap/maas/28521/usr/lib/python3/dist-packages/twisted/python/context.py", line 117, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/snap/maas/28521/usr/lib/python3/dist-packages/twisted/python/context.py", line 82, in callWithContext
return func(*args, **kw)
File "/snap/maas/28521/lib/python3.10/site-packages/provisioningserver/utils/twisted.py", line 857, in callInContext
return func(*args, **kwargs)
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 771, in call_within_transaction
return func_outside_txn(*args, **kwargs)
File "/snap/maas/28521/lib/python3.10/site-packages/maasserver/utils/orm.py", line 574, in retrier
return func(*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/maasserver/vmhost.py", line 312, in _update_db
vmhost.sync(discovered_pod, user, cluster=cluster)
File "/snap/maas/28521/lib/python3.10/site-packages/maasserver/models/bmc.py", line 1670, in sync
self.sync_machines(discovered_pod.machines, commissioning_user)
File "/snap/maas/28521/lib/python3.10/site-packages/maasserver/models/bmc.py", line 1572, in sync_machines
self._sync_machine(discovered_machine, existing_machine)
File "/snap/maas/28521/lib/python3.10/site-packages/maasserver/models/bmc.py", line 1229, in _sync_machine
self._sync_vm(discovered_machine, existing_machine)
File "/snap/maas/28521/lib/python3.10/site-packages/maasserver/models/bmc.py", line 1268, in _sync_vm
self._sync_vm_interfaces(vm, discovered_machine)
File "/snap/maas/28521/lib/python3.10/site-packages/maasserver/models/bmc.py", line 1296, in _sync_vm_interfaces
iface = VirtualMachineInterface.objects.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 453, in create
obj.save(force_insert=True, using=self.db)
File "/snap/maas/28521/lib/python3.10/site-packages/maasserver/models/cleansave.py", line 46, in save
self.full_clean(exclude=exclude_clean_fields, validate_unique=False)
File "/snap/maas/28521/usr/lib/python3/dist-packages/django/db/models/base.py", line 1251, in full_clean
raise ValidationError(errors)
django.core.exceptions.ValidationError: {'attachment_type': ["Value 'hostdev' is not a valid choice."]}