Add ability to create live snapshot for VMs

Registered by Anton Antonov

Rationale:
At this moment OpenStack has ability to create VM's snapshots. This is good
enough thing when you want to create a lot of machines with a similar
software configuration. Another words, when you want to create custom images
from your VM.
But these snapshots are not live snapshots. RAM of VM is not stored for
these snapshots. And user can't be able to revert its current VM to the
previous state.

Proposal:
Add ability to create live snapshots.

Blueprint information

Status:
Complete
Approver:
Vish Ishaya
Priority:
Low
Drafter:
None
Direction:
Approved
Assignee:
Anton Antonov
Definition:
Obsolete
Series goal:
None
Implementation:
Not started
Milestone target:
None
Completed by
Russell Bryant

Related branches

Sprints

Whiteboard

We discussed this pretty extensively on the mailing list and in a design summit session. The consensus is that this is not a feature we would like to have in nova. --russellb

XCP/XenServer has snapshots that include the memory state, but there is no easy way to export them, but it should be possible. Also, we will need checks similar to live-migrate to ensure the CPU is sufficiently similar for the VM to resume - johnthetubaguy

Overall direction looks good. There are quota concerns and this is more of a virt feature than a cloud feature, but it could still be a useful one to have. --Vish

So far, I think this will be easy for us to do in the VMwareAPI driver. Our problem right now is just whether we have bandwidth to get it done quickly. --hartsocks (VMware sub-team guy)

CLI:

nova state-save <instance-uuid> <state-name>

 Save instance <instance-uuid> state to save <state-name>

nova state-load <instance-uuid> <state-uuid>

 Reset instance <instance-uuid> state to save <state-uuid>

nova state-list <instance-uuid>

 View saved VM states for instance <instance-uuid>

nova state-delete <instance-uuid> <state-uuid>{1,}

 Delete listed saved VM states for instance <instance-uuid>

VM Saved State Nova API Extension:

GET instances/<instance-uuid>/states
Get saved VM states for instance
Issue call to DB

Response:
{
    “values”: [
                      {
                         “uuid”: “<state-uuid>”,
                         “name”: “<state name>”,
                         “date”: <creation date>,
                      },
                      ...
                  ],
}

GET instances/<instance-uuid>/states/<state-uuid>
Get saved VM state for instance
Issue call to DB

Response:

{
   “uuid”: “<state-uuid>”,
   “name”: “<state name>”,
   “date”: <creation date>,
}

POST instances/<instance-uuid>/states
Save VM state
Get instance info from DB
Send “save” through AMPQ on compute node channel that holds instance.

Data:
{
     “name”: “<save name>”,
}

DELETE instances/<instance-uuid>/states/<state-uuid>
Delete saved VM state
Get instance info from DB
Send “delete_state” through AMPQ on compute node channel that holds instance.

POST instances/<instance-uuid>/states/apply
Apply saved VM state
Get instance info from DB
Send “restore” through AMPQ on compute node channel that holds instance.

Data:
{
     “uuid”: “<state-uuid>”.
}

Nova Compute Changes:

1. Add
state_save(instance_uuid, state_name),
state_restore(instance_uuid, state_uuid),
state_delete(instance_uuid, state_name)
methods to nova.virt.driver

2. Implement state_save, state_restore, state_delete in nova.virt.libvirt.driver using libvirt API. Throw Exception in case when backend format is not Qcow2 or leave decision to libvirt.

3. Add instance_states table to DB

4. Associate it with InstanceState model:
      uuid: state uuid, <primary key>
      name: state name
      date: state date (automatically filled)

5. Add migration script for instance_states

6. Implement instance_state_create, instance_state_get, instance_state_destroy in DB API

(?)

Work Items