guest: Wait for a file of gRPC port number getting ready
Some debian services, such as forwarder_guest_launcher and
shutdown_runner, read a gRPC number from a file provided
via virtiofs.
However, since virtiofs and the port number's setup takes some time,
the file soetimes is not ready when systemd tries to start these
daemons. As a result, these daemons could fail to be started
especially at the VM's first boot after installation.
This CL adds a logic to wait for the file getting ready.
Bug: none
Test: Start a VM and check journalctl to ensure the daemons didn't
fail to start.
Change-Id: If5df480815da3ad18f3e412dcabe06e4e7f804ea
diff --git a/guest/shutdown_runner/debian/service b/guest/shutdown_runner/debian/service
index 2668930..a5249d0 100644
--- a/guest/shutdown_runner/debian/service
+++ b/guest/shutdown_runner/debian/service
@@ -4,7 +4,7 @@
After=virtiofs_internal.service
[Service]
-ExecStart=/usr/bin/bash -c '/usr/bin/shutdown_runner --grpc_port $(cat /mnt/internal/debian_service_port)'
+ExecStart=/usr/bin/bash -c '/usr/bin/shutdown_runner --grpc-port-file /mnt/internal/debian_service_port'
Type=simple
Restart=on-failure
RestartSec=1