Merge pull request #4578 from life360/enable_ena
Always set both SRIOV and ENA when Enhanced Networking is enabled
This commit is contained in:
commit
61976dfd86
|
@ -75,9 +75,14 @@ func (s *StepRegisterAMI) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
registerOpts = buildRegisterOpts(config, image, newMappings)
|
registerOpts = buildRegisterOpts(config, image, newMappings)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set SriovNetSupport to "simple". See http://goo.gl/icuXh5
|
|
||||||
if config.AMIEnhancedNetworking {
|
if config.AMIEnhancedNetworking {
|
||||||
|
// Set SriovNetSupport to "simple". See http://goo.gl/icuXh5
|
||||||
|
// As of February 2017, this applies to C3, C4, D2, I2, R3, and M4 (excluding m4.16xlarge)
|
||||||
registerOpts.SriovNetSupport = aws.String("simple")
|
registerOpts.SriovNetSupport = aws.String("simple")
|
||||||
|
|
||||||
|
// Set EnaSupport to true
|
||||||
|
// As of February 2017, this applies to C5, I3, P2, R4, X1, and m4.16xlarge
|
||||||
|
registerOpts.EnaSupport = aws.Bool(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
registerResp, err := ec2conn.RegisterImage(registerOpts)
|
registerResp, err := ec2conn.RegisterImage(registerOpts)
|
||||||
|
|
|
@ -17,16 +17,32 @@ func (s *StepModifyEBSBackedInstance) Run(state multistep.StateBag) multistep.St
|
||||||
instance := state.Get("instance").(*ec2.Instance)
|
instance := state.Get("instance").(*ec2.Instance)
|
||||||
ui := state.Get("ui").(packer.Ui)
|
ui := state.Get("ui").(packer.Ui)
|
||||||
|
|
||||||
// Set SriovNetSupport to "simple". See http://goo.gl/icuXh5
|
|
||||||
if s.EnableEnhancedNetworking {
|
if s.EnableEnhancedNetworking {
|
||||||
ui.Say("Enabling Enhanced Networking...")
|
// Set SriovNetSupport to "simple". See http://goo.gl/icuXh5
|
||||||
|
// As of February 2017, this applies to C3, C4, D2, I2, R3, and M4 (excluding m4.16xlarge)
|
||||||
|
ui.Say("Enabling Enhanced Networking (SR-IOV)...")
|
||||||
simple := "simple"
|
simple := "simple"
|
||||||
_, err := ec2conn.ModifyInstanceAttribute(&ec2.ModifyInstanceAttributeInput{
|
_, err_iov := ec2conn.ModifyInstanceAttribute(&ec2.ModifyInstanceAttributeInput{
|
||||||
InstanceId: instance.InstanceId,
|
InstanceId: instance.InstanceId,
|
||||||
SriovNetSupport: &ec2.AttributeValue{Value: &simple},
|
SriovNetSupport: &ec2.AttributeValue{Value: &simple},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err_iov != nil {
|
||||||
err := fmt.Errorf("Error enabling Enhanced Networking on %s: %s", *instance.InstanceId, err)
|
err := fmt.Errorf("Error enabling Enhanced Networking (SR-IOV) on %s: %s", *instance.InstanceId, err_iov)
|
||||||
|
state.Put("error", err)
|
||||||
|
ui.Error(err.Error())
|
||||||
|
return multistep.ActionHalt
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set EnaSupport to true.
|
||||||
|
// As of February 2017, this applies to C5, I3, P2, R4, X1, and m4.16xlarge
|
||||||
|
ui.Say("Enabling Enhanced Networking (ENA)...")
|
||||||
|
truthy := true
|
||||||
|
_, err_ena := ec2conn.ModifyInstanceAttribute(&ec2.ModifyInstanceAttributeInput{
|
||||||
|
InstanceId: instance.InstanceId,
|
||||||
|
EnaSupport: &ec2.AttributeBooleanValue{Value: &truthy},
|
||||||
|
})
|
||||||
|
if err_ena != nil {
|
||||||
|
err := fmt.Errorf("Error enabling Enhanced Networking (ENA) on %s: %s", *instance.InstanceId, err_ena)
|
||||||
state.Put("error", err)
|
state.Put("error", err)
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
|
|
|
@ -101,7 +101,7 @@ func (s *StepSourceAMIInfo) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
|
|
||||||
ui.Message(fmt.Sprintf("Found Image ID: %s", *image.ImageId))
|
ui.Message(fmt.Sprintf("Found Image ID: %s", *image.ImageId))
|
||||||
|
|
||||||
// Enhanced Networking (SriovNetSupport) can only be enabled on HVM AMIs.
|
// Enhanced Networking can only be enabled on HVM AMIs.
|
||||||
// See http://goo.gl/icuXh5
|
// See http://goo.gl/icuXh5
|
||||||
if s.EnhancedNetworking && *image.VirtualizationType != "hvm" {
|
if s.EnhancedNetworking && *image.VirtualizationType != "hvm" {
|
||||||
err := fmt.Errorf("Cannot enable enhanced networking, source AMI '%s' is not HVM", s.SourceAmi)
|
err := fmt.Errorf("Cannot enable enhanced networking, source AMI '%s' is not HVM", s.SourceAmi)
|
||||||
|
|
|
@ -35,9 +35,14 @@ func (s *StepRegisterAMI) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
BlockDeviceMappings: blockDevices,
|
BlockDeviceMappings: blockDevices,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set SriovNetSupport to "simple". See http://goo.gl/icuXh5
|
|
||||||
if config.AMIEnhancedNetworking {
|
if config.AMIEnhancedNetworking {
|
||||||
|
// Set SriovNetSupport to "simple". See http://goo.gl/icuXh5
|
||||||
|
// As of February 2017, this applies to C3, C4, D2, I2, R3, and M4 (excluding m4.16xlarge)
|
||||||
registerOpts.SriovNetSupport = aws.String("simple")
|
registerOpts.SriovNetSupport = aws.String("simple")
|
||||||
|
|
||||||
|
// Set EnaSupport to true
|
||||||
|
// As of February 2017, this applies to C5, I3, P2, R4, X1, and m4.16xlarge
|
||||||
|
registerOpts.EnaSupport = aws.Bool(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
registerResp, err := ec2conn.RegisterImage(registerOpts)
|
registerResp, err := ec2conn.RegisterImage(registerOpts)
|
||||||
|
|
|
@ -29,9 +29,14 @@ func (s *StepRegisterAMI) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
registerOpts.VirtualizationType = aws.String(config.AMIVirtType)
|
registerOpts.VirtualizationType = aws.String(config.AMIVirtType)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set SriovNetSupport to "simple". See http://goo.gl/icuXh5
|
|
||||||
if config.AMIEnhancedNetworking {
|
if config.AMIEnhancedNetworking {
|
||||||
|
// Set SriovNetSupport to "simple". See http://goo.gl/icuXh5
|
||||||
|
// As of February 2017, this applies to C3, C4, D2, I2, R3, and M4 (excluding m4.16xlarge)
|
||||||
registerOpts.SriovNetSupport = aws.String("simple")
|
registerOpts.SriovNetSupport = aws.String("simple")
|
||||||
|
|
||||||
|
// Set EnaSupport to true.
|
||||||
|
// As of February 2017, this applies to C5, I3, P2, R4, X1, and m4.16xlarge
|
||||||
|
registerOpts.EnaSupport = aws.Bool(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
registerResp, err := ec2conn.RegisterImage(registerOpts)
|
registerResp, err := ec2conn.RegisterImage(registerOpts)
|
||||||
|
|
|
@ -122,7 +122,7 @@ each category, the available configuration keys are alphabetized.
|
||||||
forces Packer to find an open device automatically.
|
forces Packer to find an open device automatically.
|
||||||
|
|
||||||
- `enhanced_networking` (boolean) - Enable enhanced
|
- `enhanced_networking` (boolean) - Enable enhanced
|
||||||
networking (SriovNetSupport) on HVM-compatible AMIs. If true, add
|
networking (SriovNetSupport and ENA) on HVM-compatible AMIs. If true, add
|
||||||
`ec2:ModifyInstanceAttribute` to your AWS IAM policy.
|
`ec2:ModifyInstanceAttribute` to your AWS IAM policy.
|
||||||
|
|
||||||
- `force_deregister` (boolean) - Force Packer to first deregister an existing
|
- `force_deregister` (boolean) - Force Packer to first deregister an existing
|
||||||
|
|
|
@ -161,7 +161,7 @@ builder.
|
||||||
Default `false`.
|
Default `false`.
|
||||||
|
|
||||||
- `enhanced_networking` (boolean) - Enable enhanced
|
- `enhanced_networking` (boolean) - Enable enhanced
|
||||||
networking (SriovNetSupport) on HVM-compatible AMIs. If true, add
|
networking (SriovNetSupport and ENA) on HVM-compatible AMIs. If true, add
|
||||||
`ec2:ModifyInstanceAttribute` to your AWS IAM policy.
|
`ec2:ModifyInstanceAttribute` to your AWS IAM policy.
|
||||||
|
|
||||||
- `force_deregister` (boolean) - Force Packer to first deregister an existing
|
- `force_deregister` (boolean) - Force Packer to first deregister an existing
|
||||||
|
|
|
@ -100,7 +100,7 @@ builder.
|
||||||
Default `false`.
|
Default `false`.
|
||||||
|
|
||||||
- `enhanced_networking` (boolean) - Enable enhanced
|
- `enhanced_networking` (boolean) - Enable enhanced
|
||||||
networking (SriovNetSupport) on HVM-compatible AMIs. If true, add
|
networking (SriovNetSupport and ENA) on HVM-compatible AMIs. If true, add
|
||||||
`ec2:ModifyInstanceAttribute` to your AWS IAM policy.
|
`ec2:ModifyInstanceAttribute` to your AWS IAM policy.
|
||||||
|
|
||||||
- `iam_instance_profile` (string) - The name of an [IAM instance
|
- `iam_instance_profile` (string) - The name of an [IAM instance
|
||||||
|
|
|
@ -185,7 +185,7 @@ builder.
|
||||||
Default `false`.
|
Default `false`.
|
||||||
|
|
||||||
- `enhanced_networking` (boolean) - Enable enhanced
|
- `enhanced_networking` (boolean) - Enable enhanced
|
||||||
networking (SriovNetSupport) on HVM-compatible AMIs. If true, add
|
networking (SriovNetSupport and ENA) on HVM-compatible AMIs. If true, add
|
||||||
`ec2:ModifyInstanceAttribute` to your AWS IAM policy.
|
`ec2:ModifyInstanceAttribute` to your AWS IAM policy.
|
||||||
|
|
||||||
- `force_deregister` (boolean) - Force Packer to first deregister an existing
|
- `force_deregister` (boolean) - Force Packer to first deregister an existing
|
||||||
|
|
Loading…
Reference in New Issue