mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 16:27:50 +00:00
vc: Remove unnecessary call to kill
Fixes #2207 Signed-off-by: Ted Yu <yuzhihong@gmail.com>
This commit is contained in:
parent
c0d2867a0e
commit
618666ed8c
@ -513,15 +513,11 @@ func (a *Acrn) stopSandbox() (err error) {
|
||||
|
||||
pid := a.state.PID
|
||||
|
||||
// Check if VM process is running, in case it is not, let's
|
||||
// return from here.
|
||||
if err = syscall.Kill(pid, syscall.Signal(0)); err != nil {
|
||||
a.Logger().Info("acrn VM already stopped")
|
||||
return nil
|
||||
}
|
||||
|
||||
// Send signal to the VM process to try to stop it properly
|
||||
if err = syscall.Kill(pid, syscall.SIGINT); err != nil {
|
||||
if err == syscall.ESRCH {
|
||||
return nil
|
||||
}
|
||||
a.Logger().Info("Sending signal to stop acrn VM failed")
|
||||
return err
|
||||
}
|
||||
|
@ -467,14 +467,11 @@ func (fc *firecracker) fcEnd() (err error) {
|
||||
|
||||
pid := fc.info.PID
|
||||
|
||||
// Check if VM process is running, in case it is not, let's
|
||||
// return from here.
|
||||
if err = syscall.Kill(pid, syscall.Signal(0)); err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Send a SIGTERM to the VM process to try to stop it properly
|
||||
if err = syscall.Kill(pid, syscall.SIGTERM); err != nil {
|
||||
if err == syscall.ESRCH {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user