Merge pull request #9153 from microsoft/danmihai1/clh-bootVM-timeout

runtime: clh: minimum 10s timeout for CreateVM + BootVM
This commit is contained in:
Dan Mihai 2024-02-27 09:58:01 -08:00 committed by GitHub
commit 352e2af5f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -75,6 +75,9 @@ const (
clhTimeout = 10
clhAPITimeout = 1
clhAPITimeoutConfidentialGuest = 20
// Minimum timout for calling CreateVM followed by BootVM. Executing these two APIs
// might take longer than the value returned by getClhAPITimeout().
clhCreateAndBootVMMinimumTimeout = 10
// Timeout for hot-plug - hotplug devices can take more time, than usual API calls
// Use longer time timeout for it.
clhHotPlugAPITimeout = 5
@ -711,7 +714,11 @@ func (clh *cloudHypervisor) StartVM(ctx context.Context, timeout int) error {
}
clh.state.PID = pid
ctx, cancel := context.WithTimeout(ctx, clh.getClhAPITimeout()*time.Second)
bootTimeout := clh.getClhAPITimeout()
if bootTimeout < clhCreateAndBootVMMinimumTimeout {
bootTimeout = clhCreateAndBootVMMinimumTimeout
}
ctx, cancel := context.WithTimeout(ctx, bootTimeout*time.Second)
defer cancel()
if err := clh.bootVM(ctx); err != nil {