Skip to content

Commit

Permalink
Merge pull request #69 from chhaj5236/bugfix/refine_io_optimize
Browse files Browse the repository at this point in the history
let product API determine the default value of io_optimized
  • Loading branch information
chhaj5236 authored Jun 17, 2019
2 parents 867bd3c + 984291f commit 3a645fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ecs/run_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
type RunConfig struct {
AssociatePublicIpAddress bool `mapstructure:"associate_public_ip_address"`
ZoneId string `mapstructure:"zone_id"`
IOOptimized bool `mapstructure:"io_optimized"`
IOOptimized *bool `mapstructure:"io_optimized"`
InstanceType string `mapstructure:"instance_type"`
Description string `mapstructure:"description"`
AlicloudSourceImage string `mapstructure:"source_image"`
Expand Down
12 changes: 7 additions & 5 deletions ecs/step_create_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

type stepCreateAlicloudInstance struct {
IOOptimized bool
IOOptimized *bool
InstanceType string
UserData string
UserDataFile string
Expand Down Expand Up @@ -142,11 +142,13 @@ func (s *stepCreateAlicloudInstance) buildCreateInstanceRequest(state multistep.
request.InternetChargeType = s.InternetChargeType
request.InternetMaxBandwidthOut = requests.Integer(convertNumber(s.InternetMaxBandwidthOut))

ioOptimized := IOOptimizedNone
if s.IOOptimized {
ioOptimized = IOOptimizedOptimized
if s.IOOptimized != nil {
if *s.IOOptimized {
request.IoOptimized = IOOptimizedOptimized
} else {
request.IoOptimized = IOOptimizedNone
}
}
request.IoOptimized = ioOptimized

config := state.Get("config").(*Config)
password := config.Comm.SSHPassword
Expand Down

0 comments on commit 3a645fe

Please sign in to comment.