Skip to content

Refactor Data types of struct fields#2316

Merged
cb-github-robot merged 1 commit intocloud-barista:mainfrom
seokho-son:main
Feb 13, 2026
Merged

Refactor Data types of struct fields#2316
cb-github-robot merged 1 commit intocloud-barista:mainfrom
seokho-son:main

Conversation

@seokho-son
Copy link
Copy Markdown
Member

Fixes #991

  • This change also reduces the need for type casting.
  • Asset backup is now included because the image information structure has changed.

This PR includes several breaking changes.
Apologies for that, but these changes should save you time in the long run.

Signed-off-by: Seokho Son <shsongist@gmail.com>
@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 Feb 13, 2026
@cb-github-robot cb-github-robot merged commit 5b49263 into cloud-barista:main Feb 13, 2026
8 checks passed
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 pull request refactors data types of struct fields across the codebase, changing from string-based representations to appropriate numeric types (int, float64) for fields that represent numeric values. The PR addresses issue #991, which identified that fields like MaxResultNum, VmGroupSize, VcpuSize, MemorySize, DiskSize, and others were using string types when numeric types would be more appropriate.

Changes:

  • Converted numeric fields from string to int/float64 types (SubGroupSize, SSHPort, RootDiskSize, node sizes, health checker settings, disk sizes, autoscaling thresholds, etc.)
  • Updated Swagger/OpenAPI documentation to reflect the new types
  • Modified configuration files (cloud_conf.yaml) to use numeric types
  • Fixed IdList mutex to use pointer type (*sync.Mutex) to avoid copy-locks issue
  • Enhanced image filtering logic to only mark available images as basic images
  • Updated asset files (extraction patterns and cloud image data)

Reviewed changes

Copilot reviewed 26 out of 28 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/core/model/vnet.go Changed VNetDetails fields to int (SubnetCount, HostsPerSubnet, UseFirstNZones)
src/core/model/spec.go Changed SpecInfo.RootDiskSize from string to int
src/core/model/nlb.go Changed NLB health checker fields (Interval, Timeout, Threshold) to int
src/core/model/mci.go Changed SubGroupSize, SSHPort, RootDiskSize, NumVMsToAdd, AutoCondition fields (Operand, EvaluationPeriod), Limit, Weight to appropriate numeric types
src/core/model/k8scluster.go Changed K8s node group size fields (DesiredNodeSize, MinNodeSize, MaxNodeSize) and RootDiskSize to int
src/core/model/datadisk.go Changed DiskSize fields from string to int
src/core/model/config.go Changed NLB settings and SubGroupSize to int in configuration model
src/core/model/common.go Fixed IdList.mux from sync.Mutex to *sync.Mutex with lazy initialization
src/core/resource/vnet.go Removed string-to-int conversions, now uses int fields directly
src/core/resource/spec.go Added conversion from string to int for RootDiskSize when processing Spider responses
src/core/resource/k8scluster.go Added int-to-string conversions when calling Spider API, string-to-int when receiving responses
src/core/resource/image.go Only mark images as basic if ImageStatus is Available
src/core/resource/datadisk.go Added conversions between int and string for Spider API interactions
src/core/infra/provisioning.go Updated provisioning logic with proper int handling, fixed loop boundaries, added conversions for Spider API
src/core/infra/remoteCommand.go Updated SSH port formatting to use int type
src/core/infra/recommendation.go Improved error handling for numeric operand parsing
src/core/infra/orchestration.go Removed unnecessary string conversions for evaluation period and operand
src/core/infra/monitoring.go Added int-to-string conversion for SSH port
src/core/infra/manageInfo.go Updated GetVmIp return type and SSHPort handling
src/core/infra/loadbalance.go Added conversions for health checker settings and SubGroupSize validation
src/core/infra/utility.go Updated SubGroupSize assignment to int
conf/cloud_conf.yaml Changed NLB settings from quoted strings to numeric values
src/interface/rest/docs/swagger.yaml Updated all API documentation to reflect new numeric types
src/interface/rest/docs/docs.go Updated generated Swagger documentation
assets/extractionpatterns.yaml Enhanced image filtering patterns (not directly related to type changes)
assets/cloudimage.csv Updated Azure cloud image data (not directly related to type changes)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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. asset

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data types of fields in core/mcis/

3 participants