mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 11:00:25 +00:00
rbd: fix volumeGroup UndoReservation
This commit fixes the VolumeGroup UndoReservation by using the correct RequestName of the VolumeGroup instead of the volumeGroupHandle. Signed-off-by: Praveen M <m.praveen@ibm.com>
This commit is contained in:
parent
797eceebb2
commit
51d0a08112
@ -189,6 +189,15 @@ func (cvg *commonVolumeGroup) GetName(ctx context.Context) (string, error) {
|
|||||||
return cvg.name, nil
|
return cvg.name, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetRequestName returns the requestName of the VolumeGroup.
|
||||||
|
func (cvg *commonVolumeGroup) GetRequestName(ctx context.Context) (string, error) {
|
||||||
|
if cvg.requestName == "" {
|
||||||
|
return "", errors.New("BUG: requestName is not set")
|
||||||
|
}
|
||||||
|
|
||||||
|
return cvg.requestName, nil
|
||||||
|
}
|
||||||
|
|
||||||
// GetPool returns the name of the pool that holds the VolumeGroup.
|
// GetPool returns the name of the pool that holds the VolumeGroup.
|
||||||
func (cvg *commonVolumeGroup) GetPool(ctx context.Context) (string, error) {
|
func (cvg *commonVolumeGroup) GetPool(ctx context.Context) (string, error) {
|
||||||
if cvg.pool == "" {
|
if cvg.pool == "" {
|
||||||
@ -291,9 +300,9 @@ func (cvg *commonVolumeGroup) Delete(ctx context.Context) error {
|
|||||||
return fmt.Errorf("failed to get name for volume group %q: %w", cvg, err)
|
return fmt.Errorf("failed to get name for volume group %q: %w", cvg, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
csiID, err := cvg.GetID(ctx)
|
reqName, err := cvg.GetRequestName(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get id for volume group %q: %w", cvg, err)
|
return fmt.Errorf("failed to get request name for volume group %q: %w", cvg, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
pool, err := cvg.GetPool(ctx)
|
pool, err := cvg.GetPool(ctx)
|
||||||
@ -306,7 +315,7 @@ func (cvg *commonVolumeGroup) Delete(ctx context.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = j.UndoReservation(ctx, pool, name, csiID)
|
err = j.UndoReservation(ctx, pool, name, reqName)
|
||||||
if err != nil /* TODO? !errors.Is(..., err) */ {
|
if err != nil /* TODO? !errors.Is(..., err) */ {
|
||||||
return fmt.Errorf("failed to undo the reservation for volume group %q: %w", cvg, err)
|
return fmt.Errorf("failed to undo the reservation for volume group %q: %w", cvg, err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user