mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-24 23:30:20 +00:00
rbd: implement Manager.GetVolumeGroupSnapshotByID
The GetVolumeGroupSnapshotByID function makes it possible to get a VolumeGroupSnapshot object from the Manager by passing a request-id. This makes it simple for the Group Controller Server to check if a VolumeGroupSnapshot already exists, so it is not needed to try and re-create an existing one. Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
parent
7563f4285d
commit
ad381c4ff0
@ -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,
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user