Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"mirage describe" should reflect configured state of the unikernel #713

Open
mato opened this issue Nov 30, 2016 · 14 comments
Open

"mirage describe" should reflect configured state of the unikernel #713

mato opened this issue Nov 30, 2016 · 14 comments

Comments

@mato
Copy link
Contributor

mato commented Nov 30, 2016

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.

@hannesm hannesm added this to the mirage 3.0.0 milestone Dec 8, 2016
@yomimono
Copy link
Contributor

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.

@mato
Copy link
Contributor Author

mato commented Dec 19, 2016

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?

@mato
Copy link
Contributor Author

mato commented Dec 19, 2016

/cc @Drup

@hannesm
Copy link
Member

hannesm commented Jan 26, 2017

this is still broken...

@hannesm
Copy link
Member

hannesm commented Jan 26, 2017

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...

@samoht
Copy link
Member

samoht commented Jul 18, 2017

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.

@yomimono
Copy link
Contributor

849 is now merged; what are the release dependencies?

@samoht
Copy link
Member

samoht commented Jul 21, 2017

@yomimono: I guess functoria needs to be released first and then mirage. Or I didn't understand your question :-)

@yomimono
Copy link
Contributor

That is what I meant! Thanks.

@yomimono
Copy link
Contributor

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     

@samoht
Copy link
Member

samoht commented Nov 20, 2017

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 ...

@samoht
Copy link
Member

samoht commented Nov 20, 2017

@Drup do you remember why you separated the eval of eval_cached in mirage/functoria@9b74280 ? Can't describe just use eval_cached as well?

@Drup
Copy link
Member

Drup commented Nov 20, 2017

@samoht Honestly, I don't remember. Maybe I just forgot to do it. Having eval/eval_cache separate was useful for handling failure, iirc.

@samoht
Copy link
Member

samoht commented Nov 20, 2017

Do you remember which case of failures? I will try to add some tests, so keen to test the failure modes as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants