File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 16
16
} ;
17
17
18
18
inherit ( hypervisorConfig ) command canShutdown shutdownCommand ;
19
+ supportsNotifySocket = hypervisorConfig . supportsNotifySocket or false ;
19
20
preStart = hypervisorConfig . preStart or microvmConfig . preStart ;
20
21
tapMultiQueue = hypervisorConfig . tapMultiQueue or false ;
21
22
@@ -56,7 +57,7 @@ pkgs.buildPackages.runCommand "microvm-${microvmConfig.hypervisor}-${microvmConf
56
57
# for `nix run`
57
58
meta . mainProgram = "microvm-run" ;
58
59
passthru = {
59
- inherit canShutdown ;
60
+ inherit canShutdown supportsNotifySocket ;
60
61
inherit ( microvmConfig ) hypervisor ;
61
62
} ;
62
63
} ''
Original file line number Diff line number Diff line change 88
88
# stumbling over a preexisting socket
89
89
rm -f '${ socket } '
90
90
'' }
91
+
92
+ # Start socat to forward systemd notify socket over vsock
93
+ if [ -n "$NOTIFY_SOCKET" ]; then
94
+ ${ pkgs . socat } /bin/socat UNIX-LISTEN:notify.vsock_8888,fork UNIX-SENDTO:$NOTIFY_SOCKET &
95
+ fi
91
96
'' + lib . optionalString graphics . enable ''
92
97
rm -f ${ graphics . socket }
93
98
${ pkgs . crosvm } /bin/crosvm device gpu \
100
105
done
101
106
'' ;
102
107
108
+ supportsNotifySocket = true ;
109
+
103
110
command =
104
111
if user != null
105
112
then throw "cloud-hypervisor will not change user"
118
125
"--cmdline" "console=ttyS0 reboot=t panic=-1 ${ toString microvmConfig . kernelParams } "
119
126
"--seccomp" "true"
120
127
"--memory" memOps
128
+ "--platform" "oem_strings=[io.systemd.credential:vmm.notify_socket=vsock-stream:2:8888]"
129
+ "--vsock" "cid=3,socket=notify.vsock"
121
130
]
122
131
++
123
132
lib . optionals graphics . enable [
Original file line number Diff line number Diff line change 235
235
# we also have to include a trigger here.
236
236
restartTriggers = [ guestConfig . system . build . toplevel ] ;
237
237
overrideStrategy = "asDropin" ;
238
+ serviceConfig . Type = lib . mkIf guestConfig . microvm . declaredRunner . supportsNotifySocket "notify" ;
238
239
} ;
239
240
"microvm-tap-interfaces@${ name } " = {
240
241
serviceConfig . X-RestartIfChanged = [ "" microvmConfig . restartIfChanged ] ;
446
447
Group = group ;
447
448
SyslogIdentifier = "microvm@%i" ;
448
449
LimitNOFILE = 1048576 ;
450
+ NotifyAccess = "all" ;
449
451
LimitMEMLOCK = "infinity" ;
450
452
} ;
451
453
} ;
You can’t perform that action at this time.
0 commit comments