container_delete should call docker.remove_container
Change-Id: Ied3f4817c8698af6931cd03f102804d35dc1f409
This commit is contained in:
@@ -401,6 +401,7 @@ class ContainersController(rest.RestController):
|
|||||||
if self.from_containers:
|
if self.from_containers:
|
||||||
raise exception.OperationNotPermitted
|
raise exception.OperationNotPermitted
|
||||||
|
|
||||||
|
backend_api.container_delete(container_uuid)
|
||||||
rpc_container = objects.Container.get_by_uuid(pecan.request.context,
|
rpc_container = objects.Container.get_by_uuid(pecan.request.context,
|
||||||
container_uuid)
|
container_uuid)
|
||||||
rpc_container.destroy()
|
rpc_container.destroy()
|
||||||
|
@@ -148,7 +148,7 @@ class Handler(object):
|
|||||||
def container_delete(self, ctxt, container_uuid):
|
def container_delete(self, ctxt, container_uuid):
|
||||||
LOG.debug("container_delete %s" % container_uuid)
|
LOG.debug("container_delete %s" % container_uuid)
|
||||||
docker_id = self._find_container_by_name(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):
|
def container_show(self, ctxt, container_uuid):
|
||||||
LOG.debug("container_show %s" % container_uuid)
|
LOG.debug("container_show %s" % container_uuid)
|
||||||
|
@@ -16,6 +16,7 @@ from mock import patch
|
|||||||
|
|
||||||
class TestContainerController(db_base.DbTestCase):
|
class TestContainerController(db_base.DbTestCase):
|
||||||
@patch('magnum.conductor.api.API.container_create')
|
@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_start')
|
||||||
@patch('magnum.conductor.api.API.container_stop')
|
@patch('magnum.conductor.api.API.container_stop')
|
||||||
@patch('magnum.conductor.api.API.container_pause')
|
@patch('magnum.conductor.api.API.container_pause')
|
||||||
@@ -31,6 +32,7 @@ class TestContainerController(db_base.DbTestCase):
|
|||||||
mock_container_pause,
|
mock_container_pause,
|
||||||
mock_container_stop,
|
mock_container_stop,
|
||||||
mock_container_start,
|
mock_container_start,
|
||||||
|
mock_container_delete,
|
||||||
mock_container_create):
|
mock_container_create):
|
||||||
mock_container_create.side_effect = lambda x, y, z: z
|
mock_container_create.side_effect = lambda x, y, z: z
|
||||||
mock_container_start.return_value = None
|
mock_container_start.return_value = None
|
||||||
|
Reference in New Issue
Block a user