Vmm_unix.exec: rename vm to config

This commit is contained in:
Hannes Mehnert 2019-01-20 20:35:26 +01:00
parent 25ca62bf69
commit accb21b8b7

View file

@ -147,7 +147,7 @@ let cpuset cpu =
Ok ([ "taskset" ; "-c" ; cpustring ]) Ok ([ "taskset" ; "-c" ; cpustring ])
| x -> Error (`Msg ("unsupported operating system " ^ x)) | x -> Error (`Msg ("unsupported operating system " ^ x))
let exec name vm taps block = let exec name config taps block =
(match taps, block with (match taps, block with
| [], None -> Ok "none" | [], None -> Ok "none"
| [_], None -> Ok "net" | [_], None -> Ok "net"
@ -156,10 +156,10 @@ let exec name vm taps block =
| _, _ -> Error (`Msg "cannot handle multiple network interfaces")) >>= fun bin -> | _, _ -> Error (`Msg "cannot handle multiple network interfaces")) >>= fun bin ->
let net = List.map (fun t -> "--net=" ^ t) taps let net = List.map (fun t -> "--net=" ^ t) taps
and block = match block with None -> [] | Some dev -> [ "--disk=" ^ Fpath.to_string (block_file dev) ] and block = match block with None -> [] | Some dev -> [ "--disk=" ^ Fpath.to_string (block_file dev) ]
and argv = match vm.Unikernel.argv with None -> [] | Some xs -> xs and argv = match config.Unikernel.argv with None -> [] | Some xs -> xs
and mem = "--mem=" ^ string_of_int vm.Unikernel.memory and mem = "--mem=" ^ string_of_int config.Unikernel.memory
in in
cpuset vm.Unikernel.cpuid >>= fun cpuset -> cpuset config.Unikernel.cpuid >>= fun cpuset ->
let cmd = let cmd =
Bos.Cmd.(of_list cpuset % p Fpath.(dbdir / "solo5-hvt" + bin) % mem %% Bos.Cmd.(of_list cpuset % p Fpath.(dbdir / "solo5-hvt" + bin) % mem %%
of_list net %% of_list block % of_list net %% of_list block %
@ -180,7 +180,7 @@ let exec name vm taps block =
process and don't really need it here anymore... *) process and don't really need it here anymore... *)
close stdout ; close stdout ;
(* this should get rid of the vmimage from vmmd's memory! *) (* this should get rid of the vmimage from vmmd's memory! *)
let config = Unikernel.{ vm with image = (fst vm.Unikernel.image, Cstruct.create 0) } in let config = Unikernel.{ config with image = (fst config.Unikernel.image, Cstruct.create 0) } in
Ok Unikernel.{ config ; cmd ; pid ; taps } Ok Unikernel.{ config ; cmd ; pid ; taps }
with with
Unix.Unix_error (e, _, _) -> Unix.Unix_error (e, _, _) ->