From 0ce1a36a0e64d7dc1a43bfee4974ab860d18a6cb Mon Sep 17 00:00:00 2001 From: Craig Jellick Date: Wed, 13 Jan 2016 12:34:37 -0700 Subject: [PATCH] Revert "Dont delete volumes when deleting container" This reverts commit 80001ccfe3beace65c1874c01278bffdb7b30de9. --- cattle/agent/handler.py | 2 ++ cattle/plugins/docker/storage.py | 7 +++---- cattle/plugins/docker/util.py | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cattle/agent/handler.py b/cattle/agent/handler.py index 7fc326c..62810cf 100644 --- a/cattle/agent/handler.py +++ b/cattle/agent/handler.py @@ -105,6 +105,8 @@ def _get_handler_category(self, req): class KindBasedMixin(object): CHECK_PATHS = [ ["imageStoragePoolMap", "storagePool", "kind"], + ["volumeStoragePoolMap", "storagePool", "kind"], + ["snapshotStoragePoolMap", "storagePool", "kind"], ["instanceHostMap", "host", "kind"], ["instanceForceStop", "kind"], ["instanceInspect", "kind"], diff --git a/cattle/plugins/docker/storage.py b/cattle/plugins/docker/storage.py index 05c9503..4fb50a7 100644 --- a/cattle/plugins/docker/storage.py +++ b/cattle/plugins/docker/storage.py @@ -5,6 +5,7 @@ from contextlib import closing from cattle.type_manager import get_type, MARSHALLER from cattle.storage import BaseStoragePool +from cattle.agent.handler import KindBasedMixin from cattle.plugins.docker.util import is_no_op, remove_container from cattle.lock import lock from cattle.progress import Progress @@ -15,8 +16,9 @@ log = logging.getLogger('docker') -class DockerPool(BaseStoragePool): +class DockerPool(KindBasedMixin, BaseStoragePool): def __init__(self): + KindBasedMixin.__init__(self, kind='docker') BaseStoragePool.__init__(self) @staticmethod @@ -292,9 +294,6 @@ def volume_remove(self, req=None, volumeStoragePoolMap=None, **kw): data = self._get_response_data(req, volumeStoragePoolMap) return self._reply(req, data) - def _check_supports(self, req): - return True - class ImageValidationError(Exception): pass diff --git a/cattle/plugins/docker/util.py b/cattle/plugins/docker/util.py index 990cd2e..a0a21b8 100644 --- a/cattle/plugins/docker/util.py +++ b/cattle/plugins/docker/util.py @@ -64,7 +64,7 @@ def is_no_op(resource): def remove_container(client, container): try: - client.remove_container(container, force=True) + client.remove_container(container, force=True, v=True) except APIError as e: try: if e.response.status_code != 404: