Skip to content

migrate parsor package based multi referencing through layer#115

Open
kwonkwonn wants to merge 3 commits intomainfrom
refactor-interservice-referencing-from-createapi
Open

migrate parsor package based multi referencing through layer#115
kwonkwonn wants to merge 3 commits intomainfrom
refactor-interservice-referencing-from-createapi

Conversation

@kwonkwonn
Copy link
Contributor

@kwonkwonn kwonkwonn commented Mar 14, 2026

Type of Change

  • Bug fix
  • New feature
  • Refactor / tech debt
  • Docs / test

Summary

parsor 의 구조체를 api레이어에서도 참조하는 문제가 있었음.
이를 해결하기 위해 vm/types 를 통해 참조없는 순수 패키지를 만듦

Test Plan

  • make test passes
  • Manually verified on libvirt environment

Copy link

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 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/types package 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 accept vmtypes.VM_Init_Info.
  • Updated API create endpoint to decode into a new request model (CreateVMRequest) and convert to vmtypes.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
kwonkwonn and others added 2 commits March 14, 2026 21:03
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants