From 9c86eb1d35d30dffd0becee8a6b9216851225de6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Rop=C3=A9?= Date: Wed, 12 Jun 2024 09:28:16 +0200 Subject: [PATCH] runtime: avoid panic on metrics gathering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While running with a remote hypervisor, whenever kata-monitor tries to access metrics from the shim, the shim does a "panic" and no metric can be gathered. The function GetVirtioFsPid() is called on metrics gathering, and had a call to "panic()". Since there is no virtiofs process for remote hypervisor, the right implementation is to return nil. The caller expects that, and will skip metrics gathering for virtiofs. Fixes: #9826 Signed-off-by: Julien Ropé --- src/runtime/virtcontainers/remote.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/virtcontainers/remote.go b/src/runtime/virtcontainers/remote.go index ba583a21db..0250566736 100644 --- a/src/runtime/virtcontainers/remote.go +++ b/src/runtime/virtcontainers/remote.go @@ -267,7 +267,7 @@ func (rh *remoteHypervisor) GetPids() []int { } func (rh *remoteHypervisor) GetVirtioFsPid() *int { - panic(notImplemented("GetVirtioFsPid")) + return nil } func (rh *remoteHypervisor) fromGrpc(ctx context.Context, hypervisorConfig *HypervisorConfig, j []byte) error {