From 0f39536c5cd49af4564badaa2948569c7e36eb46 Mon Sep 17 00:00:00 2001 From: maorlipchuk Date: Sun, 1 Oct 2017 12:13:19 +0300 Subject: [PATCH] Avoid calling maintenace or detach on destroy storage domain. (#28962) As part of the absent state of ovirt_storage_domains module, the pre_remove method tries to move the stoage domain to maintenance and detach it. In case a destroy of a storage domain is being called there is no need for those operations since the destroy might be merely a DB operation. --- lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py b/lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py index 59043ffee93..134208e0f86 100644 --- a/lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py +++ b/lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py @@ -383,6 +383,10 @@ class StorageDomainModule(BaseModule): ) def pre_remove(self, storage_domain): + # In case the user chose to destroy the storage domain there is no need to + # move it to maintenance or detach it, it should simply be removed from the DB. + if self._module.params['destroy']: + return # Before removing storage domain we need to put it into maintenance state: self._maintenance(storage_domain)