runtime: log vm start error before cleanup

Return of proper error to the initiator is not guaranteed.
Method StopVM could kill shim process together with VM pieces.

Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
This commit is contained in:
Konstantin Khlebnikov
2024-07-25 12:04:52 +02:00
parent ad5749fd6b
commit ee50582848

View File

@@ -1458,6 +1458,8 @@ func (s *Sandbox) startVM(ctx context.Context, prestartHookFunc func(context.Con
defer func() {
if err != nil {
// Log error, otherwise nobody might see it - StopVM could kill this process.
s.Logger().WithError(err).Error("Cannot start VM")
s.hypervisor.StopVM(ctx, false)
}
}()