minor fixes from testing: do not require vm to be present for force-create, fix id generation in vmm_tls, use 32mb memory for unikernels by default

This commit is contained in:
Hannes Mehnert 2018-10-28 23:06:15 +01:00
parent 9191d2cf9a
commit 2b85c65dd8
6 changed files with 13 additions and 5 deletions

View file

@ -119,6 +119,10 @@ let cpu =
let doc = "CPUid" in let doc = "CPUid" in
Arg.(value & opt int 0 & info [ "cpu" ] ~doc) Arg.(value & opt int 0 & info [ "cpu" ] ~doc)
let vm_mem =
let doc = "Memory to assign" in
Arg.(value & opt int 32 & info [ "mem" ] ~doc)
let args = let args =
let doc = "Boot arguments" in let doc = "Boot arguments" in
Arg.(value & opt_all string [] & info [ "arg" ] ~doc) Arg.(value & opt_all string [] & info [ "arg" ] ~doc)

View file

@ -197,7 +197,7 @@ let create_cmd =
[`S "DESCRIPTION"; [`S "DESCRIPTION";
`P "Creates a virtual machine."] `P "Creates a virtual machine."]
in in
Term.(ret (const create $ setup_log $ destination $ ca_cert $ ca_key $ server_ca $ force $ vm_name $ image $ cpu $ mem $ args $ block $ net $ compress_level)), Term.(ret (const create $ setup_log $ destination $ ca_cert $ ca_key $ server_ca $ force $ vm_name $ image $ cpu $ vm_mem $ args $ block $ net $ compress_level)),
Term.info "create" ~doc ~man Term.info "create" ~doc ~man
let console_cmd = let console_cmd =

View file

@ -156,7 +156,7 @@ let create_cmd =
[`S "DESCRIPTION"; [`S "DESCRIPTION";
`P "Creates a virtual machine."] `P "Creates a virtual machine."]
in in
Term.(ret (const create $ setup_log $ socket $ force $ vm_name $ image $ cpu $ mem $ args $ block $ net $ compress_level)), Term.(ret (const create $ setup_log $ socket $ force $ vm_name $ image $ cpu $ vm_mem $ args $ block $ net $ compress_level)),
Term.info "create" ~doc ~man Term.info "create" ~doc ~man
let console_cmd = let console_cmd =

View file

@ -121,7 +121,7 @@ let create_cmd =
[`S "DESCRIPTION"; [`S "DESCRIPTION";
`P "Creates a virtual machine."] `P "Creates a virtual machine."]
in in
Term.(ret (const create $ setup_log $ force $ vm_name $ image $ cpu $ mem $ args $ block $ net $ compress_level)), Term.(ret (const create $ setup_log $ force $ vm_name $ image $ cpu $ vm_mem $ args $ block $ net $ compress_level)),
Term.info "create" ~doc ~man Term.info "create" ~doc ~man
let console_cmd = let console_cmd =

View file

@ -13,7 +13,7 @@ let cert_name cert =
match Vmm_asn.cert_extension_of_cstruct data with match Vmm_asn.cert_extension_of_cstruct data with
| Error (`Msg _) -> Error (`Msg "couldn't parse albatross extension") | Error (`Msg _) -> Error (`Msg "couldn't parse albatross extension")
| Ok (_, `Policy_cmd (`Policy_add _)) -> Error (`Msg "policy add may not have an empty name") | Ok (_, `Policy_cmd (`Policy_add _)) -> Error (`Msg "policy add may not have an empty name")
| _ -> Ok (Some name) | _ -> Ok None
else Ok (Some name) else Ok (Some name)
let name chain = let name chain =

View file

@ -158,7 +158,11 @@ let handle_command t (header, payload) =
| `Vm_create vm_config -> | `Vm_create vm_config ->
handle_create t header vm_config handle_create t header vm_config
| `Vm_force_create vm_config -> | `Vm_force_create vm_config ->
Vmm_resources.remove_vm t.resources id >>= fun resources -> let resources =
match Vmm_resources.remove_vm t.resources id with
| Error _ -> t.resources
| Ok r -> r
in
if Vmm_resources.check_vm_policy resources id vm_config then if Vmm_resources.check_vm_policy resources id vm_config then
begin match Vmm_resources.find_vm t.resources id with begin match Vmm_resources.find_vm t.resources id with
| None -> handle_create t header vm_config | None -> handle_create t header vm_config