Skip to content

volume wait interval through settings#872

Merged
OmkarDeshpande7 merged 2 commits intomainfrom
private/main/volume-timeout-setting
Sep 8, 2025
Merged

volume wait interval through settings#872
OmkarDeshpande7 merged 2 commits intomainfrom
private/main/volume-timeout-setting

Conversation

@OmkarDeshpande7
Copy link
Copy Markdown
Collaborator

@OmkarDeshpande7 OmkarDeshpande7 commented Sep 5, 2025

What this PR does / why we need it

Which issue(s) this PR fixes

(optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged)

fixes #880

Special notes for your reviewer

Testing done

please add testing details (logs, screenshots, etc.)

Summary by Bito

This pull request enhances the configurability of volume wait intervals and retry limits by replacing hard-coded values with settings-driven parameters. New constants and settings have been introduced across the migration and utility modules to support dynamic configurations. The OpenStack operation flows have been refined by integrating the Kubernetes client and updating retry logic for volume operations.

Copy link
Copy Markdown
Contributor

@windsurf-bot windsurf-bot Bot left a comment

Choose a reason for hiding this comment

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

💡 To request another review, post a new comment with "/windsurf-review".

Comment thread v2v-helper/main.go
}
utils.PrintLog(msg)
return
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Removing the return statement from the handleError function changes its behavior significantly. Without the return, execution will continue after reporting an error, which could lead to unexpected behavior or crashes when trying to use uninitialized resources later in the code. The function appears to be designed to report errors and then terminate execution.

Comment thread k8s/migration/pkg/utils/settings.go Outdated
Comment thread v2v-helper/pkg/utils/migrateutils/openstackopsutils.go Outdated
@bito-code-review
Copy link
Copy Markdown
Contributor

Changelist by Bito

This pull request implements the following key changes.

Key Change Files Impacted
Feature Improvement - Enhanced Volume Wait Configurations

constants.go - Added new constants for volume wait interval and retry limit to enable configurable wait times.

settings.go - Introduced new settings fields for volume available wait intervals and retry limits.

constants.go - Defined new volume wait constants to replace hard-coded values.

types.go - Included new type fields for volume wait interval and retry limit to support configuration.

utils.go - Updated utility functions to incorporate the new volume wait settings for dynamic behavior.

Other Improvements - Refined OpenStack Client Integration

main.go - Modified main logic to assign the Kubernetes client, enhancing OpenStack client usage.

openstackops.go - Added K8sClient field (set to nil by default) to support updated client integration.

openstackopsutils.go - Updated volume wait and attach logic to use dynamically retrieved settings and improved retry mechanisms.

go.mod - Bumped the migration dependency version to align with code updates.

Copy link
Copy Markdown
Contributor

@bito-code-review bito-code-review Bot left a comment

Choose a reason for hiding this comment

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

Code Review Agent Run #937f11

Actionable Suggestions - 1
  • k8s/migration/pkg/utils/settings.go - 1
    • Incorrect constant used for VM retry limit · Line 78-78
Additional Suggestions - 1
  • v2v-helper/pkg/utils/migrateutils/openstackopsutils.go - 1
    • Error message doesn't reflect configurable retry limit · Line 176-188
      The code replaces a hardcoded retry limit with a configurable setting but doesn't update the error message on line 200 to reflect the new retry limit. This could lead to misleading error information.
      Code suggestion
       @@ -199,3 +199,3 @@
        	if err != nil {
      -		return fmt.Errorf("failed to attach volume to VM: %s", err)
      +		return fmt.Errorf("failed to attach volume to VM after %d attempts: %s", vjailbreakSettings.VolumeAvailableWaitRetryLimit, err)
        	}
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • v2v-helper/main.go - 1
    • Error handling function continues execution after error · Line 52-52
Review Details
  • Files reviewed - 9 · Commit Range: 698172b..698172b
    • k8s/migration/pkg/constants/constants.go
    • k8s/migration/pkg/utils/settings.go
    • v2v-helper/go.mod
    • v2v-helper/main.go
    • v2v-helper/openstack/openstackops.go
    • v2v-helper/pkg/constants/constants.go
    • v2v-helper/pkg/utils/migrateutils/openstackopsutils.go
    • v2v-helper/pkg/utils/types.go
    • v2v-helper/pkg/utils/utils.go
  • Files skipped - 0
  • Tools
    • Golangci-lint (Linter) - ✖︎ Failed
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at mithil@platform9.com.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread k8s/migration/pkg/utils/settings.go Outdated

