runtime: Fix logging on virtiofs shutdown

Fixes a confusing log message shown when Virtio-FS is disabled.
Previously we logged “The virtiofsd had stopped” regardless of whether Virtio-FS was actually enabled or not.

Signed-off-by: Paweł Bęza <pawel.beza99@gmail.com>
This commit is contained in:
Paweł Bęza
2025-06-03 13:18:26 +02:00
parent dc0da567cd
commit 91db41227f

View File

@@ -726,7 +726,11 @@ func (clh *cloudHypervisor) StartVM(ctx context.Context, timeout int) error {
return err
}
defer func() {
if err != nil {
if err == nil {
return
}
if clh.config.SharedFS == config.VirtioFS || clh.config.SharedFS == config.VirtioFSNydus {
if shutdownErr := clh.stopVirtiofsDaemon(ctx); shutdownErr != nil {
clh.Logger().WithError(shutdownErr).Warn("error shutting down VirtiofsDaemon")
}
@@ -1303,10 +1307,12 @@ func (clh *cloudHypervisor) terminate(ctx context.Context, waitOnly bool) (err e
return err
}
clh.Logger().Debug("stop virtiofsDaemon")
if clh.config.SharedFS == config.VirtioFS || clh.config.SharedFS == config.VirtioFSNydus {
clh.Logger().Debug("stop virtiofsDaemon")
if err = clh.stopVirtiofsDaemon(ctx); err != nil {
clh.Logger().WithError(err).Error("failed to stop virtiofsDaemon")
if err = clh.stopVirtiofsDaemon(ctx); err != nil {
clh.Logger().WithError(err).Error("failed to stop virtiofsDaemon")
}
}
return