mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-22 13:00:19 +00:00
rbd: add new image features for dummy image
The dummy image will be created with 1Mib size. during the snapshot transfer operation the 1Mib will be transferred even if the dummy image doesnot contains any data. adding the new image features `fast-diff,layering,obj-map,exclusive-lock`on the dummy image will ensure that only the diff is transferred to the remote cluster. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
9a4533e549
commit
8081ac8251
@ -314,6 +314,14 @@ func createDummyImage(ctx context.Context, rbdVol *rbdVolume) error {
|
|||||||
}
|
}
|
||||||
dummyVol := *rbdVol
|
dummyVol := *rbdVol
|
||||||
dummyVol.RbdImageName = imgName
|
dummyVol.RbdImageName = imgName
|
||||||
|
f := []string{
|
||||||
|
librbd.FeatureNameLayering,
|
||||||
|
librbd.FeatureNameObjectMap,
|
||||||
|
librbd.FeatureNameExclusiveLock,
|
||||||
|
librbd.FeatureNameFastDiff,
|
||||||
|
}
|
||||||
|
features := librbd.FeatureSetFromNames(f)
|
||||||
|
dummyVol.imageFeatureSet = features
|
||||||
// create 1MiB dummy image. 1MiB=1048576 bytes
|
// create 1MiB dummy image. 1MiB=1048576 bytes
|
||||||
dummyVol.VolSize = 1048576
|
dummyVol.VolSize = 1048576
|
||||||
err = createImage(ctx, &dummyVol, dummyVol.conn.Creds)
|
err = createImage(ctx, &dummyVol, dummyVol.conn.Creds)
|
||||||
@ -332,6 +340,10 @@ func createDummyImage(ctx context.Context, rbdVol *rbdVolume) error {
|
|||||||
|
|
||||||
// repairDummyImage deletes and recreates the dummy image.
|
// repairDummyImage deletes and recreates the dummy image.
|
||||||
func repairDummyImage(ctx context.Context, dummyVol *rbdVolume) error {
|
func repairDummyImage(ctx context.Context, dummyVol *rbdVolume) error {
|
||||||
|
// instead of checking the images features and than adding missing image
|
||||||
|
// features, updating the image size to 1Mib. We will delete the image
|
||||||
|
// and recreate it.
|
||||||
|
|
||||||
// deleting and recreating the dummy image will not impact anything as its
|
// deleting and recreating the dummy image will not impact anything as its
|
||||||
// a workaround to fix the scheduling problem.
|
// a workaround to fix the scheduling problem.
|
||||||
err := deleteImage(ctx, dummyVol, dummyVol.conn.Creds)
|
err := deleteImage(ctx, dummyVol, dummyVol.conn.Creds)
|
||||||
|
Loading…
Reference in New Issue
Block a user