Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

去除cpumode检测 #199

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
40 changes: 20 additions & 20 deletions service/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ type RunInstancesInput struct {
// CPUMax's available values: 1, 2, 4, 8, 16
CPUMax *int `json:"cpu_max" name:"cpu_max" location:"params"`
// CPUModel's available values: Westmere, SandyBridge, IvyBridge, Haswell, Broadwell
CPUModel *string `json:"cpu_model" name:"cpu_model" default:"Westmere" location:"params"`
CPUModel *string `json:"cpu_model" name:"cpu_model" location:"params"`
Gpu *int `json:"gpu" name:"gpu" default:"0" location:"params"`
Hostname *string `json:"hostname" name:"hostname" location:"params"`
ImageID *string `json:"image_id" name:"image_id" location:"params"` // Required
Expand Down Expand Up @@ -643,25 +643,25 @@ func (v *RunInstancesInput) Validate() error {
}
}

if v.CPUModel != nil {
cpuModelValidValues := []string{"Westmere", "SandyBridge", "IvyBridge", "Haswell", "Broadwell"}
cpuModelParameterValue := fmt.Sprint(*v.CPUModel)

cpuModelIsValid := false
for _, value := range cpuModelValidValues {
if value == cpuModelParameterValue {
cpuModelIsValid = true
}
}

if !cpuModelIsValid {
return errors.ParameterValueNotAllowedError{
ParameterName: "CPUModel",
ParameterValue: cpuModelParameterValue,
AllowedValues: cpuModelValidValues,
}
}
}
//if v.CPUModel != nil {
// cpuModelValidValues := []string{"Westmere", "SandyBridge", "IvyBridge", "Haswell", "Broadwell"}
// cpuModelParameterValue := fmt.Sprint(*v.CPUModel)
//
// cpuModelIsValid := false
// for _, value := range cpuModelValidValues {
// if value == cpuModelParameterValue {
// cpuModelIsValid = true
// }
// }
//
// if !cpuModelIsValid {
// return errors.ParameterValueNotAllowedError{
// ParameterName: "CPUModel",
// ParameterValue: cpuModelParameterValue,
// AllowedValues: cpuModelValidValues,
// }
// }
//}

if v.ImageID == nil {
return errors.ParameterRequiredError{
Expand Down