From 793a22083c661f4541b71fcf1269538353f731a8 Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Wed, 4 Jul 2018 13:43:05 +0100 Subject: [PATCH] qemu: Pass sandboxID to agent for logging purposes Add a kernel command-line option that the agent can read to determine the sandbox ID of the VM. It can use this to create a `sandbox=` log field for improved log analysis. Fixes #465. Signed-off-by: James O. D. Hunt --- virtcontainers/qemu.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/virtcontainers/qemu.go b/virtcontainers/qemu.go index 882294ad39..add05ad5db 100644 --- a/virtcontainers/qemu.go +++ b/virtcontainers/qemu.go @@ -297,10 +297,14 @@ func (q *qemu) createSandbox(sandboxConfig SandboxConfig) error { return err } + // Pass the sandbox name to the agent via the kernel command-line to + // allow the agent to use it in log messages. + params := q.kernelParameters() + " " + "agent.sandbox=" + sandboxConfig.ID + kernel := govmmQemu.Kernel{ Path: kernelPath, InitrdPath: initrdPath, - Params: q.kernelParameters(), + Params: params, } rtc := govmmQemu.RTC{