Bug #21313
open[oVirt][ComputeResources][BCM] Foreman fail to perform power cycle action for stateless VM hosted in oVirt
Description
When performing power cycle action on host which is:
- hosted on oVirt 4.1
- stateless
- managed via ComputeResources
The action fails on following message "Cannot run VM because the VM is in Powering Down status."
Steps to reproduce:
- create vm in oVirt
- make sure that it has stateless attribute set
- associate with host in foreman
- perform power-cycle action
Expected result: host gets down / up
Current result: "Cannot run VM because the VM is in Powering Down status."
I attached client and server side logs.
I think that it fails because stateless VM goes through one additional status (RestoringState) when it performs rollback to stateless snapshot.
PoweringDown -> RestoringState -> Down
Files
Updated by Ivan Necas over 7 years ago
After applying the patches from #19113, we got rid of Cannot run VM because the VM is in Powering Down status.
, but we are getting
2017-10-26 17:29:21 [app] [W] Failed to reboot system-ge-host-9.rhev.lab.eng.brq.redhat.com. | OVIRT::OvirtException: Cannot run VM. The VM is performing an operation on a Snapshot. Please wait for the operation to finish, and try again. | /opt/theforeman/tfm/root/usr/share/gems/gems/rbovirt-0.1.2/lib/rbovirt.rb:216:in `handle_fault' | /opt/theforeman/tfm/root/usr/share/gems/gems/rbovirt-0.1.2/lib/rbovirt.rb:135:in `rescue in http_post' | /opt/theforeman/tfm/root/usr/share/gems/gems/rbovirt-0.1.2/lib/rbovirt.rb:132:in `http_post' | /opt/theforeman/tfm/root/usr/share/gems/gems/rbovirt-0.1.2/lib/client/vm_api.rb:142:in `vm_action' | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-1.38.0/lib/fog/ovirt/requests/compute/vm_action.rb:9:in `vm_action' | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-1.38.0/lib/fog/ovirt/models/compute/server.rb:117:in `start' | /opt/theforeman/tfm/root/usr/share/gems/gems/fog-1.38.0/lib/fog/ovirt/models/compute/server.rb:140:in `reboot' | /usr/share/foreman/app/models/concerns/fog_extensions/ovirt/server.rb:37:in `reset' | /usr/share/foreman/app/services/power_manager/virt.rb:31:in `default_action' | /usr/share/foreman/app/services/power_manager/base.rb:19:in `block (2 levels) in <class:Base>' | /usr/share/foreman/app/controllers/hosts_controller.rb:213:in `setBuild' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/implicit_render.rb:4:in `send_action' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/abstract_controller/base.rb:198:in `process_action' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_controller/metal/rendering.rb:10:in `process_action' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/abstract_controller/callbacks.rb:20:in `block in process_action' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:117:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:117:in `call' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile' | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in `call'
Unfortunately, we can't tell the VM readyness state from the status (vm.status is still down), but the associated snapshot is
in Locked state. I guess we would need to list the snapshots for the VM and check, if any of the snaphots is locked.