Merge pull request #7747 from chhaj5236/bugfix/refine_io_optimize

let product API determine the default value of io_optimized
This commit is contained in:
Adrien Delorme 2019-06-14 11:58:03 +02:00 committed by GitHub
commit cfda61b81f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 7 deletions

View File

@ -14,7 +14,7 @@ import (
type RunConfig struct { type RunConfig struct {
AssociatePublicIpAddress bool `mapstructure:"associate_public_ip_address"` AssociatePublicIpAddress bool `mapstructure:"associate_public_ip_address"`
ZoneId string `mapstructure:"zone_id"` ZoneId string `mapstructure:"zone_id"`
IOOptimized bool `mapstructure:"io_optimized"` IOOptimized *bool `mapstructure:"io_optimized"`
InstanceType string `mapstructure:"instance_type"` InstanceType string `mapstructure:"instance_type"`
Description string `mapstructure:"description"` Description string `mapstructure:"description"`
AlicloudSourceImage string `mapstructure:"source_image"` AlicloudSourceImage string `mapstructure:"source_image"`

View File

@ -17,7 +17,7 @@ import (
) )
type stepCreateAlicloudInstance struct { type stepCreateAlicloudInstance struct {
IOOptimized bool IOOptimized *bool
InstanceType string InstanceType string
UserData string UserData string
UserDataFile string UserDataFile string
@ -142,11 +142,13 @@ func (s *stepCreateAlicloudInstance) buildCreateInstanceRequest(state multistep.
request.InternetChargeType = s.InternetChargeType request.InternetChargeType = s.InternetChargeType
request.InternetMaxBandwidthOut = requests.Integer(convertNumber(s.InternetMaxBandwidthOut)) request.InternetMaxBandwidthOut = requests.Integer(convertNumber(s.InternetMaxBandwidthOut))
ioOptimized := IOOptimizedNone if s.IOOptimized != nil {
if s.IOOptimized { if *s.IOOptimized {
ioOptimized = IOOptimizedOptimized request.IoOptimized = IOOptimizedOptimized
} else {
request.IoOptimized = IOOptimizedNone
}
} }
request.IoOptimized = ioOptimized
config := state.Get("config").(*Config) config := state.Get("config").(*Config)
password := config.Comm.SSHPassword password := config.Comm.SSHPassword

View File

@ -218,7 +218,8 @@ builder.
error is returned. error is returned.
- `io_optimized` (boolean) - Whether an ECS instance is I/O optimized or not. - `io_optimized` (boolean) - Whether an ECS instance is I/O optimized or not.
The default value is `false`. If this option is not provided, the value will be determined by product API
according to what `instance_type` is used.
- `security_group_id` (string) - ID of the security group to which a newly - `security_group_id` (string) - ID of the security group to which a newly
created instance belongs. Mutual access is allowed between instances in one created instance belongs. Mutual access is allowed between instances in one