mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 02:50:30 +00:00
cephfs: Add --retain-snapshots
flag to purge volume operations
Snapshots can be retained even after subvolume deletion in Ceph 14.2.12. Adding support for the same in ceph-csi. Signed-off-by: Yug <yuggupta27@gmail.com>
This commit is contained in:
parent
be3a78afaf
commit
6351358752
@ -42,13 +42,19 @@ const (
|
|||||||
type Subvolume struct {
|
type Subvolume struct {
|
||||||
BytesQuota int `json:"bytes_quota"`
|
BytesQuota int `json:"bytes_quota"`
|
||||||
DataPool string `json:"data_pool"`
|
DataPool string `json:"data_pool"`
|
||||||
|
Features []string `json:"features"`
|
||||||
GID int `json:"gid"`
|
GID int `json:"gid"`
|
||||||
Mode int `json:"mode"`
|
Mode int `json:"mode"`
|
||||||
MonAddrs []string `json:"mon_addrs"`
|
MonAddrs []string `json:"mon_addrs"`
|
||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
PoolNamespace string `json:"pool_namespace"`
|
PoolNamespace string `json:"pool_namespace"`
|
||||||
Type string `json:"type"`
|
// The subvolume "state" is based on the current state of the subvolume.
|
||||||
UID int `json:"uid"`
|
// It contains one of the following values:
|
||||||
|
// * "complete": subvolume is ready for all operations.
|
||||||
|
// * "snapshot-retained": subvolume is removed but its snapshots are retained.
|
||||||
|
State string `json:"state"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
UID int `json:"uid"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func getVolumeRootPathCephDeprecated(volID volumeID) string {
|
func getVolumeRootPathCephDeprecated(volID volumeID) string {
|
||||||
@ -248,6 +254,9 @@ func purgeVolume(ctx context.Context, volID volumeID, cr *util.Credentials, volO
|
|||||||
if force {
|
if force {
|
||||||
arg = append(arg, "--force")
|
arg = append(arg, "--force")
|
||||||
}
|
}
|
||||||
|
if checkSubvolumeHasFeature("snapshot-retention", volOptions.Features) {
|
||||||
|
arg = append(arg, "--retain-snapshots")
|
||||||
|
}
|
||||||
|
|
||||||
err := execCommandErr(ctx, "ceph", arg...)
|
err := execCommandErr(ctx, "ceph", arg...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user