mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-21 22:00:19 +00:00
rbd: fix snapshot deletion by resolving image names correctly
When creating a Snapshot with the new NewSnapshotByID() function, the name of the RBD-image that is created is the same as the name of the Snapshot. The `RbdImageName` points to the name of parent image, which causes deleting the Snapshot to delete the parent image instead. Correcting the `RbdImageName` and setting it to the `RbdSnapName` makes sure that upon deletion, the Snapshot RBD-image is removed, and not the parent image. Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
parent
fdccba1f33
commit
e011e74b9d
@ -212,6 +212,11 @@ func (mgr *rbdManager) GetSnapshotByID(ctx context.Context, id string) (types.Sn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: The snapshot will have RbdImageName set to the image that was
|
||||||
|
// used as source. This is not correct for group snapshots images, and
|
||||||
|
// need to be fixed. See rbdVolume.NewSnapshotByID() for more details.
|
||||||
|
snapshot.RbdImageName = snapshot.RbdSnapName
|
||||||
|
|
||||||
return snapshot, nil
|
return snapshot, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,12 @@ func (rv *rbdVolume) NewSnapshotByID(
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// a new snapshot image will be created, needs to have a unique name
|
// A new snapshot image will be created, and needs to have a unique
|
||||||
|
// name.
|
||||||
|
// FIXME: the journal contains rv.RbdImageName as SourceName. When
|
||||||
|
// resolving the snapshot image, snap.RbdImageName will be set to the
|
||||||
|
// original RbdImageName/SourceName (incorrect). This is fixed-up in
|
||||||
|
// rbdManager.GetSnapshotByID(), this needs to be done cleaner.
|
||||||
snap.RbdImageName = snap.RbdSnapName
|
snap.RbdImageName = snap.RbdSnapName
|
||||||
|
|
||||||
err = rv.Connect(cr)
|
err = rv.Connect(cr)
|
||||||
|
Loading…
Reference in New Issue
Block a user