Skip to content

Commit

Permalink
thin id is optional
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Sergunov <anton.sergunov@flant.com>
  • Loading branch information
asergunov committed Feb 26, 2025
1 parent a2e6bcb commit c6aaac4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions images/agent/src/internal/controller/llv/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,13 +608,16 @@ func (r *Reconciler) deleteLVIfNeeded(ctx context.Context, vgName string, llv *v
if err != nil {
err = fmt.Errorf("dumping thin pool map: %w", err)
r.log.Error(err, fmt.Sprintf("[deleteLVIfNeeded] can't find pool map for LV %s in VG %s", llv.Spec.ActualLVNameOnTheNode, vgName))
return false, err
return true, err
}

ranges, err := utils.ThinVolumeUsedRanges(ctx, r.log, superblock, utils.LVMThinDeviceID(lv.Data.ThinID))
if lv.Data.ThinID == nil {
err = fmt.Errorf("missing deviceId for thin volume %s", llv.Spec.ActualLVNameOnTheNode)
return true, err
}
ranges, err := utils.ThinVolumeUsedRanges(ctx, r.log, superblock, utils.LVMThinDeviceID(*lv.Data.ThinID))
if err != nil {
err = fmt.Errorf("finding used ranges for deviceId %d in thin pool %s", lv.Data.ThinID, lv.Data.PoolName)
return false, err
return true, err
}
usedRanges = &ranges
}
Expand Down
2 changes: 1 addition & 1 deletion images/agent/src/internal/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ type LVData struct {
CopyPercent string `json:"copy_percent"`
ConvertLv string `json:"convert_lv"`
LvTags string `json:"lv_tags"`
ThinID uint64 `json:"thin_id"`
ThinID *uint64 `json:"thin_id,omitempty"`
MetadataLv string `json:"metadata_lv"`
LVDmPath string `json:"lv_dm_path"`
}
Expand Down

0 comments on commit c6aaac4

Please sign in to comment.