From 8081ac82513c4e9b02dd18d99e0b4a2b3b8334cb Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Tue, 7 Dec 2021 11:15:28 +0530 Subject: [PATCH] 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 --- internal/rbd/replicationcontrollerserver.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/internal/rbd/replicationcontrollerserver.go b/internal/rbd/replicationcontrollerserver.go index 8387f776c..e99db7847 100644 --- a/internal/rbd/replicationcontrollerserver.go +++ b/internal/rbd/replicationcontrollerserver.go @@ -314,6 +314,14 @@ func createDummyImage(ctx context.Context, rbdVol *rbdVolume) error { } dummyVol := *rbdVol 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 dummyVol.VolSize = 1048576 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. 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 // a workaround to fix the scheduling problem. err := deleteImage(ctx, dummyVol, dummyVol.conn.Creds)