mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-27 16:50:23 +00:00
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>
(cherry picked from commit fc442221e4
)
This commit is contained in:
parent
9fc0999a82
commit
c5cafe3128
@ -1435,13 +1435,13 @@ func (rv *rbdVolume) setThickProvisioned() error {
|
|||||||
// isThickProvisioned checks in the image metadata if the image has been marked
|
// 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
|
// as thick-provisioned. This can be used while expanding the image, so that
|
||||||
// the expansion can be allocated too.
|
// the expansion can be allocated too.
|
||||||
func (rv *rbdVolume) isThickProvisioned() (bool, error) {
|
func (ri *rbdImage) isThickProvisioned() (bool, error) {
|
||||||
value, err := rv.GetMetadata(thickProvisionMetaKey)
|
value, err := ri.GetMetadata(thickProvisionMetaKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == librbd.ErrNotFound {
|
if err == librbd.ErrNotFound {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
return false, fmt.Errorf("failed to get metadata %q for %q: %w", thickProvisionMetaKey, rv.String(), err)
|
return false, fmt.Errorf("failed to get metadata %q for %q: %w", thickProvisionMetaKey, ri, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
thick, err := strconv.ParseBool(value)
|
thick, err := strconv.ParseBool(value)
|
||||||
|
Loading…
Reference in New Issue
Block a user