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

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

This commit is contained in:
Ruben S. Montero 2022-05-10 18:51:11 +02:00 committed by GitHub
parent c49b7c901b
commit 7fa6ad468d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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