Add support to store volume format info in Cinder

Registered by Trump.Zhang on 2014-06-24

Currently, there are several filesystem-based drivers in Cinder, such as nfs, glusterfs, etc. Multiple format of volume other than "raw" can be potentially supported in these drivers, such as qcow2, raw, sparse, etc.

    However, Cinder does not store the actual format of volume and suppose all volumes are "raw" format. It will has or already has several problems as follows:

    1. For volume migration, the generic migration implementation in Cinder uses the "dd" command to copy "src" volume to "dest" volume. If the src volume is "qcow2" format, instance will not get the right data from volume after the dest volume attached to instance, because the info returned from Cinder states that the volume's format is "raw" other than "qcow2"
    2. For volume backup, the backup driver also supposes that src volumes are "raw" format, other format will not be supported

    Indeed, glusterfs driver has used "qemu-img info" command to judge the format of volume. However, as the comment from Duncan in [1] says, this auto detection method has many possible error / exploit vectors. Because if the beginning content of a "raw" volume happens to a "qcow2" disk, auto detection method will judge this volume to be a "qcow2" volume wrongly.

    I proposed that the "format" info should be added to "admin_metadata" of volumes, and enforce it on all operations, such as create, copy, migrate and retype. The "format" will be only set / updated for filesystem-based drivers, other drivers will not contains this metadata and have a default "raw" format.

Blueprint information

Status:
Not started
Approver:
Sean McGinnis
Priority:
High
Drafter:
Trump.Zhang
Direction:
Approved
Assignee:
Rajat Dhasmana
Definition:
Approved
Series goal:
Accepted for wallaby
Implementation:
Unknown
Milestone target:
milestone icon wallaby-3

Related branches

Sprints

Whiteboard

(smcginnis): Marking obsolete as this has been sitting out there for a long time. If this is still needed, please submit a new bp.

Gerrit topic: https://review.openstack.org/#q,topic:bp/add-support-store-volume-format-info,n,z

Addressed by: https://review.openstack.org/103750
    Support storing volume format info

Addressed by: https://review.openstack.org/165393
    Support storing volume format info

Gerrit topic: https://review.opendev.org/#/q/topic:bp/add-support-store-volume-format-info

Addressed by: https://review.opendev.org/760999
    Support storing volume format info

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.