Skip to content

Commit

Permalink
do not attach volume with no replicas
Browse files Browse the repository at this point in the history
Signed-off-by: Moritz Wanzenböck <[email protected]>
  • Loading branch information
WanzenBug authored and rck committed Jan 25, 2024
1 parent 271af99 commit 9541e91
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Do not try to create diskless resource if there is no compatible diskless layer (DRBD or NVMe) available
- Do not try to create diskless resource if there is no compatible diskless layer (DRBD or NVMe) available.
- Do not allow attaching a volume that has no existing replica.

## [1.3.0] - 2023-11-15

Expand Down
6 changes: 5 additions & 1 deletion pkg/client/linstor.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,14 @@ func (s *Linstor) Attach(ctx context.Context, volId, node string, rwxBlock bool)
}).Info("attaching volume")

ress, err := s.client.Resources.GetAll(ctx, volId)
if nil404(err) != nil {
if err != nil {
return err
}

if len(ress) == 0 {
return fmt.Errorf("failed to attach resource with no deployed replica")
}

var existingRes *lapi.Resource

disklessFlag := ""
Expand Down

0 comments on commit 9541e91

Please sign in to comment.