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

Status:
Complete
Approver:
Vish Ishaya
Priority:
High
Drafter:
Vish Ishaya
Direction:
Approved
Assignee:
Nikola Đipanov
Definition:
Approved
Series goal:
Accepted for havana
Implementation:
Implemented
Milestone target:
milestone icon 2013.2
Started by
Russell Bryant
Completed by
Thierry Carrez

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/improve-block-device-handling,n,z

Addressed by: https://review.openstack.org/20339
    New block device API extension - WIP

Gerrit topic: https://review.openstack.org/#q,topic:bp/improve-boot-from-volume,n,z

[Sam] I'm currently trying to do something similar in blueprint https://blueprints.launchpad.net/horizon/+spec/improved-boot-from-volume 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: https://review.openstack.org/29250
    BDM class and transformation functions

Addressed by: https://review.openstack.org/29251
    DB migration to the new BDM data format

Addressed by: https://review.openstack.org/29252
    Create an image BDM for every instance

[Sam 2013-05-16] Added some feedback to wiki. https://wiki.openstack.org/w/index.php?title=BlockDeviceConfig&diff=prev&oldid=22786

Addressed by: https://review.openstack.org/32568
    Servers API for the new BDM format

Addressed by: https://review.openstack.org/32569
    Add basic BDM format validation in the API layer

Gerrit topic: https://review.openstack.org/#q,topic:bug/1191913,n,z

Addressed by: https://review.openstack.org/33340
    Add legacy flag to get_instance_bdms

Addressed by: https://review.openstack.org/34888
    Make API part of instance boot use new BDM format

Addressed by: https://review.openstack.org/37698
    Move _validate_int_value controller func to utils

Addressed by: https://review.openstack.org/37933
    Change RPC to use new BDM format for instance boot

Addressed by: https://review.openstack.org/39086
    Refactor how bdm is handled when booting

Gerrit topic: https://review.openstack.org/#q,topic:os-block-device-legacy-compute,n,z

Addressed by: https://review.openstack.org/39526
    Virt driver flag for different BDM formats

Addressed by: https://review.openstack.org/#/c/38815/
    New syntax to boot from a block device mapping

Addressed by: https://review.openstack.org/40228
    Allow more than one ephemeral device in the DB

Addressed by: https://review.openstack.org/40229
    Allow block devices without device_name

Addressed by: https://review.openstack.org/40230
    libvirt driver capable of generating device names

Addressed by: https://review.openstack.org/40603
    Added class DriverImageBlockDevice that implements creating volume from image on booting VM from image if destination_type is volume.

Addressed by: https://review.openstack.org/41101
    Use new BDM syntax when determining boot metadata.

Addressed by: https://review.openstack.org/41646
    Port os-volumes extension to v3 API Part 1

Addressed by: https://review.openstack.org/41647
    Port os-volumes extension to v3 API Part 2

Addressed by: https://review.openstack.org/42474
    Enable libvirt driver to use the new BDM format

(?)

Work Items

Dependency tree

* Blueprints in grey have been implemented.