migrate parsor package based multi referencing through layer#115
Open
migrate parsor package based multi referencing through layer#115
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors VM creation-related data structures to remove cross-layer coupling (notably API ↔ vm/parsor) by introducing a shared, dependency-light types package (vm/types) and updating creation/parsor code to consume it.
Changes:
- Added
vm/typespackage and moved VM init spec structs there (VM_Init_Info,HardwareInfo,User_info_VM). - Updated VM creation flow (
vm/service/creation,vm/parsor, cloud-init) to acceptvmtypes.VM_Init_Info. - Updated API create endpoint to decode into a new request model (
CreateVMRequest) and convert tovmtypes.VM_Init_Info.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| vm/types/vm.go | Introduces shared VM init spec types intended for cross-layer use. |
| vm/service/creation/local_domain.go | Updates config factory to accept vmtypes.VM_Init_Info. |
| vm/service/creation/create_type.go | Switches localConfigurer.VMDescription to vmtypes.VM_Init_Info. |
| vm/parsor/XML_Parsor.go | Updates XML generation entrypoints to use vmtypes.VM_Init_Info. |
| vm/parsor/type.go | Removes VM_Init_Info definitions from parsor package. |
| vm/parsor/xml_parsor_test.go | Adjusts tests to build specs via vmtypes. |
| vm/parsor/cloud-init/userConf.go | Updates cloud-init parsers to accept vmtypes.VM_Init_Info. |
| vm/parsor/cloud-init/userConf_test.go | Updates tests to use vmtypes.VM_Init_Info. |
| api/create_model.go | Adds API request model for VM creation + conversion to vmtypes. |
| api/status_model.go | Removes DomainBootRequest from status models. |
| api/Create.go | Uses CreateVMRequest and passes converted vmtypes to creation layer. |
| api/utils.go | Removes domainConGetter helper from API utils. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
api/Create.go
Outdated
Comment on lines
62
to
66
| domainExisting, _ := i.DomainControl.GetDomain(param.UUID) | ||
| if domainExisting != nil { | ||
| resp.ResponseWriteErr(w, nil, http.StatusBadRequest) | ||
| i.Logger.Error("error handling creating vm, domain already exists", zap.String("uuid", param.UUID)) | ||
| return |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Summary
parsor 의 구조체를 api레이어에서도 참조하는 문제가 있었음.
이를 해결하기 위해 vm/types 를 통해 참조없는 순수 패키지를 만듦
Test Plan
make testpasses