File tree Expand file tree Collapse file tree 3 files changed +77
-1
lines changed
Expand file tree Collapse file tree 3 files changed +77
-1
lines changed Original file line number Diff line number Diff line change 9999 crosvm-example
100100 kvmtool-example
101101 stratovirt-example
102- # alioth-example
102+ alioth-example
103+ openvmm-example
103104 virtiofsd
104105 ] ;
105106 pathsToLink = [ "/" ] ;
159160 "qemu"
160161 # currently broken:
161162 # "crosvm"
163+ # not implemented:
164+ # "openvmm"
162165 ] ;
163166 hypervisorsWithUserNet = [ "qemu" "kvmtool" ] ;
164167 makeExample = { system , hypervisor , config ? { } } :
Original file line number Diff line number Diff line change 88 "kvmtool"
99 "stratovirt"
1010 "alioth"
11+ "openvmm"
1112 ] ;
1213
1314 hypervisorsWithNetwork = hypervisors ;
Original file line number Diff line number Diff line change 1+ { pkgs
2+ , microvmConfig
3+ , macvtapFds
4+ } :
5+
6+ let
7+ inherit ( pkgs ) lib ;
8+ inherit ( microvmConfig )
9+ user
10+ vcpu mem interfaces volumes shares devices vsock
11+ kernel initrdPath
12+ storeDisk storeOnDisk ;
13+ in {
14+ command =
15+ if user != null
16+ then throw "openvmm will not change user"
17+ else builtins . concatStringsSep " " (
18+ [
19+ "${ pkgs . openvmm } /bin/openvmm"
20+ "-m" "${ toString mem } M"
21+ "-p" ( toString vcpu )
22+ "-k" ( lib . escapeShellArg "${ kernel . dev } /vmlinux" )
23+ "-r" initrdPath
24+ "-c" ( lib . escapeShellArg "console=ttyS0 reboot=k panic=1 verbose ${ toString microvmConfig . kernelParams } " )
25+ # "--vmbus-redirect"
26+ "--hv"
27+ # "--virtio-console"
28+ "--virtio-serial" "stderr"
29+ "--guest-watchdog"
30+ ]
31+ ++
32+ lib . optionals storeOnDisk [
33+ "--disk" ( lib . escapeShellArg "file:${ storeDisk } ,ro" )
34+ ]
35+ ++
36+ builtins . concatMap ( { image , ... } :
37+ [ "--disk" ( lib . escapeShellArg "file:${ image } ,uh" ) ]
38+ ) volumes
39+ ++
40+ builtins . concatMap ( { proto , source , tag , ... } :
41+ {
42+ virtiofs = [
43+ "--virtio-fs" ( lib . escapeShellArg "${ tag } :${ source } " )
44+ ] ;
45+ "9p" = [
46+ "--virtio-9p" ( lib . escapeShellArg "${ tag } :${ source } " )
47+ ] ;
48+ } . ${ proto }
49+ ) shares
50+ ++
51+ builtins . concatMap ( { type , id , mac , ... } :
52+ if type == "tap"
53+ then [
54+ "--virtio-net" "tap"
55+ ]
56+ # TODO: --nic
57+ else throw "interface type ${ type } is not supported by openvmm"
58+ ) interfaces
59+ ++
60+ map ( { ... } :
61+ throw "PCI/USB passthrough is not supported on openvmm"
62+ ) devices
63+ ++ (
64+ if vsock . cid != null
65+ then throw "Host-native AF_VSOCK is not supported by openvmm"
66+ else [ ]
67+ )
68+ ) ;
69+
70+ # TODO:
71+ canShutdown = false ;
72+ }
You can’t perform that action at this time.
0 commit comments