Skip to content

Commit 505a62c

Browse files
committed
fix(bootstrap): map stand hypervisor 'driver' key to polymorphic driver_spec 'kind'
apply_startup_db seeded MachinePool.driver_spec from the stand's hypervisor dict which uses a 'driver' key, but driver_spec is now a KindModelSelectorType selected by 'kind' (LibvirtPoolDriverSpec.KIND). restore_from_simple_view raised UnknownType, crashing the one-shot bootstrap. Translate driver->kind. Latent since the machine-pool driver_spec became polymorphic; surfaced on the first fresh core built from this branch.
1 parent dd7e95c commit 505a62c

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

exordos_core/bootstrap/defaults.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,10 +393,17 @@ def apply_startup_db(spec: dict[str, tp.Any]) -> None:
393393

394394
for hypervisor in stand.get("hypervisors", []):
395395
hypervisor["iface_mtu"] = 1500
396+
# The stand spec describes the pool driver with a ``driver`` key, but
397+
# ``MachinePool.driver_spec`` is a polymorphic kind selected by
398+
# ``kind`` (e.g. LibvirtPoolDriverSpec.KIND == "libvirt"). Translate so
399+
# restore_from_simple_view can resolve the kind.
400+
driver_spec = dict(hypervisor)
401+
if "driver" in driver_spec and "kind" not in driver_spec:
402+
driver_spec["kind"] = driver_spec.pop("driver")
396403
pool_data = {
397404
"name": "hypervisor",
398405
"machine_type": "VM",
399-
"driver_spec": hypervisor,
406+
"driver_spec": driver_spec,
400407
}
401408
pool = compute_models.MachinePool.restore_from_simple_view(**pool_data)
402409

0 commit comments

Comments
 (0)