Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ Apache license 2.0,详情请看 [LICENSE](./LICENSE)。

## AI生成文档

[DeepWiki](https://deepwiki.com/yunionio/cloudpods) 提供了对本项目代码详细和全面的AI解读,可以参考。
[DeepWiki](https://deepwiki.com/yunionio/cloudpods) 和 [Zread](https://zread.ai/yunionio/cloudpods) 提供了对本项目代码详细和全面的AI解读,可以参考。
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,5 @@ Apache License 2.0. See [LICENSE](./LICENSE).

## AI-generated doc

[DeepWiki](https://deepwiki.com/yunionio/cloudpods) provides an amazing AI-generated doc of this project, you may refer to it for more detailed and comprehensive understanding of codes.
[DeepWiki](https://deepwiki.com/yunionio/cloudpods) and [Zread](https://zread.ai/yunionio/cloudpods) provide AI-generated docs of this project, you may refer to them for more detailed and comprehensive understanding of codes.

12 changes: 0 additions & 12 deletions pkg/apis/cloudprovider/doc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions pkg/apis/compute/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,56 @@ type DeployConfig struct {
Content string `json:"content"`
}

// ServerCreate输入参数主要检查规则如下:
// 1. 调用内部的 validateCreateData 方法对输入参数进行详细校验,包括镜像、磁盘、网络、主机名等基础信息的合法性和完整性。
// validateCreateData 详细校验规则:
// 基础参数校验:
// - 元数据条目不能超过20个
// - 实例快照和备份ID的有效性校验,保留用户输入的CPU、内存和实例类型配置
// - 密码强度校验,登录账户长度不超过32字符且格式合法
// - 实例组存在性校验,支持通过ID或名称指定
//
// 镜像和磁盘校验:
// - 检查所有磁盘镜像是否为虚拟机镜像的一部分
// - 非容器虚拟机必须提供启动磁盘或光驱
// - 系统磁盘不支持ISO镜像格式,需使用cdrom参数
// - 启动索引唯一性校验,避免重复
// - UEFI支持校验:ARM架构默认支持UEFI,UEFI镜像必须使用UEFI启动模式
// - 加密密钥与镜像加密密钥一致性校验
//
// 资源配置校验:
// - SKU配置校验,验证SKU存在性并从SKU获取内存和CPU配置
// - 内存和CPU配置合法性校验,内存不能为0,CPU默认为1
// - 根磁盘校验:NVMe设备不能作为根磁盘
// - 存储类型和大小校验,确保系统磁盘不小于最小值
//
// 网络配置校验:
// - 网络配置解析和合法性验证
// - 默认网关唯一性校验,确保只有一个默认网关
// - 自动设置默认网关(优先选择出口网络)
//
// 隔离设备校验:
// - GPU设备校验:NVIDIA vGPU数量不能超过1个,且不能与其他GPU同时使用
// - 备份虚拟机不支持隔离设备
//
// 安全组校验:
// - 根据虚拟化类型限制安全组数量
// - ESXi不支持安全组
//
// 计费配置校验:
// - 预付费资源类型不能创建预付费服务器
// - 计费周期合法性校验
// - 虚拟化类型对计费方式的支持性校验
//
// 其他校验:
// - 用户数据格式校验(根据操作系统类型)
// - 策略定义验证
// - 主机名格式校验
// - 云提供商和区域信息推断
//
// 2. 若校验通过,且实例不是系统虚拟机(IsSystem 字段为 nil 或 false),则会进一步检查配额(checkCreateQuota),确保资源配额充足。
// 3. 若上述校验均通过,则返回格式化后的参数 JSON 对象。
// 该方法确保了虚拟机实例创建时的参数符合平台要求,避免因参数错误导致的创建失败。
type ServerCreateInput struct {
apis.VirtualResourceCreateInput
DeletePreventableCreateInput
Expand Down
Loading