Skip to content

Add resource preparing and prepared statuses#2115

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

Add resource preparing and prepared statuses#2115
cb-github-robot merged 1 commit intocloud-barista:mainfrom
seokho-son:main

Conversation

@seokho-son
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings August 25, 2025 17:38
@seokho-son seokho-son requested a review from yunkon-kim as a code owner August 25, 2025 17:38
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 adds new resource statuses "Preparing" and "Prepared" to support a two-phase MCI (Multi-Cloud Infrastructure) creation process. The implementation allows MCIs to be prepared with resources first, then later activated for actual provisioning.

Key changes:

  • Introduces StatusPreparing and StatusPrepared constants for resource lifecycle management
  • Modifies MCI creation logic to support reusing prepared MCIs and transitioning through preparation states
  • Updates deletion logic to allow removal of MCIs in preparing/prepared states

Reviewed Changes

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

File Description
src/core/model/mci.go Adds StatusPreparing and StatusPrepared constants
src/core/infra/provisioning.go Implements two-phase MCI creation with preparation status handling
src/core/infra/manageInfo.go Updates status return logic and deletion conditions for new statuses

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

mciTmp.Status = model.StatusCreating
mciTmp.TargetAction = model.ActionCreate
mciTmp.TargetStatus = model.StatusRunning
UpdateMciInfo(nsId, mciTmp)
Copy link

Copilot AI Aug 25, 2025

Choose a reason for hiding this comment

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

The UpdateMciInfo call lacks error handling. If the update fails, the function should handle the error appropriately rather than silently continuing.

Suggested change
UpdateMciInfo(nsId, mciTmp)
if err := UpdateMciInfo(nsId, mciTmp); err != nil {
log.Debug().Msgf("Failed to update MCI info for '%s': %v", mciId, err)
return nil, fmt.Errorf("failed to update MCI info: %w", err)
}

Copilot uses AI. Check for mistakes.
// start mci provisioning with StatusPreparing
mciTmp.Status = model.StatusPreparing
UpdateMciInfo(nsId, mciTmp)

Copy link

Copilot AI Aug 25, 2025

Choose a reason for hiding this comment

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

The UpdateMciInfo call lacks error handling. If the update fails, the function should handle the error appropriately rather than silently continuing.

Suggested change
if err := UpdateMciInfo(nsId, mciTmp); err != nil {
log.Error().Err(err).Msg("Failed to update MCI info with StatusPreparing")
return emptyMci, err
}

Copilot uses AI. Check for mistakes.

// marking the mci is in StatusPrepared
mciTmp.Status = model.StatusPrepared
UpdateMciInfo(nsId, mciTmp)
Copy link

Copilot AI Aug 25, 2025

Choose a reason for hiding this comment

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

The UpdateMciInfo call lacks error handling. If the update fails, the function should handle the error appropriately rather than silently continuing.

Suggested change
UpdateMciInfo(nsId, mciTmp)
if err := UpdateMciInfo(nsId, mciTmp); err != nil {
log.Error().Msgf("Failed to update MCI info for '%s': %s", mciTmp.Name, err.Error())
return emptyMci, fmt.Errorf("failed to update MCI info for '%s': %w", mciTmp.Name, err)
}

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 25, 2025
@cb-github-robot cb-github-robot merged commit ed75928 into cloud-barista:main Aug 25, 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