if vjailbreakSettingsCM.Data["VM_ACTIVE_WAIT_RETRY_LIMIT"] == "" {
vjailbreakSettingsCM.Data["VM_ACTIVE_WAIT_RETRY_LIMIT"] = "15"
vjailbreakSettingsCM.Data["VM_ACTIVE_WAIT_RETRY_LIMIT"] = strconv.Itoa(constants.VolumeAvailableWaitRetryLimit)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Incorrect constant used for VM retry limit

Incorrect constant used for VM_ACTIVE_WAIT_RETRY_LIMIT. The code is using VolumeAvailableWaitRetryLimit instead of VMActiveWaitRetryLimit, which could lead to incorrect retry behavior.

Code suggestion
Check the AI-generated fix before applying
Suggested change
vjailbreakSettingsCM.Data["VM_ACTIVE_WAIT_RETRY_LIMIT"] = strconv.Itoa(constants.VolumeAvailableWaitRetryLimit)
vjailbreakSettingsCM.Data["VM_ACTIVE_WAIT_RETRY_LIMIT"] = strconv.Itoa(constants.VMActiveWaitRetryLimit)

Code Review Run #937f11


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

Copy link
Copy Markdown
Collaborator

@spai-p9 spai-p9 left a comment

Choose a reason for hiding this comment

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

lgtm

@OmkarDeshpande7
Copy link
Copy Markdown
Collaborator Author

/windsurf-review

Copy link
Copy Markdown
Contributor

@windsurf-bot windsurf-bot Bot left a comment

Choose a reason for hiding this comment

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

💡 To request another review, post a new comment with "/windsurf-review".

time.Sleep(5 * time.Second) // Wait for 5 seconds before checking again
time.Sleep(time.Duration(vjailbreakSettings.VolumeAvailableWaitIntervalSeconds) * time.Second) // Wait for 5 seconds before checking again
}
return fmt.Errorf("volume did not become available within %d seconds", constants.MaxIntervalCount*5)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The error message still references constants.MaxIntervalCount*5 seconds, but should be updated to use the configurable settings: vjailbreakSettings.VolumeAvailableWaitRetryLimit*vjailbreakSettings.VolumeAvailableWaitIntervalSeconds.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ok

Comment thread k8s/migration/pkg/utils/settings.go Outdated

if vjailbreakSettingsCM.Data["VM_ACTIVE_WAIT_RETRY_LIMIT"] == "" {
vjailbreakSettingsCM.Data["VM_ACTIVE_WAIT_RETRY_LIMIT"] = "15"
vjailbreakSettingsCM.Data["VM_ACTIVE_WAIT_RETRY_LIMIT"] = strconv.Itoa(constants.VolumeAvailableWaitRetryLimit)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There's an incorrect constant being used here. This should be using constants.VMActiveWaitRetryLimit instead of constants.VolumeAvailableWaitRetryLimit to maintain consistency with the field name.

Suggested change
vjailbreakSettingsCM.Data["VM_ACTIVE_WAIT_RETRY_LIMIT"] = strconv.Itoa(constants.VolumeAvailableWaitRetryLimit)
vjailbreakSettingsCM.Data["VM_ACTIVE_WAIT_RETRY_LIMIT"] = strconv.Itoa(constants.VMActiveWaitRetryLimit)

Comment thread v2v-helper/main.go
}
utils.PrintLog(msg)
return
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The removal of the return statement in the handleError function changes its behavior significantly. Without the return, execution will continue after logging an error, which could lead to unexpected behavior or crashes later in the code when operating with invalid state. Consider keeping the return statement or ensuring proper error handling flow.

@OmkarDeshpande7 OmkarDeshpande7 enabled auto-merge (squash) September 8, 2025 11:25
@OmkarDeshpande7 OmkarDeshpande7 merged commit 9341821 into main Sep 8, 2025
12 checks passed
@OmkarDeshpande7 OmkarDeshpande7 deleted the private/main/volume-timeout-setting branch September 8, 2025 11:35
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Sep 8, 2025

Bito Automatic Review Failed - Technical Failure

Bito encountered technical difficulties while generating code feedback . To retry, type /review in a comment and save. If the issue persists, contact support@bito.ai and provide the following details:

Agent Run ID: bd0bf4b6-336b-427c-bba5-9d5b13034905

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.

Use volume wait timeout from vjailbreak settings

2 participants