mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 11:00:25 +00:00
cephfs: implement createSnapshot() with go-ceph
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
57f8ee0aa7
commit
1d8cc75282
@ -46,26 +46,13 @@ type cephfsSnapshot struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (vo *volumeOptions) createSnapshot(ctx context.Context, cr *util.Credentials, snapID, volID volumeID) error {
|
func (vo *volumeOptions) createSnapshot(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
|
||||||
"create",
|
|
||||||
vo.FsName,
|
|
||||||
string(volID),
|
|
||||||
string(snapID),
|
|
||||||
"--group_name",
|
|
||||||
vo.SubvolumeGroup,
|
|
||||||
"-m", vo.Monitors,
|
|
||||||
"-c", util.CephConfigPath,
|
|
||||||
"-n", cephEntityClientPrefix + cr.ID,
|
|
||||||
"--keyfile=" + cr.KeyFile,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err := execCommandErr(
|
err = fsa.CreateSubVolumeSnapshot(vo.FsName, vo.SubvolumeGroup, string(volID), string(snapID))
|
||||||
ctx,
|
|
||||||
"ceph",
|
|
||||||
args[:]...)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
util.ErrorLog(ctx, "failed to create subvolume snapshot %s %s(%s) in fs %s", string(snapID), string(volID), err, vo.FsName)
|
util.ErrorLog(ctx, "failed to create subvolume snapshot %s %s(%s) in fs %s", string(snapID), string(volID), err, vo.FsName)
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user