Skip to content

Enhance efficiency for checking VM status#2128

Merged
cb-github-robot merged 1 commit intocloud-barista:mainfrom
seokho-son:main
Aug 29, 2025
Merged

Enhance efficiency for checking VM status#2128
cb-github-robot merged 1 commit intocloud-barista:mainfrom
seokho-son:main

Conversation

@seokho-son
Copy link
Copy Markdown
Member

No description provided.

Signed-off-by: Seokho Son <shsongist@gmail.com>
Copilot AI review requested due to automatic review settings August 29, 2025 11:01
@seokho-son seokho-son requested a review from yunkon-kim as a code owner August 29, 2025 11:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 enhances efficiency for VM status checking by preventing unnecessary API calls when a VM is already in its target status, along with reducing log noise by commenting out a warning message.

  • Adds status check before making CB-Spider API calls to skip operations when VM is already in target status
  • Comments out warning log for missing labels to reduce log verbosity

Reviewed Changes

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

File Description
src/core/infra/control.go Adds efficiency check to skip CB-Spider API calls when VM is already in target status
src/core/common/label/label.go Comments out warning log message for missing labels

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +446 to +448
if currentStatusBeforeUpdating == temp.TargetStatus {
log.Debug().Msgf("[ControlVmAsync] VM [%s] is already in target status [%s], skipping CB-Spider call", vmId, temp.TargetStatus)
callResult.Status = temp.Status
Copy link

Copilot AI Aug 29, 2025

Choose a reason for hiding this comment

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

There's an inconsistency in status assignment. The condition checks if 'currentStatusBeforeUpdating == temp.TargetStatus', but then assigns 'callResult.Status = temp.Status'. This should be 'callResult.Status = currentStatusBeforeUpdating' to maintain consistency with the status that was actually checked.

Suggested change
if currentStatusBeforeUpdating == temp.TargetStatus {
log.Debug().Msgf("[ControlVmAsync] VM [%s] is already in target status [%s], skipping CB-Spider call", vmId, temp.TargetStatus)
callResult.Status = temp.Status
callResult.Status = currentStatusBeforeUpdating

Copilot uses AI. Check for mistakes.
}
if !exists {
log.Warn().Msgf("No label found for '%s'", uid)
// log.Warn().Msgf("No label found for '%s'", uid)
Copy link

Copilot AI Aug 29, 2025

Choose a reason for hiding this comment

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

[nitpick] Instead of commenting out the log statement, consider using a more appropriate log level like log.Debug() if this is expected behavior, or remove the line entirely if the warning is no longer needed.

Suggested change
// log.Warn().Msgf("No label found for '%s'", uid)
log.Debug().Msgf("No label found for '%s'", uid)

Copilot uses AI. Check for mistakes.
@seokho-son
Copy link
Copy Markdown
Member Author

/approve

@github-actions github-actions bot added the approved This PR is approved and will be merged soon. label Aug 29, 2025
@cb-github-robot cb-github-robot merged commit d6bbe77 into cloud-barista:main Aug 29, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved This PR is approved and will be merged soon.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants