Add resource preparing and prepared statuses#2115
Add resource preparing and prepared statuses#2115cb-github-robot merged 1 commit intocloud-barista:mainfrom
Conversation
There was a problem hiding this comment.
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
StatusPreparingandStatusPreparedconstants 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) |
There was a problem hiding this comment.
The UpdateMciInfo call lacks error handling. If the update fails, the function should handle the error appropriately rather than silently continuing.
| 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) | |
| } |
| // start mci provisioning with StatusPreparing | ||
| mciTmp.Status = model.StatusPreparing | ||
| UpdateMciInfo(nsId, mciTmp) | ||
|
|
There was a problem hiding this comment.
The UpdateMciInfo call lacks error handling. If the update fails, the function should handle the error appropriately rather than silently continuing.
| if err := UpdateMciInfo(nsId, mciTmp); err != nil { | |
| log.Error().Err(err).Msg("Failed to update MCI info with StatusPreparing") | |
| return emptyMci, err | |
| } |
|
|
||
| // marking the mci is in StatusPrepared | ||
| mciTmp.Status = model.StatusPrepared | ||
| UpdateMciInfo(nsId, mciTmp) |
There was a problem hiding this comment.
The UpdateMciInfo call lacks error handling. If the update fails, the function should handle the error appropriately rather than silently continuing.
| 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) | |
| } |
|
/approve |
No description provided.