Repository navigation
Commit 5d0f26d
sandbox: run a workload once through the managed VM API
sandbox run still booted a one-shot VM: it passed its shares and its
workload as boot tokens, and ran OpenVMM on the terminal with its
lifecycle option, so that the shell /init booted the layered root
through the old one-shot init, and it exited with OpenVMM's status.
A run now launches the VM that a provision and a start of the same
options would launch, without a state directory. It serializes the
configuration that provision records, reads it back as start does, and
launches it through host::vm in a temporary VM directory, with
nvx_sandbox=1 and no OpenVMM lifecycle option, so that nvx-init boots
its root. Once nvx-init is ready and has mapped the shares, the run
executes its workload once over NVXC, with exec's --cwd, --environment,
--environment-file, and --inherit-default-environment, asks nvx-init to
stop the VM, waits up to --timeout for it to exit before it forces it
down, as a stop does, also when its control endpoint closes as it is
asked to stop, then writes the workload's output and exits with its
status. Once the VM has exited, it removes the VM directory, with the
staging file of a report that OpenVMM did not finish writing.
A run takes provision's --layer-format, for an EROFS or a GPT image, and
--ram-upper-percent, for a RAM upper's cap, 50 percent by default. It
refuses --state-dir, and checks its command line, as the launch checks
it too, and its request before it downloads or launches anything. It
refuses the shares that start refuses, with its temporary VM directory
in place of a state directory, through which the workload could change
what OpenVMM writes there, and those of the OpenVMM that it runs, which
NVX_OPENVMM may name instead of the artifact root's; provision and start
refuse a share of that one too (#818). --outcome-report forwards
OpenVMM's report of the run, which keeps its owner's permissions
whatever the umask. The one-shot plan, its boot tokens, and its prepared
launch, which nothing else used, are gone.
The CLI tests of the run cover each format and upper, exec's options,
shares, the refusal of the sandbox's own files, of its VM directory, and
of the OpenVMM that NVX_OPENVMM names, a guest that exits during
startup, a workload that the guest refuses, a VM that does not stop, a
VM whose endpoint closes as it stops, which the fake OpenVMM's new
fake_drop_stop=1 emulates, a command line that the launch refuses, which
downloads nothing, and the outcome report under restrictive umasks; a
unit test covers the removal of a report's staging file; the dry-run,
validation, and one-shot tests take the managed run's command and
refusals. The public sandbox scenarios and the CI smoke steps run the
smoke probe with the init profile, which a managed execution has, and
expect a caller-owned share to fail the run before its workload, as it
fails a start.
This replays esaurez's first implementation, a734c60, adapted to the
typed record, the CLI-owned lifecycle, and SL3.4a's cold boot.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 9114343 commit 5d0f26d
31 files changed
Lines changed: 1869 additions & 1258 deletions
File tree
- .github/workflows
- doc
- nvx-rs
- src
- host
- cli/sandbox
- lifecycle
- start
- sandbox
- options
- plan
- tests
- testing
- tests
- cli
- scripts
- nvx_tools
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
344 | | - | |
| 344 | + | |
| 345 | + | |
345 | 346 | | |
346 | 347 | | |
347 | 348 | | |
348 | 349 | | |
349 | 350 | | |
| 351 | + | |
350 | 352 | | |
351 | 353 | | |
352 | 354 | | |
| |||
377 | 379 | | |
378 | 380 | | |
379 | 381 | | |
| 382 | + | |
380 | 383 | | |
381 | 384 | | |
382 | 385 | | |
| |||
403 | 406 | | |
404 | 407 | | |
405 | 408 | | |
| 409 | + | |
406 | 410 | | |
407 | 411 | | |
408 | 412 | | |
| |||
511 | 515 | | |
512 | 516 | | |
513 | 517 | | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
514 | 522 | | |
515 | | - | |
| 523 | + | |
| 524 | + | |
516 | 525 | | |
517 | 526 | | |
518 | 527 | | |
519 | 528 | | |
520 | 529 | | |
521 | 530 | | |
| 531 | + | |
522 | 532 | | |
523 | 533 | | |
524 | 534 | | |
525 | | - | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
526 | 542 | | |
527 | 543 | | |
528 | 544 | | |
| |||
645 | 661 | | |
646 | 662 | | |
647 | 663 | | |
648 | | - | |
| 664 | + | |
649 | 665 | | |
650 | 666 | | |
651 | 667 | | |
| |||
770 | 786 | | |
771 | 787 | | |
772 | 788 | | |
773 | | - | |
| 789 | + | |
774 | 790 | | |
775 | 791 | | |
776 | 792 | | |
| |||
844 | 860 | | |
845 | 861 | | |
846 | 862 | | |
847 | | - | |
| 863 | + | |
| 864 | + | |
848 | 865 | | |
849 | 866 | | |
850 | 867 | | |
851 | 868 | | |
852 | 869 | | |
| 870 | + | |
853 | 871 | | |
854 | 872 | | |
855 | 873 | | |
| |||
878 | 896 | | |
879 | 897 | | |
880 | 898 | | |
| 899 | + | |
881 | 900 | | |
882 | 901 | | |
883 | 902 | | |
| |||
921 | 940 | | |
922 | 941 | | |
923 | 942 | | |
| 943 | + | |
924 | 944 | | |
925 | 945 | | |
926 | 946 | | |
| |||
1101 | 1121 | | |
1102 | 1122 | | |
1103 | 1123 | | |
1104 | | - | |
| 1124 | + | |
1105 | 1125 | | |
1106 | 1126 | | |
1107 | 1127 | | |
| |||
1202 | 1222 | | |
1203 | 1223 | | |
1204 | 1224 | | |
1205 | | - | |
| 1225 | + | |
1206 | 1226 | | |
1207 | 1227 | | |
1208 | 1228 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
537 | 537 | | |
538 | 538 | | |
539 | 539 | | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
547 | 547 | | |
548 | 548 | | |
549 | 549 | | |
| |||
587 | 587 | | |
588 | 588 | | |
589 | 589 | | |
590 | | - | |
| 590 | + | |
591 | 591 | | |
592 | 592 | | |
593 | 593 | | |
| |||
599 | 599 | | |
600 | 600 | | |
601 | 601 | | |
602 | | - | |
603 | | - | |
| 602 | + | |
| 603 | + | |
604 | 604 | | |
605 | 605 | | |
606 | 606 | | |
| |||
612 | 612 | | |
613 | 613 | | |
614 | 614 | | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
622 | 623 | | |
623 | 624 | | |
624 | 625 | | |
| |||
0 commit comments