diff --git a/internal/rbd/manager.go b/internal/rbd/manager.go index ebb20b6f5..d637c89a7 100644 --- a/internal/rbd/manager.go +++ b/internal/rbd/manager.go @@ -320,6 +320,23 @@ func (mgr *rbdManager) CreateVolumeGroup(ctx context.Context, name string) (type return vg, nil } +func (mgr *rbdManager) GetVolumeGroupSnapshotByID( + ctx context.Context, + id string, +) (types.VolumeGroupSnapshot, error) { + creds, err := mgr.getCredentials() + if err != nil { + return nil, err + } + + vgs, err := rbd_group.GetVolumeGroupSnapshot(ctx, id, mgr.csiID, creds, mgr) + if err != nil { + return nil, fmt.Errorf("failed to get volume group with id %q: %w", id, err) + } + + return vgs, nil +} + func (mgr *rbdManager) CreateVolumeGroupSnapshot( ctx context.Context, vg types.VolumeGroup, diff --git a/internal/rbd/types/manager.go b/internal/rbd/types/manager.go index c2541b493..105e28374 100644 --- a/internal/rbd/types/manager.go +++ b/internal/rbd/types/manager.go @@ -53,6 +53,10 @@ type Manager interface { // and records details about it in the journal. CreateVolumeGroup(ctx context.Context, name string) (VolumeGroup, error) + // GetVolumeGroupSnapshotByID resolves the VolumeGroupSnapshot from the + // CSI id/handle. + GetVolumeGroupSnapshotByID(ctx context.Context, id string) (VolumeGroupSnapshot, error) + // CreateVolumeGroupSnapshot instructs the Manager to create a // VolumeGroupSnapshot from the VolumeGroup. All snapshots in the // returned VolumeGroupSnapshot have been taken while I/O on the