Skip to content

Commit

Permalink
rbd: add new image features for dummy image
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Madhu-1 committed Dec 7, 2021
1 parent ca73aa8 commit 40a2e6f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions internal/rbd/replicationcontrollerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,14 @@ func createDummyImage(ctx context.Context, rbdVol *rbdVolume) error {
}
dummyVol := *rbdVol
dummyVol.RbdImageName = imgName
f := []string{
librbd.FeatureNameLayering,
librbd.FeatureNameObjectMap,
librbd.FeatureNameExclusiveLock,
librbd.FeatureNameFastDiff,
}
featues := librbd.FeatureSetFromNames(f)
dummyVol.imageFeatureSet = featues
// create 1MiB dummy image. 1MiB=1048576 bytes
dummyVol.VolSize = 1048576
err = createImage(ctx, &dummyVol, dummyVol.conn.Creds)
Expand All @@ -330,6 +338,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)
Expand Down

0 comments on commit 40a2e6f

Please sign in to comment.