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:
parent
c49b7c901b
commit
7fa6ad468d
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user