Skip to content

Commit

Permalink
VolumeGroupSnapshot comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nixpanic committed Oct 2, 2024
1 parent b27bb46 commit 5c9ae9f
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions internal/rbd/group/group_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,21 @@ import (
type volumeGroupSnapshot struct {
commonVolumeGroup

// volumes is a list of rbd-images that are part of the group. The ID
// of each volume is stored in the journal.
// snapshots is a list of rbd-images that are part of the group. The ID
// of each snapshot is stored in the journal.
snapshots []types.Snapshot

// volumeToFree contains Volumes that were resolved during
// GetVolumeGroup. The volumes slice can be updated independently of
// this by calling AddVolume (Volumes are allocated elsewhere), and
// RemoveVolume (need to keep track of the allocated Volume).
// snapshotsToFree contains Snapshots that were resolved during
// GetVolumeGroupSnapshot.
snapshotsToFree []types.Snapshot
}

// verify that volumeGroupSnapshot implements the VolumeGroupSnapshot interface.
var _ types.VolumeGroupSnapshot = &volumeGroupSnapshot{}

// GetVolumeGroupSnapshot initializes a new VolumeGroup object that can be used
// to manage an `rbd group`.
// If the .GetName() function returns an error, the VolumeGroup does not exist
// yet. It is needed to call .Create() in that case first.
// GetVolumeGroupSnapshot initializes a new VolumeGroupSnapshot object that can
// be used to inspect and delete a group of snapshots that was created by a
// VolumeGroup.
func GetVolumeGroupSnapshot(
ctx context.Context,
id string,
Expand Down Expand Up @@ -113,6 +110,8 @@ func GetVolumeGroupSnapshot(
return vgs, nil
}

// NewVolumeGroupSnapshot creates a new VolumeGroupSnapshot object with the
// given slice of Snapshots and adds the objectmapping to the journal.
func NewVolumeGroupSnapshot(
ctx context.Context,
id string,
Expand Down Expand Up @@ -175,7 +174,7 @@ func NewVolumeGroupSnapshot(
return vgs, nil
}

// ToCSI creates a CSI-Addons type for the VolumeGroup.
// ToCSI creates a CSI-Addons type for the VolumeGroupSnapshot.
func (vgs *volumeGroupSnapshot) ToCSI(ctx context.Context) (*csi.VolumeGroupSnapshot, error) {
snapshots, err := vgs.ListSnapshots(ctx)
if err != nil {
Expand Down

0 comments on commit 5c9ae9f

Please sign in to comment.