From 6c6da8f86ee345ff681d33cbebea772d94ecbbd6 Mon Sep 17 00:00:00 2001 From: Nils Pascal Illenseer Date: Fri, 9 Sep 2016 14:57:36 +0200 Subject: [PATCH] Delete lxd container in state stopped (#2885) If a lxd container is stopped, do not stop it before deleting it. --- cloud/lxd/lxd_container.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cloud/lxd/lxd_container.py b/cloud/lxd/lxd_container.py index c28a6234e22..a92cdd7ce7e 100644 --- a/cloud/lxd/lxd_container.py +++ b/cloud/lxd/lxd_container.py @@ -364,7 +364,7 @@ class LXDContainerManagement(object): self.actions.append('restart') def _delete_container(self): - return self.client.do('DELETE', '/1.0/containers/{0}'.format(self.name)) + self.client.do('DELETE', '/1.0/containers/{0}'.format(self.name)) self.actions.append('delete') def _freeze_container(self): @@ -446,7 +446,8 @@ class LXDContainerManagement(object): if self.old_state != 'absent': if self.old_state == 'frozen': self._unfreeze_container() - self._stop_container() + if self.old_state != 'stopped': + self._stop_container() self._delete_container() def _frozen(self):