mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
rbd: use ListChildrenAttributes() instead of ListChildren()
This commit modifies listSnapAndChildren() to make use of ListChildrenAttributes() instead of ListChildren() which allows us to filter out images in trash. This commit also order the alive images so that temp clone images are followed by images backing volume snapshots so that temp clone images are flattened first. Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
@ -20,6 +20,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/ceph/ceph-csi/internal/util"
|
||||
"github.com/ceph/ceph-csi/internal/util/k8s"
|
||||
@ -122,7 +123,7 @@ func (rv *rbdVolume) generateTempClone() *rbdVolume {
|
||||
// The temp cloned image name will be always (rbd image name + "-temp")
|
||||
// this name will be always unique, as cephcsi never creates an image with
|
||||
// this format for new rbd images
|
||||
tempClone.RbdImageName = rv.RbdImageName + "-temp"
|
||||
tempClone.RbdImageName = rv.RbdImageName + tempImageSuffix
|
||||
|
||||
return &tempClone
|
||||
}
|
||||
@ -250,3 +251,9 @@ func (rv *rbdVolume) doSnapClone(ctx context.Context, parentVol *rbdVolume) erro
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// isTempClonedImage checks whether the image is a temporary cloned image
|
||||
// by checking the suffix of the image name.
|
||||
func isTempClonedImage(imageName string) bool {
|
||||
return strings.HasSuffix(imageName, tempImageSuffix)
|
||||
}
|
||||
|
Reference in New Issue
Block a user