mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-06 19:30:24 +00:00
runtime/vc: runPrestartHooks should ignore GetHypervisorPid failure
If we are running FC hypervisor, it is not started when prestart hooks are executed. So we should just ignore such error and just go ahead and run the hooks. Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
@@ -1322,13 +1322,12 @@ func (s *Sandbox) cleanSwap(ctx context.Context) {
|
||||
}
|
||||
|
||||
func (s *Sandbox) runPrestartHooks(ctx context.Context, prestartHookFunc func(context.Context) error) error {
|
||||
hid, err := s.GetHypervisorPid()
|
||||
if err != nil {
|
||||
s.Logger().Errorf("fail to get hypervisor pid for sandbox %s", s.id)
|
||||
return err
|
||||
hid, _ := s.GetHypervisorPid()
|
||||
// Ignore errors here as hypervisor might not have been started yet, likely in FC case.
|
||||
if hid > 0 {
|
||||
s.Logger().Infof("sandbox %s hypervisor pid is %v", s.id, hid)
|
||||
ctx = context.WithValue(ctx, HypervisorPidKey{}, hid)
|
||||
}
|
||||
s.Logger().Infof("sandbox %s hypervisor pid is %v", s.id, hid)
|
||||
ctx = context.WithValue(ctx, HypervisorPidKey{}, hid)
|
||||
|
||||
if err := prestartHookFunc(ctx); err != nil {
|
||||
s.Logger().Errorf("fail to run prestartHook for sandbox %s: %s", s.id, err)
|
||||
|
Reference in New Issue
Block a user