[ARVADOS] created: 5ad1e2651824cd63304f254ec0cbddad9f081630

Git user git at public.curoverse.com
Tue Mar 15 18:10:23 EDT 2016


        at  5ad1e2651824cd63304f254ec0cbddad9f081630 (commit)


commit 5ad1e2651824cd63304f254ec0cbddad9f081630
Author: Brett Smith <brett at curoverse.com>
Date:   Tue Mar 15 17:59:16 2016 -0400

    8709: Docker cleaner cleans container volumes.
    
    This prevents a compute node's Docker partition from filling with
    scratch space volumes.

diff --git a/services/dockercleaner/arvados_docker/cleaner.py b/services/dockercleaner/arvados_docker/cleaner.py
index 719cc2a..88b8a4b 100755
--- a/services/dockercleaner/arvados_docker/cleaner.py
+++ b/services/dockercleaner/arvados_docker/cleaner.py
@@ -191,7 +191,7 @@ class DockerImageCleaner(DockerImageUseRecorder):
 
     def _remove_container(self, cid):
         try:
-            self.docker_client.remove_container(cid)
+            self.docker_client.remove_container(cid, v=True)
         except docker.errors.APIError as error:
             logger.warning("Failed to remove container %s: %s", cid, error)
         else:
diff --git a/services/dockercleaner/tests/test_cleaner.py b/services/dockercleaner/tests/test_cleaner.py
index 31a48b2..3cb172e 100644
--- a/services/dockercleaner/tests/test_cleaner.py
+++ b/services/dockercleaner/tests/test_cleaner.py
@@ -315,13 +315,19 @@ class DockerContainerCleanerTestCase(DockerImageUseRecorderTestCase):
     TEST_CLASS = cleaner.DockerImageCleaner
     TEST_CLASS_INIT_KWARGS = {'remove_containers_onexit': True}
 
+    def test_container_deletion_deletes_volumes(self):
+        cid = MockDockerId()
+        self.events.append(MockEvent('die', docker_id=cid))
+        self.recorder.run()
+        self.docker_client.remove_container.assert_called_with(cid, v=True)
+
     @mock.patch('arvados_docker.cleaner.logger')
     def test_failed_container_deletion_handling(self, mockLogger):
         cid = MockDockerId()
         self.docker_client.remove_container.side_effect = MockException(500)
         self.events.append(MockEvent('die', docker_id=cid))
         self.recorder.run()
-        self.docker_client.remove_container.assert_called_with(cid)
+        self.docker_client.remove_container.assert_called_with(cid, v=True)
         self.assertEqual("Failed to remove container %s: %s",
                          mockLogger.warning.call_args[0][0])
         self.assertEqual(cid,
@@ -413,13 +419,13 @@ class ContainerRemovalTestCase(unittest.TestCase):
     def test_remove_onexit(self):
         self.args.remove_stopped_containers = 'onexit'
         cleaner.run(self.args, self.docker_client)
-        self.docker_client.remove_container.assert_called_once_with(self.newCID)
+        self.docker_client.remove_container.assert_called_once_with(self.newCID, v=True)
 
     def test_remove_always(self):
         self.args.remove_stopped_containers = 'always'
         cleaner.run(self.args, self.docker_client)
-        self.docker_client.remove_container.assert_any_call(self.existingCID)
-        self.docker_client.remove_container.assert_any_call(self.newCID)
+        self.docker_client.remove_container.assert_any_call(self.existingCID, v=True)
+        self.docker_client.remove_container.assert_any_call(self.newCID, v=True)
         self.assertEqual(2, self.docker_client.remove_container.call_count)
 
     def test_remove_never(self):
@@ -439,5 +445,5 @@ class ContainerRemovalTestCase(unittest.TestCase):
             mock.call.events(since=mock.ANY),
             mock.call.containers(filters={'status':'exited'})])
         # Asked to delete the container twice?
-        self.docker_client.remove_container.assert_has_calls([mock.call(self.existingCID)] * 2)
+        self.docker_client.remove_container.assert_has_calls([mock.call(self.existingCID, v=True)] * 2)
         self.assertEqual(2, self.docker_client.remove_container.call_count)

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list