Skip to content

Sorting functions for common use#188

Merged
skoya76 merged 1 commit into
mainfrom
5607-verify-2
Nov 17, 2025
Merged

Sorting functions for common use#188
skoya76 merged 1 commit into
mainfrom
5607-verify-2

Conversation

@llamerada-jp

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors controller code to extract common functionality into reusable utility functions. Despite the title mentioning "sorting functions," this is actually about organizing and generalizing code by extracting duplicate logic into shared functions.

Key Changes

  • Extracted createCloneByPV() function to util.go for creating RBD clone images, eliminating code duplication from mantlerestore_controller.go
  • Generalized createOrUpdateZeroOutPV/PVC functions into createOrUpdateStaticPV/PVC in mantlebackup_controller.go with parameterized names and components
  • Removed slices import from mantlerestore_controller.go (moved to util.go with the extracted function)

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
internal/controller/util.go Adds new createCloneByPV() helper function to create RBD clone images from PV snapshots, and imports slices and ceph packages
internal/controller/mantlerestore_controller.go Refactors to use the extracted createCloneByPV() function, simplifying cloneImageFromBackup() and removing duplicate code
internal/controller/mantlebackup_controller.go Renames and generalizes createOrUpdateZeroOutPV/PVC to createOrUpdateStaticPV/PVC with parameterized inputs for broader reusability

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/controller/mantlebackup_controller.go
Comment thread internal/controller/util.go Outdated
Comment thread internal/controller/mantlebackup_controller.go Outdated
Comment thread internal/controller/mantlebackup_controller.go
Signed-off-by: Yuji Ito <llamerada.jp@gmail.com>
@llamerada-jp llamerada-jp marked this pull request as ready for review November 14, 2025 07:39
@llamerada-jp llamerada-jp requested a review from skoya76 November 14, 2025 09:56
@skoya76 skoya76 merged commit 7e25f99 into main Nov 17, 2025
20 of 22 checks passed
@skoya76 skoya76 deleted the 5607-verify-2 branch November 17, 2025 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants