Reconstruct resource ID mapping logic for VM registration#2276
Reconstruct resource ID mapping logic for VM registration#2276cb-github-robot merged 1 commit intocloud-barista:mainfrom
Conversation
seokho-son
left a comment
There was a problem hiding this comment.
@leehyeoklee LGTM in general. I just have a question. :)
| idField := item.FieldByName("Id") | ||
| if idField.IsValid() { | ||
| return idField.String(), item.Interface() | ||
| } |
There was a problem hiding this comment.
Can we avoid utilizing reflect here?
I guess reflect may reduce performance (it is nature of the reflect), stability (unmatched case handling if item.FieldByName("ConnectionName").String() == requestBody.ConnectionName {, and code maintenance (for instance, "ConnectionName" can be refactored. if item.FieldByName("ConnectionName").String()) of the system
There was a problem hiding this comment.
I fully agree with your concerns regarding performance and maintainability.
Although the code looks a bit repetitive now, I have removed the reflect logic and reverted to the explicit approach to prioritize type safety and stability
24bc102 to
62dd14d
Compare
|
/approve |
Description:
This PR updates the VM registration logic to accurately reconstruct resource relationships and ensures data consistency when registering existing CSP VMs.
🚀 Key Changes
1. Expanded Resource Reconstruction
Before:
VNet(partial) andSSHKeywere mapped during registration.After:
SubnetIdby iterating through the matched VNet's internal subnet list.2. Fixed Resource Lookup Type
NameId(incorrect) toSystemId(CSP Resource ID).3. Enabled Association Updates
UpdateAssociatedObjectListto support the "register" option.