mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-05 10:50:18 +00:00
Merge pull request #3824 from fidencio/stable-2.3-clh-stop-virtiofsd-if-clh-fails-to-boot-up-the-vm
stable-2.3 | clh: stop virtofsd if clh fails to boot up the vm
This commit is contained in:
@@ -405,15 +405,20 @@ func (clh *cloudHypervisor) StartVM(ctx context.Context, timeout int) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
clh.state.VirtiofsdPID = pid
|
clh.state.VirtiofsdPID = pid
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if err != nil {
|
||||||
|
if shutdownErr := clh.virtiofsd.Stop(ctx); shutdownErr != nil {
|
||||||
|
clh.Logger().WithError(shutdownErr).Warn("error shutting down VirtiofsDaemon")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
} else {
|
} else {
|
||||||
return errors.New("cloud-hypervisor only supports virtio based file sharing")
|
return errors.New("cloud-hypervisor only supports virtio based file sharing")
|
||||||
}
|
}
|
||||||
|
|
||||||
pid, err := clh.launchClh()
|
pid, err := clh.launchClh()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if shutdownErr := clh.virtiofsd.Stop(ctx); shutdownErr != nil {
|
|
||||||
clh.Logger().WithError(shutdownErr).Warn("error shutting down Virtiofsd")
|
|
||||||
}
|
|
||||||
return fmt.Errorf("failed to launch cloud-hypervisor: %q", err)
|
return fmt.Errorf("failed to launch cloud-hypervisor: %q", err)
|
||||||
}
|
}
|
||||||
clh.state.PID = pid
|
clh.state.PID = pid
|
||||||
|
Reference in New Issue
Block a user