container_delete should call docker.remove_container

Change-Id: Ied3f4817c8698af6931cd03f102804d35dc1f409
This commit is contained in:
Davanum Srinivas
2014-12-29 14:54:31 -05:00
parent 6e7ad023e4
commit 9081425fda
3 changed files with 4 additions and 1 deletions

View File

@@ -401,6 +401,7 @@ class ContainersController(rest.RestController):
if self.from_containers:
raise exception.OperationNotPermitted
backend_api.container_delete(container_uuid)
rpc_container = objects.Container.get_by_uuid(pecan.request.context,
container_uuid)
rpc_container.destroy()

View File

@@ -148,7 +148,7 @@ class Handler(object):
def container_delete(self, ctxt, container_uuid):
LOG.debug("container_delete %s" % container_uuid)
docker_id = self._find_container_by_name(container_uuid)
return self.docker.stop(docker_id)
return self.docker.remove_container(docker_id)
def container_show(self, ctxt, container_uuid):
LOG.debug("container_show %s" % container_uuid)

View File

@@ -16,6 +16,7 @@ from mock import patch
class TestContainerController(db_base.DbTestCase):
@patch('magnum.conductor.api.API.container_create')
@patch('magnum.conductor.api.API.container_delete')
@patch('magnum.conductor.api.API.container_start')
@patch('magnum.conductor.api.API.container_stop')
@patch('magnum.conductor.api.API.container_pause')
@@ -31,6 +32,7 @@ class TestContainerController(db_base.DbTestCase):
mock_container_pause,
mock_container_stop,
mock_container_start,
mock_container_delete,
mock_container_create):
mock_container_create.side_effect = lambda x, y, z: z
mock_container_start.return_value = None