cephfs: implement deleteSnapshot() with go-ceph

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-11-04 14:19:36 +01:00 committed by mergify[bot]
parent 032db78d8a
commit 9d9b5b3303

View File

@ -62,27 +62,13 @@ func (vo *volumeOptions) createSnapshot(ctx context.Context, snapID, volID volum
} }
func (vo *volumeOptions) deleteSnapshot(ctx context.Context, cr *util.Credentials, snapID, volID volumeID) error { func (vo *volumeOptions) deleteSnapshot(ctx context.Context, cr *util.Credentials, snapID, volID volumeID) error {
args := []string{ fsa, err := vo.conn.GetFSAdmin()
"fs", if err != nil {
"subvolume", util.ErrorLog(ctx, "could not get FSAdmin: %s", err)
"snapshot", return err
"rm",
vo.FsName,
string(volID),
string(snapID),
"--group_name",
vo.SubvolumeGroup,
"-m", vo.Monitors,
"-c", util.CephConfigPath,
"-n", cephEntityClientPrefix + cr.ID,
"--keyfile=" + cr.KeyFile,
"--force",
} }
err := execCommandErr( err = fsa.ForceRemoveSubVolumeSnapshot(vo.FsName, vo.SubvolumeGroup, string(volID), string(snapID))
ctx,
"ceph",
args[:]...)
if err != nil { if err != nil {
util.ErrorLog(ctx, "failed to delete subvolume snapshot %s %s(%s) in fs %s", string(snapID), string(volID), err, vo.FsName) util.ErrorLog(ctx, "failed to delete subvolume snapshot %s %s(%s) in fs %s", string(snapID), string(volID), err, vo.FsName)
return err return err