mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-09 05:27:20 +09:00
M #-: Set provision to DELETING (#2029)
This commit is contained in:
1 parent
c49b7c901b
commit
7fa6ad468d
1 file changed
+12
-15
@@ -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
|
||||
|
||||
Reference in new issue
Block a user