mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 02:50:30 +00:00
cephfs: make createSnapshot() a method of volumeOptions
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
50d884bad3
commit
57f8ee0aa7
@ -45,7 +45,7 @@ const (
|
||||
|
||||
func createCloneFromSubvolume(ctx context.Context, volID, cloneID volumeID, volOpt, parentvolOpt *volumeOptions, cr *util.Credentials) error {
|
||||
snapshotID := cloneID
|
||||
err := createSnapshot(ctx, parentvolOpt, cr, snapshotID, volID)
|
||||
err := parentvolOpt.createSnapshot(ctx, cr, snapshotID, volID)
|
||||
if err != nil {
|
||||
util.ErrorLog(ctx, "failed to create snapshot %s %v", snapshotID, err)
|
||||
return err
|
||||
|
@ -587,7 +587,7 @@ func doSnapshot(ctx context.Context, volOpt *volumeOptions, subvolumeName, snaps
|
||||
volID := volumeID(subvolumeName)
|
||||
snapID := volumeID(snapshotName)
|
||||
snap := snapshotInfo{}
|
||||
err := createSnapshot(ctx, volOpt, cr, snapID, volID)
|
||||
err := volOpt.createSnapshot(ctx, cr, snapID, volID)
|
||||
if err != nil {
|
||||
util.ErrorLog(ctx, "failed to create snapshot %s %v", snapID, err)
|
||||
return snap, err
|
||||
|
@ -45,18 +45,18 @@ type cephfsSnapshot struct {
|
||||
ReservedID string
|
||||
}
|
||||
|
||||
func createSnapshot(ctx context.Context, volOptions *volumeOptions, cr *util.Credentials, snapID, volID volumeID) error {
|
||||
func (vo *volumeOptions) createSnapshot(ctx context.Context, cr *util.Credentials, snapID, volID volumeID) error {
|
||||
args := []string{
|
||||
"fs",
|
||||
"subvolume",
|
||||
"snapshot",
|
||||
"create",
|
||||
volOptions.FsName,
|
||||
vo.FsName,
|
||||
string(volID),
|
||||
string(snapID),
|
||||
"--group_name",
|
||||
volOptions.SubvolumeGroup,
|
||||
"-m", volOptions.Monitors,
|
||||
vo.SubvolumeGroup,
|
||||
"-m", vo.Monitors,
|
||||
"-c", util.CephConfigPath,
|
||||
"-n", cephEntityClientPrefix + cr.ID,
|
||||
"--keyfile=" + cr.KeyFile,
|
||||
@ -67,7 +67,7 @@ func createSnapshot(ctx context.Context, volOptions *volumeOptions, cr *util.Cre
|
||||
"ceph",
|
||||
args[:]...)
|
||||
if err != nil {
|
||||
util.ErrorLog(ctx, "failed to create subvolume snapshot %s %s(%s) in fs %s", string(snapID), string(volID), err, volOptions.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 nil
|
||||
|
Loading…
Reference in New Issue
Block a user