Skip to content

Commit

Permalink
Merge pull request #186 from sushanthakumar/snapshothandle-update
Browse files Browse the repository at this point in the history
Update backup handle usage mechanism
  • Loading branch information
skdwriting authored Jan 9, 2024
2 parents fe3e56d + b2ed2e7 commit 972ef12
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion providerframework/volumeservice/backup/backupvolume.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ func (ctrl *controller) getSnapshotBySnapshotState(
}

return &providerSvc.Snapshot{
SnapshotHandle: *csiVolSnapshotContent.Status.SnapshotHandle,
SnapshotHandle: csiVolSnapshotContent.Name,
}, nil
}

Expand Down
7 changes: 1 addition & 6 deletions providers/csi-snapshotter/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"strings"

"github.com/soda-cdm/kahu/client"
"github.com/soda-cdm/kahu/providers/csi-snapshotter/server/options"
Expand Down Expand Up @@ -169,11 +168,7 @@ func (server *volBackupServer) CreateVolumeFromBackup(ctx context.Context,
restoreIDs := make([]*pb.RestoreVolumeIdentifier, 0)
for _, restoreInfo := range restoreReq.RestoreInfo {
log.Infof("CreateVolumeFromBackup ....%+v", restoreInfo)
backupHandle := restoreInfo.GetBackupIdentity().BackupHandle
log.Infof("CreateVolumeFromBackup backupHandle....%+v", backupHandle)
//bacjupHandleSplit := strings.Split(backupHandle, "@")
//snapshotHandle := bacjupHandleSplit[1]
snapshotContentName := strings.ReplaceAll(backupHandle, "snapshot", "snapcontent")
snapshotContentName := restoreInfo.GetBackupIdentity().BackupHandle
log.Infof("CreateVolumeFromBackup snapshotContentName....%+v", snapshotContentName)
snapshotContent, err := server.snapshotCli.SnapshotV1().
VolumeSnapshotContents().
Expand Down
7 changes: 1 addition & 6 deletions providers/openebs-zfs/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package server

import (
"context"
"strings"

snapshotapi "github.com/kubernetes-csi/external-snapshotter/client/v4/apis/volumesnapshot/v1"
snapshotclientset "github.com/kubernetes-csi/external-snapshotter/client/v4/clientset/versioned"
Expand Down Expand Up @@ -168,11 +167,7 @@ func (server *volBackupServer) CreateVolumeFromBackup(ctx context.Context,

restoreIDs := make([]*pb.RestoreVolumeIdentifier, 0)
for _, restoreInfo := range restoreReq.RestoreInfo {
backupHandle := restoreInfo.GetBackupIdentity().BackupHandle
bacjupHandleSplit := strings.Split(backupHandle, "@")
snapshotHandle := bacjupHandleSplit[1]
snapshotContentName := strings.ReplaceAll(snapshotHandle, "snapshot", "snapcontent")

snapshotContentName := restoreInfo.GetBackupIdentity().BackupHandle
snapshotContent, err := server.snapshotCli.SnapshotV1().
VolumeSnapshotContents().
Get(context.TODO(), snapshotContentName, metav1.GetOptions{})
Expand Down

0 comments on commit 972ef12

Please sign in to comment.