cinder/releasenotes/notes/bug-1879578-volume_type-regression-de82f4152c7b2f77.yaml
Brian Rosmaita 674c8e7286 Default volume_type set too early
If a volume_type is not specified in a volume-create request, change
I4da0c13b5b3f8174a30b8557f968d6b9e641b091 (introduced in Train) sets a
default volume_type in the REST API layer.  This prevents the
selection logic in cinder.volume.flows.api.create_volume.
ExtractVolumeRequestTask from being able to infer the appropriate
volume_type from the source volume, snapshot, or image metadata, and
has caused a regression where the created volume is of the default
type instead of the inferred type.

This patch removes setting the default volume_type in the REST API
and modifies the selection code in ExtractVolumeRequestTask slightly
to make sure a volume_type is always assigned in that function, and
adds and revises some tests.

Change-Id: I05915f2e32b1229ad320cd1c5748de3d63183b91
Closes-bug: #1879578
2020-06-24 17:07:38 -04:00

34 lines
1.6 KiB
YAML

---
fixes:
- |
`Bug #1879578 <https://bugs.launchpad.net/cinder/+bug/1879578>`_:
A regression in the Train release caused Cinder to assign the default
volume type too aggressively when a volume type was not specified in
a volume-create request. As a result, some alternative methods of
specifying the volume type were ignored and the default type (either
configured by the operator or the system default) would be assigned.
This release restores the intended behavior, which is described as
follows:
If a ``volume_type`` is not specified when a volume is created, Cinder
tries to infer the volume type from other information in the
volume-create request:
* if a ``source_volid`` is supplied in the request, the volume type
is inferred from the source volume's volume type
* if a ``snapshot_id`` is supplied in the request, the volume type
is inferred from the volume type associated with the snapshot
* if an ``imageRef`` is supplied in the request, and the image has
a ``cinder_img_volume_type`` image property, the volume type is
inferred from the value of that image property
Otherwise, the volume type is the default volume type configured by
the operator, and if no volume type is so configured, the volume type
is the system default volume type, namely, ``__DEFAULT__``.
When a volume type is specified explicitly in a volume-create call, Cinder
will use the specified type. If the specified type cannot be assigned due
to a conflict with other parameters in the volume-create call, however, the
call will result in a 400 (Bad Request) response.