skus update

This commit is contained in:
TangBin
2018-12-01 12:47:21 +08:00
parent 19afa629e6
commit cec80f4a62
3 changed files with 13 additions and 8 deletions
+7 -4
View File
@@ -40,11 +40,13 @@ func init() {
CpuCoreCount int `help:"Cpu Count" required:"true" positional:"true"`
MemorySizeMB int `help:"Memory MB" required:"true" positional:"true"`
OsName *string `help:"OS name/type" choices:"Linux|Windows|Any" default:"Any"`
SkuFamily *string `help:"sku family"`
SkuCategory *string `help:"sku category" choices:"general_purpose|compute_optimized|memory_optimized|storage_optimized|hardware_accelerated|high_memory|high_storage"`
SysDiskResizable *bool `help:"system disk is resizable"`
SysDiskMaxSizeGB *int `help:"system disk maximal size in gb"`
SysDiskResizable *bool `help:"system disk is resizable"`
SysDiskType *string `help:"system disk type" default:"local" choices:"local"`
SysDiskMaxSizeGB *int `help:"system disk maximal size in gb"`
AttachedDiskType *string `help:"attached data disk type"`
AttachedDiskSizeGB *int `help:"attached data disk size in GB"`
@@ -59,8 +61,9 @@ func init() {
GPUCount *int `help:"GPU count"`
GPUAttachable *bool `help:"Allow attach GPU"`
Zone *string `help:"Zone ID or name"`
Region *string `help:"Region ID or name"`
Zone *string `help:"Zone ID or name"`
Region *string `help:"Region ID or name"`
Provider *string `help:"Provider name" choices:"kvm|esxi"`
}
R(&ServerSkusCreateOptions{}, "server-sku-create", "Create a server sku record", func(s *mcclient.ClientSession, args *ServerSkusCreateOptions) error {
params, err := options.StructToParams(args)
+3 -1
View File
@@ -797,7 +797,9 @@ func (manager *SGuestManager) ValidateCreateData(ctx context.Context, userCred m
sku_id, _ := data.GetString("sku_id")
if len(sku_id) > 0 {
sku_id, vcpuCount, vmemSize, err := validateSkuData(sku_id)
if err != nil {
if err == sql.ErrNoRows {
return nil, httperrors.NewResourceNotFoundError2("sku_id", sku_id)
} else if err != nil {
return nil, err
}
+3 -3
View File
@@ -48,15 +48,15 @@ type SServerSku struct {
// SkuId string `width:"64" charset:"ascii" nullable:"false" list:"user" create:"admin_required"` // x2.large
InstanceTypeFamily string `width:"32" charset:"ascii" nullable:"false" list:"user" create:"admin_optional" update:"admin"` // x2
InstanceTypeCategory string `width:"32" charset:"utf8" nullable:"false" list:"user" create:"admin_optional" update:"admin"` // 通用型
InstanceTypeCategory string `width:"32" charset:"utf8" nullable:"false" list:"user" create:"admin_optional" update:"admin"` // 通用型
CpuCoreCount int `nullable:"false" list:"user" create:"admin_required" update:"admin"`
MemorySizeMB int `nullable:"false" list:"user" create:"admin_required" update:"admin"`
OsName string `width:"32" charset:"ascii" nullable:"false" list:"user" create:"admin_required" update:"admin"` // windows|linux|any
OsName string `width:"32" charset:"ascii" nullable:"false" list:"user" create:"admin_required" update:"admin" default:"Any"` // Windows|Linux|Any
SysDiskResizable bool `default:"true" nullable:"false" list:"user" create:"admin_optional" update:"admin"`
SysDiskType string `width:"32" charset:"ascii" nullable:"false" list:"user" create:"admin_required" update:"admin"`
SysDiskType string `width:"32" charset:"ascii" nullable:"false" list:"user" create:"admin_required" update:"admin" default:"local"`
SysDiskMinSizeGB int `nullable:"false" list:"user" create:"admin_optional" update:"admin"` // not required。 windows比较新的版本都是50G左右。
SysDiskMaxSizeGB int `nullable:"false" list:"user" create:"admin_optional" update:"admin"` // not required