1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

M #-: Set provision to DELETING (#2029)

(cherry picked from commit 7fa6ad468db9c53eda86dc1ba95df5b700dfd8ed)
This commit is contained in:
Ruben S. Montero 2022-05-10 18:51:11 +02:00
parent 1de3f59297
commit 77f56b70e3
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

View File

@ -585,26 +585,23 @@ module OneProvision
def delete(cleanup, timeout, force = false)
exist = true
unless force
if running_vms? && !cleanup
Utils.fail('Provision with running VMs can\'t be deleted')
end
if !force && !cleanup && running_vms?
Utils.fail('Provision with running VMs can\'t be deleted')
end
if images? && !cleanup
Utils.fail('Provision with images can\'t be deleted')
end
self.state = STATE['DELETING']
update
delete_vms(timeout) if cleanup
delete_images(timeout) if cleanup
if !force && !cleanup && images?
Utils.fail('Provision with images can\'t be deleted')
end
self.state = STATE['DELETING']
update
if !force && cleanup
delete_vms(timeout)
delete_images(timeout)
end
OneProvisionLogger.info("Deleting provision #{self['ID']}")
if hosts && !hosts.empty? && tf_state && tf_conf