mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 16:27:50 +00:00
clh: Enforce API timeout only for vm.boot request
launchClh already has a timeout of 10seconds for launching clh, e.g. if launchClh or setupVirtiofsDaemon takes a few seconds the context's deadline will already be expired by the time it reaches bootVM Fixes #6240 Signed-off-by: Alexandru Matei <alexandru.matei@uipath.com>
This commit is contained in:
parent
c282a1c709
commit
ac64b021a6
@ -652,9 +652,6 @@ func (clh *cloudHypervisor) StartVM(ctx context.Context, timeout int) error {
|
|||||||
span, _ := katatrace.Trace(ctx, clh.Logger(), "StartVM", clhTracingTags, map[string]string{"sandbox_id": clh.id})
|
span, _ := katatrace.Trace(ctx, clh.Logger(), "StartVM", clhTracingTags, map[string]string{"sandbox_id": clh.id})
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), clh.getClhAPITimeout()*time.Second)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
clh.Logger().WithField("function", "StartVM").Info("starting Sandbox")
|
clh.Logger().WithField("function", "StartVM").Info("starting Sandbox")
|
||||||
|
|
||||||
vmPath := filepath.Join(clh.config.VMStorePath, clh.id)
|
vmPath := filepath.Join(clh.config.VMStorePath, clh.id)
|
||||||
@ -693,6 +690,9 @@ func (clh *cloudHypervisor) StartVM(ctx context.Context, timeout int) error {
|
|||||||
}
|
}
|
||||||
clh.state.PID = pid
|
clh.state.PID = pid
|
||||||
|
|
||||||
|
ctx, cancel := context.WithTimeout(ctx, clh.getClhAPITimeout()*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
if err := clh.bootVM(ctx); err != nil {
|
if err := clh.bootVM(ctx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user