mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rbd: detect migration volID in DeleteVolume() and delete rbd image
This commit adds the logic to detect a passed in volumeID is a migrated volume ID and if yes, the driver connect to the backend cluster and clean/delete the image. The logic only applied if its a migration volume ID. The migration volume ID carry the information like mons, pool and image name which is good enough for the driver to identify and connect to the backend cluster for its operations. migration volID format: <mig>_mons-<monsHash>_image-<imageUID>_<poolHash> Details on the hash values: * MonsHash: this carry a hash value (md5sum) which will be acted as the `clusterID` for the operations in this context. * ImageUID: this is the unique UUID generated by kubernetes for the created volume. * PoolHash: this is an encoded string of pool name. Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
b778fe51a4
commit
3c9d7e3cd5
@ -74,9 +74,23 @@ const (
|
||||
thickProvisionMetaData = "true"
|
||||
thinProvisionMetaData = "false"
|
||||
|
||||
// these are the migration label key and value for parameters in volume context.
|
||||
// migration label key and value for parameters in volume context.
|
||||
intreeMigrationKey = "migration"
|
||||
intreeMigrationLabel = "true"
|
||||
migInTreeImagePrefix = "kubernetes-dynamic-pvc-"
|
||||
// migration volume handle identifiers.
|
||||
// total length of fields in the migration volume handle.
|
||||
migVolIDTotalLength = 4
|
||||
// split boundary length of fields.
|
||||
migVolIDSplitLength = 3
|
||||
// separator for migration handle fields.
|
||||
migVolIDFieldSep = "_"
|
||||
// identifier of a migration vol handle.
|
||||
migIdentifier = "mig"
|
||||
// prefix of image field.
|
||||
migImageNamePrefix = "image-"
|
||||
// prefix in the handle for monitors field.
|
||||
migMonPrefix = "mons-"
|
||||
)
|
||||
|
||||
// rbdImage contains common attributes and methods for the rbdVolume and
|
||||
@ -175,6 +189,14 @@ type imageFeature struct {
|
||||
dependsOn []string
|
||||
}
|
||||
|
||||
// migrationvolID is a struct which consists of required fields of a rbd volume
|
||||
// from migrated volumeID.
|
||||
type migrationVolID struct {
|
||||
imageName string
|
||||
poolName string
|
||||
clusterID string
|
||||
}
|
||||
|
||||
var supportedFeatures = map[string]imageFeature{
|
||||
librbd.FeatureNameLayering: {
|
||||
needRbdNbd: false,
|
||||
|
Reference in New Issue
Block a user