type template_info = {
base_image : string;
+ guest_arch : string option;
minimum_memory : int64 option;
recommended_memory : int64 option;
minimum_size : int64 option;
disk_bus : string option;
network_model : string option;
has_xml_target : bool;
+ needs_external_kernel : bool;
+ cmdline : string option;
}
let probe ?(verbose = false) filename =
| _ ->
eprintf "mclu: cannot parse '%s base-image'\n" filename;
exit 1 in
+ let guest_arch =
+ match run_template ~verbose filename "guest-arch" [] with
+ | Some [arch] -> Some arch
+ | _ -> None in
let minimum_memory =
match run_template ~verbose filename "minimum-memory" [] with
| Some [memory] ->
let has_xml_target = run_template ~verbose filename "xml" [] <> None in
+ let needs_external_kernel =
+ match run_template ~verbose filename "needs-external-kernel" [] with
+ | None -> false
+ | Some ["1"|"yes"] -> true
+ | Some _ -> false in
+
+ let cmdline =
+ match run_template ~verbose filename "cmdline" [] with
+ | Some [cmdline] -> Some cmdline
+ | _ -> None in
+
+ if not needs_external_kernel && cmdline <> None then (
+ eprintf "mclu: template cannot set 'cmdline' unless 'needs-external-kernel' is 'yes'.\n";
+ exit 1
+ );
+
{ base_image = base_image;
+ guest_arch = guest_arch;
minimum_memory = minimum_memory;
recommended_memory = recommended_memory;
minimum_size = minimum_size;
disk_bus = disk_bus;
network_model = network_model;
- has_xml_target = has_xml_target }
+ has_xml_target = has_xml_target;
+ needs_external_kernel = needs_external_kernel;
+ cmdline = cmdline }