virtcontainers: Do not rollback by deleting container or pod

In case a consumer of virtcontainers tries to start/stop a container,
or stop a pod, and for some reasons, this fails, virtcontainers always
tries to delete everything related to the container or the pod before
it returns the error.

The caller of the runtime is the one responsible for cleaning things
up if something goes wrong, that's why this cleanup call is never
needed.

A real example of that is the case of cc-runtime and CRI-O, where this
cleanup prevented CRI-O from retrieving proper state of the container
after the failure, leading to the inability to stop and remove the
container and the VM afterwards.

Fixes #87

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2018-03-28 16:53:31 -07:00
parent c4f922dc2c
commit 5a57b52c64

View File

@@ -164,7 +164,6 @@ func StopPod(podID string) (VCPod, error) {
// Stop it. // Stop it.
err = p.stop() err = p.stop()
if err != nil { if err != nil {
p.delete()
return nil, err return nil, err
} }
@@ -406,7 +405,6 @@ func StartContainer(podID, containerID string) (VCContainer, error) {
// Start it. // Start it.
err = c.start() err = c.start()
if err != nil { if err != nil {
c.delete()
return nil, err return nil, err
} }
@@ -444,7 +442,6 @@ func StopContainer(podID, containerID string) (VCContainer, error) {
// Stop it. // Stop it.
err = c.stop() err = c.stop()
if err != nil { if err != nil {
c.delete()
return nil, err return nil, err
} }