[ovirt] fix waiting for VM to be stopped

The vm.stopped? method on ovirt was not behaving correctly, as it was
returning `true` also when the state was `powering_down`.

I've noticed this when fixing reboot, that also need to wait for vm
to be stopped, and even when adding `stopped?`, it was still failing
with:

[Operation Failed: [Cannot run VM because the VM is in Powering Down
status.]
This commit is contained in:
Ivan Nečas 2017-03-31 16:32:58 +02:00
parent 43b06a0130
commit 84a126f14f
1 changed files with 5 additions and 2 deletions

View File

@ -44,7 +44,7 @@ module Fog
end end
def stopped? def stopped?
!!(status =~ /down/i) status.downcase == 'down'
end end
def mac def mac
@ -134,7 +134,10 @@ module Fog
end end
def reboot(options = {}) def reboot(options = {})
stop unless stopped? unless stopped?
stop
wait_for { stopped? }
end
start options.merge(:blocking => true) start options.merge(:blocking => true)
end end