suspending a paused instance

Bug #1276154 reported by Loganathan Parthipan
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Opinion
Wishlist
Loganathan Parthipan

Bug Description

Is there a compelling reason why we don't support suspending a paused instance? At the moment we only allow 'active' and 'rescued' states to be suspended.

In compute/api:

@check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.RESCUED])

Trying to suspend a paused instance results in:

nova suspend b10f8175-1663-41b2-8533-0b0606f369ff
ERROR: Cannot 'suspend' while instance is in vm_state paused (HTTP 409) (Request-ID: req-7349d554-ff48-4155-a62b-967f0813c59c)

I haven't tested with other hypervisors, but as far as libvirt/kvm is concerned it suspends (virsh managedsave) both states ('running', 'paused') and resumes (virsh start) a suspended instance to the pre-suspended state.

A use-case for this is to be able to quickly pause a bunch of instances for security reasons and then suspend one of them conveniently using the API rather than virsh. Taking a suspicious vm to ‘active’ state so that it can be suspended doesn’t seem like a good idea.

description: updated
description: updated
description: updated
Revision history for this message
John Garbutt (johngarbutt) wrote :

Seems like a reasonable relaxation of the state checking in the compute manager.

It would be good to see if this causes issues on other hypervisors, I guess not.

tags: added: compute libvirt
Changed in nova:
status: New → Triaged
importance: Undecided → Wishlist
Changed in nova:
assignee: nobody → Loganathan Parthipan (parthipan)
Revision history for this message
Loganathan Parthipan (parthipan) wrote :

Also as part of this we should make sure that on resume nova sets vm_state to the correct state based on the power_state. Right now it assumes a successful resume to result in ACTIVE. But if it was suspended from PAUSED, at least as far as libvirt/kvm is concerned it will come back to 'paused' instead of 'running'. So we might need to do something like

+++ b/nova/compute/manager.py

         instance.power_state = self._get_power_state(context, instance)
- instance.vm_state = vm_states.ACTIVE
+
+ if instance.power_state == power_state.PAUSED:
+ instance.vm_state = vm_states.PAUSED
+ else:
+ instance.vm_state = vm_states.ACTIVE
         instance.task_state = None

Sean Dague (sdague)
Changed in nova:
status: Triaged → Opinion
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.