vmm_asn: instead of potentially losing information, be honest and fail if requested to encode older versions of unikernel configuration
This commit is contained in:
parent
125711ac6d
commit
5adc2f0a8a
|
@ -356,13 +356,7 @@ let v0_unikernel_config =
|
||||||
and fail_behaviour = `Quit (* TODO maybe set to restart by default :) *)
|
and fail_behaviour = `Quit (* TODO maybe set to restart by default :) *)
|
||||||
in
|
in
|
||||||
{ typ ; compressed ; image ; fail_behaviour ; cpuid ; memory ; block_devices ; bridges ; argv }
|
{ typ ; compressed ; image ; fail_behaviour ; cpuid ; memory ; block_devices ; bridges ; argv }
|
||||||
and g vm =
|
and g _vm = failwith "cannot encode v0 unikernel configs"
|
||||||
let network_interfaces = match vm.bridges with [] -> None | xs -> Some (List.map fst xs)
|
|
||||||
and block_device = match vm.block_devices with [] -> None | x::_ -> Some x
|
|
||||||
and typ = if vm.compressed then `Hvt_amd64_compressed else `Hvt_amd64
|
|
||||||
in
|
|
||||||
let image = typ, vm.image in
|
|
||||||
(vm.cpuid, vm.memory, block_device, network_interfaces, image, vm.argv)
|
|
||||||
in
|
in
|
||||||
Asn.S.map f g @@
|
Asn.S.map f g @@
|
||||||
Asn.S.(sequence6
|
Asn.S.(sequence6
|
||||||
|
@ -383,11 +377,7 @@ let v1_unikernel_config =
|
||||||
and block_devices = match blocks with None -> [] | Some xs -> xs
|
and block_devices = match blocks with None -> [] | Some xs -> xs
|
||||||
in
|
in
|
||||||
{ typ ; compressed ; image ; fail_behaviour ; cpuid ; memory ; block_devices ; bridges ; argv }
|
{ typ ; compressed ; image ; fail_behaviour ; cpuid ; memory ; block_devices ; bridges ; argv }
|
||||||
and g vm =
|
and g _vm = failwith "cannot encode v1 unikernel configs"
|
||||||
let bridges = match vm.bridges with [] -> None | xs -> Some (List.map fst xs)
|
|
||||||
and blocks = match vm.block_devices with [] -> None | xs -> Some xs
|
|
||||||
in
|
|
||||||
(vm.typ, (vm.compressed, (vm.image, (vm.fail_behaviour, (vm.cpuid, (vm.memory, (blocks, (bridges, vm.argv))))))))
|
|
||||||
in
|
in
|
||||||
Asn.S.(map f g @@ sequence @@
|
Asn.S.(map f g @@ sequence @@
|
||||||
(required ~label:"typ" typ)
|
(required ~label:"typ" typ)
|
||||||
|
|
Loading…
Reference in a new issue