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
}
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")
}
@ -1306,11 +1310,13 @@ func (clh *cloudHypervisor) terminate(ctx context.Context, waitOnly bool) (err e
return err
}
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")
}
}
return
}