rbd: make isThickProvisioned method of rbdImage

isThickProvisioned can be used for both snapshot
and clone validation if isThickProvisioned is method
of common rbdImage structure.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2021-06-17 11:41:29 +05:30 committed by mergify[bot]
parent 57d3183cb1
commit fc442221e4

View File

@ -1455,13 +1455,13 @@ func (rv *rbdVolume) setThickProvisioned() error {
// isThickProvisioned checks in the image metadata if the image has been marked
// as thick-provisioned. This can be used while expanding the image, so that
// the expansion can be allocated too.
func (rv *rbdVolume) isThickProvisioned() (bool, error) {
value, err := rv.GetMetadata(thickProvisionMetaKey)
func (ri *rbdImage) isThickProvisioned() (bool, error) {
value, err := ri.GetMetadata(thickProvisionMetaKey)
if err != nil {
if err == librbd.ErrNotFound {
return false, nil
}
return false, fmt.Errorf("failed to get metadata %q for %q: %w", thickProvisionMetaKey, rv, err)
return false, fmt.Errorf("failed to get metadata %q for %q: %w", thickProvisionMetaKey, ri, err)
}
thick, err := strconv.ParseBool(value)