CreateVolumesFromImages


 * Launchpad Entry: NovaSpec:create-volumes-from-images
 * Created: 03 April 2012
 * Contributors: Josh Durgin, Tommi Virtanen

Summary
Allow creating volumes based on images stored by Glance. This could be done at boot time to make booting from a volume easy, or at any other time to pre-create volumes.

Release Note
Volumes are now easy to populate with data and boot from.

Rationale
Currently Nova has two separate kinds of storage for VMs:


 * ephemeral disks - destroyed after guest termination, stored as files on the VM host
 * volumes - persistent (not ephemeral) block devices

VMs can boot from either source, but there is no way for Nova to create a volume based on an image or copy an image onto an existing volume. Booting from a volume should be just as easy as booting from a local disk.

Once booting from volumes is as easy as booting from ephemeral disks, the benefits of Instances with no ephemeral disks are easier to use, including:


 * live migration is easy if volumes are network backed
 * interface is simpler/more traditional (everything is persistent, can reboot without losing data)
 * underlying storage system features can be used effectively (deduplication, replication, etc.)

User stories
User creates a bunch of new instances that have no ephemeral disks, but are all based on the same image. The data from the image is copied to a new volume for each new instance.

Backend
Current Nova volume drivers are "introducers", they merely configure libvirt/xenapi storage, and do not access the stored bytes directly. To support copying an image to a volume, an open/write/close API for volume drivers is needed.

For drivers that expose a block device on the host, dd could be used to write to the directly. This could be the default in nova.volume.driver.VolumeDriver.

Other drivers could override this if they aren't exposed as block devices on the host (like rbd and sheepdog), have more efficient ways of copying, or have other restrictions that prevent dd from working.

Once volume drivers have a way to copy data in, Nova needs a way to use this with an image. This could be done with a call from the compute manager to the volume manager.

User API
There are a number of ways to expose this functionality. One is through an API extension to boot from an image on a volume (probably N images on N volumes). This could be a change to the existing boot from volume API extension.

Another possible use case is easily copying non-boot data onto volumes. This could be exposed as an API call to create a volume from an image without booting a vm from it.

Code Changes

 * New volume driver methods for open/write/close (nova.volume.VolumeDriver)
 * API for booting from a new volume in boot-from-volume API extension
 * API for creating a volume from an image (location TBD)

Migration
No database or core API changes.

Test/Demo Plan
This need not be added or completed until the specification is nearing beta.

Unresolved Issues

 * Does the volume service split affect this?
 * Where should the API for creating a volume from an image go?

BoF agenda and discussion
Use this section to take notes during the BoF; if you keep it in the approved spec, use it for summarising what was discussed and note any options that were rejected.