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.
This commit is contained in:
maorlipchuk 2017-10-01 12:13:19 +03:00 committed by ansibot
parent d0d1c7d249
commit 0f39536c5c

View file

@ -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)