From 23a5dc7ff809d7ce3538ded8cca040055174c961 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Wed, 21 Aug 2019 10:52:19 +0100 Subject: [PATCH] virtiofsd: use virtiofsd --syslog Log to syslog instead of stderr. This way all Kata and virtiofsd logs are captured in syslog (or the systemd journal). This makes debugging much easier. Signed-off-by: Stefan Hajnoczi --- virtcontainers/qemu.go | 3 ++- virtcontainers/qemu_test.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/virtcontainers/qemu.go b/virtcontainers/qemu.go index 47dd22e6cf..7500c0ae6e 100644 --- a/virtcontainers/qemu.go +++ b/virtcontainers/qemu.go @@ -611,7 +611,8 @@ func (q *qemu) virtiofsdArgs(fd uintptr) []string { args := []string{ fmt.Sprintf("--fd=%v", fd), "-o", "source=" + sourcePath, - "-o", "cache=" + q.config.VirtioFSCache} + "-o", "cache=" + q.config.VirtioFSCache, + "--syslog"} if q.config.Debug { args = append(args, "-d") } else { diff --git a/virtcontainers/qemu_test.go b/virtcontainers/qemu_test.go index 72dcace956..7a4a7b6f53 100644 --- a/virtcontainers/qemu_test.go +++ b/virtcontainers/qemu_test.go @@ -502,12 +502,12 @@ func TestQemuVirtiofsdArgs(t *testing.T) { kataHostSharedDir = savedKataHostSharedDir }() - result := "--fd=123 -o source=test-share-dir/foo -o cache=none -d" + result := "--fd=123 -o source=test-share-dir/foo -o cache=none --syslog -d" args := q.virtiofsdArgs(123) assert.Equal(strings.Join(args, " "), result) q.config.Debug = false - result = "--fd=123 -o source=test-share-dir/foo -o cache=none -f" + result = "--fd=123 -o source=test-share-dir/foo -o cache=none --syslog -f" args = q.virtiofsdArgs(123) assert.Equal(strings.Join(args, " "), result) }