mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-05-03 14:07:24 +00:00
clh: return faster with dead clh process from isClhRunning
Through proactively checking if Cloud Hypervisor process is dead, this patch provides a faster path for isClhRunning Fixes: #5623 Signed-off-by: Alexandru Matei <alexandru.matei@uipath.com>
This commit is contained in:
parent
9ef68e0c7a
commit
0e3ac66e76
@ -1405,16 +1405,16 @@ func (clh *cloudHypervisor) isClhRunning(timeout uint) (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
if err := syscall.Kill(pid, syscall.Signal(0)); err != nil {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
timeStart := time.Now()
|
||||
cl := clh.client()
|
||||
for {
|
||||
err := syscall.Kill(pid, syscall.Signal(0))
|
||||
if err != nil {
|
||||
return false, nil
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), clh.getClhAPITimeout()*time.Second)
|
||||
defer cancel()
|
||||
_, _, err := cl.VmmPingGet(ctx)
|
||||
_, _, err = cl.VmmPingGet(ctx)
|
||||
cancel()
|
||||
if err == nil {
|
||||
return true, nil
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user