Improve Block Device Handling

Registered by Vish Ishaya

Currently, the drivers have special code to deal with creating swap and ephemeral. This is complicated by the fact that some of these values can be changed in block_device_mapping.

This needs to be cleaned up.

 * Values passed in BDMs need to be validated
 * If BDM is not specified they should be defaulted in the api according to the instance_type. For example, ephemeral in the instance_type will create bdm 2 and swap will create bdm 3.
 * BDMs need to get the proper prefix from the driver. This probably means that the bdms will not track the prefix at all, and that the prefix will be determined by the driver can just be pulled from
instance['default_root_device'] (or something similar)
 * All special handling for swap and ephemeral should be removed from the drivers. They should build the instance record based solely on the block_device_mapping that is passed in.
 * A smart migration needs to be done to add missing block device mapping for all instances that already exist.

Blueprint information

Vish Ishaya
Vish Ishaya
Nikola Đipanov
Series goal:
Accepted for havana
Milestone target:
milestone icon 2013.2
Started by
Russell Bryant
Completed by
Thierry Carrez


Gerrit topic:,topic:bp/improve-block-device-handling,n,z

Addressed by:
    New block device API extension - WIP

Gerrit topic:,topic:bp/improve-boot-from-volume,n,z

[Sam] I'm currently trying to do something similar in blueprint was just planning to create a new blueprint but this may be related?

Oh yea just checked your patch and the wiki, this is exactly what I need for the blueprint I filed, thought had to do this myself, but seems it's a lot of work.
Would the following command create a new volume and copy the image into the volume so it can be used for booting?
-block type=glance,id=XXXXXXX,bus=ide,bootindex=2,dest=volume

[ndipanov] That would be the idea - yeah. This will require some work inside Nova even when we have the new structure and the API, though.

Addressed by:
    BDM class and transformation functions

Addressed by:
    DB migration to the new BDM data format

Addressed by:
    Create an image BDM for every instance

[Sam 2013-05-16] Added some feedback to wiki.

Addressed by:
    Servers API for the new BDM format

Addressed by:
    Add basic BDM format validation in the API layer

Gerrit topic:,topic:bug/1191913,n,z

Addressed by:
    Add legacy flag to get_instance_bdms

Addressed by:
    Make API part of instance boot use new BDM format

Addressed by:
    Move _validate_int_value controller func to utils

Addressed by:
    Change RPC to use new BDM format for instance boot

Addressed by:
    Refactor how bdm is handled when booting

Gerrit topic:,topic:os-block-device-legacy-compute,n,z

Addressed by:
    Virt driver flag for different BDM formats

Addressed by:
    New syntax to boot from a block device mapping

Addressed by:
    Allow more than one ephemeral device in the DB

Addressed by:
    Allow block devices without device_name

Addressed by:
    libvirt driver capable of generating device names

Addressed by:
    Added class DriverImageBlockDevice that implements creating volume from image on booting VM from image if destination_type is volume.

Addressed by:
    Use new BDM syntax when determining boot metadata.

Addressed by:
    Port os-volumes extension to v3 API Part 1

Addressed by:
    Port os-volumes extension to v3 API Part 2

Addressed by:
    Enable libvirt driver to use the new BDM format


Work Items

Dependency tree

* Blueprints in grey have been implemented.