Merge pull request #11359 from pawelbeza/fix-logs-on-virtiofs-shutdown

Fix logging on virtiofs shutdown
This commit is contained in:
Xuewei Niu 2025-06-16 17:06:29 +08:00 committed by GitHub
commit 9b4518f742
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -729,7 +729,11 @@ func (clh *cloudHypervisor) StartVM(ctx context.Context, timeout int) error {
return err return err
} }
defer func() { 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 { if shutdownErr := clh.stopVirtiofsDaemon(ctx); shutdownErr != nil {
clh.Logger().WithError(shutdownErr).Warn("error shutting down VirtiofsDaemon") clh.Logger().WithError(shutdownErr).Warn("error shutting down VirtiofsDaemon")
} }
@ -1306,10 +1310,12 @@ func (clh *cloudHypervisor) terminate(ctx context.Context, waitOnly bool) (err e
return err 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 { if err = clh.stopVirtiofsDaemon(ctx); err != nil {
clh.Logger().WithError(err).Error("failed to stop virtiofsDaemon") clh.Logger().WithError(err).Error("failed to stop virtiofsDaemon")
}
} }
return return