mirage
mirage copied to clipboard
"mirage describe" should reflect configured state of the unikernel
With the changes in #703 and followup in mirage/functoria#85 the Mirage describe
subcommand should show the configured state of the unikernel rather than the "default" state, i.e. reflect any keys persisted from a previous run of mirage configure
.
Also, this subcommand currently accepts all the standard mirage options, including -t
. Does that serve any useful use-case? If not then the command should behave identically to build
following mirage/functoria#85, i.e. error out if configure
has not been run first, not accept any configuration keys and only display the configured state.
@hannesm @yomimono @samoht Please comment on what the best behaviour with regard to the new workflow is here.
I don't frequently use describe
, but when I do I'm trying to figure out the dependency graph of modules, so I'm using it with the --dot
output and want the configured state of the unikernel (the behavior that maps to previous --eval
).
We don't describe mirage describe
in introductory materials (if I remember correctly), but I imagine that it would be useful in key discovery for unconfigured unikernels (or confusing if it didn't do that, maybe) were we to teach its use.
Relevant discussion from the list is here: https://lists.xenproject.org/archives/html/mirageos-devel/2016-12/msg00011.html
I think the conclusion on the list was that in the configured case describe
should always behave as with --eval
and reflect the configured values (but possibly have a --no-eval
) while in the unconfigured case it should do what it does today.
For key discovery from an end user point of view that should be something like mirage configure --help
?
/cc @Drup
this is still broken...
some logging output in functoria leads to:
mirage: [WARNING] read mirage configure -t virtio -r home
mirage: [WARNING] cached context is prng=stdlib (default), target=virtio
mirage: [WARNING] context is prng=stdlib (default), target=unix (default)
mirage: [WARNING] merging with some default
mirage: [WARNING] merged context is prng=stdlib (default), target=virtio
Name canopy
Root /usr/home/hannes/devel/mirage/Canopy
Keys interface=0 (default), ipv4=198.167.222.208/24 (default),
ipv4-gateway=198.167.222.1 (default), logs= (default), port=8080 (default),
prng=stdlib (default), push_hook=push (default),
remote=https://github.com/Engil/__blog.git (default),
target=unix (default), tls_port= (default), warn_error=false (default)
I suspect it has to be in this code
let partial = match full_eval with
| Some true -> false
| Some false -> true
| None -> not (Cache.present cached_context)
in
Config'.eval ~with_required:false ~partial context config
where the merged context is passed in, but nevertheless as target unix
is shown.
For some unknown reason, the read -r home
is not at all put into the cached context (which it should), and thus defaults to remote=https://github.com/Engil/__blog.git (default),
Another abnormality is that prng=stdlib(default)
is somehow put into the cached context, although no --prng
key is on disk.
maybe @Drup has an idea...
I think this should now be fixed with the HEAD version of functoria, which should be compatible with the HEAD version of mirage when #849 is merged.
849 is now merged; what are the release dependencies?
@yomimono: I guess functoria needs to be released first and then mirage. Or I didn't understand your question :-)
That is what I meant! Thanks.
I don't think this is fixed as of mirage 3.0.5. Configuring the network example with --dhcp true
never gives mirage describe
output reflecting that key; it always just shows defaults:
4.06.0+afl🐫 (master) 13.01 mirageos:~/mirage-skeleton/device-usage/network$ mirage clean
4.06.0+afl🐫 (master) 13.01 mirageos:~/mirage-skeleton/device-usage/network$ mirage describe
Name network
Build-dir /home/user/mirage-skeleton/device-usage/network/./
Keys dhcp=false (default), interface=tap0 (default),
interfaces=0.0.0.0 (default), ipv4=10.0.0.2/24 (default),
ipv4-gateway=10.0.0.1 (default), logs= (default), net=direct (default),
port=8080 (default), prng=stdlib (default), socket= (default),
target=unix (default), target_debug=false, warn_error=false (default)
Output
4.06.0+afl🐫 (master) 13.01 mirageos:~/mirage-skeleton/device-usage/network$ mirage configure -t unix --dhcp true
4.06.0+afl🐫 (master) 13.01 mirageos:~/mirage-skeleton/device-usage/network$ mirage describe
Name network
Build-dir /home/user/mirage-skeleton/device-usage/network/./
Keys dhcp=false (default), interface=tap0 (default), logs= (default),
net=direct (default), port=8080 (default), prng=stdlib (default),
target=unix (default), target_debug=false, warn_error=false (default)
Output
4.06.0+afl🐫 (master) 13.01 mirageos:~/mirage-skeleton/device-usage/network$ make
mirage build
ocamlfind ocamldep -package tcpip.unix -package tcpip.udp -package tcpip.tcp -package tcpip.stack-direct -package tcpip.icmpv4 -package tcpip.ethif -package tcpip.arpv4 -package tcpip -package mirage-unix -package mirage-types-lwt -package mirage-types -package mirage-runtime -package mirage-random -package mirage-net-unix -package mirage-logs -package mirage-clock-unix -package lwt -package functoria-runtime -package charrua-client-mirage -predicates mirage_unix -modules main.ml > main.ml.depends
ocamlfind ocamldep -package tcpip.unix -package tcpip.udp -package tcpip.tcp -package tcpip.stack-direct -package tcpip.icmpv4 -package tcpip.ethif -package tcpip.arpv4 -package tcpip -package mirage-unix -package mirage-types-lwt -package mirage-types -package mirage-runtime -package mirage-random -package mirage-net-unix -package mirage-logs -package mirage-clock-unix -package lwt -package functoria-runtime -package charrua-client-mirage -predicates mirage_unix -modules key_gen.ml > key_gen.ml.depends
ocamlfind ocamldep -package tcpip.unix -package tcpip.udp -package tcpip.tcp -package tcpip.stack-direct -package tcpip.icmpv4 -package tcpip.ethif -package tcpip.arpv4 -package tcpip -package mirage-unix -package mirage-types-lwt -package mirage-types -package mirage-runtime -package mirage-random -package mirage-net-unix -package mirage-logs -package mirage-clock-unix -package lwt -package functoria-runtime -package charrua-client-mirage -predicates mirage_unix -modules unikernel.ml > unikernel.ml.depends
ocamlfind ocamlc -c -g -g -bin-annot -safe-string -principal -strict-sequence -package tcpip.unix -package tcpip.udp -package tcpip.tcp -package tcpip.stack-direct -package tcpip.icmpv4 -package tcpip.ethif -package tcpip.arpv4 -package tcpip -package mirage-unix -package mirage-types-lwt -package mirage-types -package mirage-runtime -package mirage-random -package mirage-net-unix -package mirage-logs -package mirage-clock-unix -package lwt -package functoria-runtime -package charrua-client-mirage -predicates mirage_unix -w A-4-41-42-44 -color always -o key_gen.cmo key_gen.ml
ocamlfind ocamlc -c -g -g -bin-annot -safe-string -principal -strict-sequence -package tcpip.unix -package tcpip.udp -package tcpip.tcp -package tcpip.stack-direct -package tcpip.icmpv4 -package tcpip.ethif -package tcpip.arpv4 -package tcpip -package mirage-unix -package mirage-types-lwt -package mirage-types -package mirage-runtime -package mirage-random -package mirage-net-unix -package mirage-logs -package mirage-clock-unix -package lwt -package functoria-runtime -package charrua-client-mirage -predicates mirage_unix -w A-4-41-42-44 -color always -o unikernel.cmo unikernel.ml
ocamlfind ocamlc -c -g -g -bin-annot -safe-string -principal -strict-sequence -package tcpip.unix -package tcpip.udp -package tcpip.tcp -package tcpip.stack-direct -package tcpip.icmpv4 -package tcpip.ethif -package tcpip.arpv4 -package tcpip -package mirage-unix -package mirage-types-lwt -package mirage-types -package mirage-runtime -package mirage-random -package mirage-net-unix -package mirage-logs -package mirage-clock-unix -package lwt -package functoria-runtime -package charrua-client-mirage -predicates mirage_unix -w A-4-41-42-44 -color always -o main.cmo main.ml
ocamlfind ocamlopt -c -g -g -bin-annot -safe-string -principal -strict-sequence -package tcpip.unix -package tcpip.udp -package tcpip.tcp -package tcpip.stack-direct -package tcpip.icmpv4 -package tcpip.ethif -package tcpip.arpv4 -package tcpip -package mirage-unix -package mirage-types-lwt -package mirage-types -package mirage-runtime -package mirage-random -package mirage-net-unix -package mirage-logs -package mirage-clock-unix -package lwt -package functoria-runtime -package charrua-client-mirage -predicates mirage_unix -w A-4-41-42-44 -color always -o key_gen.cmx key_gen.ml
ocamlfind ocamlopt -c -g -g -bin-annot -safe-string -principal -strict-sequence -package tcpip.unix -package tcpip.udp -package tcpip.tcp -package tcpip.stack-direct -package tcpip.icmpv4 -package tcpip.ethif -package tcpip.arpv4 -package tcpip -package mirage-unix -package mirage-types-lwt -package mirage-types -package mirage-runtime -package mirage-random -package mirage-net-unix -package mirage-logs -package mirage-clock-unix -package lwt -package functoria-runtime -package charrua-client-mirage -predicates mirage_unix -w A-4-41-42-44 -color always -o unikernel.cmx unikernel.ml
ocamlfind ocamlopt -c -g -g -bin-annot -safe-string -principal -strict-sequence -package tcpip.unix -package tcpip.udp -package tcpip.tcp -package tcpip.stack-direct -package tcpip.icmpv4 -package tcpip.ethif -package tcpip.arpv4 -package tcpip -package mirage-unix -package mirage-types-lwt -package mirage-types -package mirage-runtime -package mirage-random -package mirage-net-unix -package mirage-logs -package mirage-clock-unix -package lwt -package functoria-runtime -package charrua-client-mirage -predicates mirage_unix -w A-4-41-42-44 -color always -o main.cmx main.ml
ocamlfind ocamlopt -g -linkpkg -g -package tcpip.unix -package tcpip.udp -package tcpip.tcp -package tcpip.stack-direct -package tcpip.icmpv4 -package tcpip.ethif -package tcpip.arpv4 -package tcpip -package mirage-unix -package mirage-types-lwt -package mirage-types -package mirage-runtime -package mirage-random -package mirage-net-unix -package mirage-logs -package mirage-clock-unix -package lwt -package functoria-runtime -package charrua-client-mirage -predicates mirage_unix key_gen.cmx unikernel.cmx main.cmx -o main.native
4.06.0+afl🐫 (master) 13.01 mirageos:~/mirage-skeleton/device-usage/network$ mirage describe
Name network
Build-dir /home/user/mirage-skeleton/device-usage/network/./
Keys dhcp=false (default), interface=tap0 (default), logs= (default),
net=direct (default), port=8080 (default), prng=stdlib (default),
target=unix (default), target_debug=false, warn_error=false (default)
Output
Hum Indeed. I think I just checked that "configure -> build" was working as expected and assumed it would work for describe
... and we are not definitely not testing this. I'll have a quick look at my patches ...
@Drup do you remember why you separated the eval
of eval_cached
in https://github.com/mirage/functoria/commit/9b742801b2ef5720c42c60fd8cebd601961ff6f4 ? Can't describe
just use eval_cached
as well?
@samoht Honestly, I don't remember. Maybe I just forgot to do it. Having eval/eval_cache separate was useful for handling failure, iirc.
Do you remember which case of failures? I will try to add some tests, so keen to test the failure modes as well.