|
|
|
|
@ -17,16 +17,32 @@ func (s *StepModifyEBSBackedInstance) Run(state multistep.StateBag) multistep.St
|
|
|
|
|
instance := state.Get("instance").(*ec2.Instance)
|
|
|
|
|
ui := state.Get("ui").(packer.Ui)
|
|
|
|
|
|
|
|
|
|
// Set SriovNetSupport to "simple". See http://goo.gl/icuXh5
|
|
|
|
|
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"
|
|
|
|
|
_, err := ec2conn.ModifyInstanceAttribute(&ec2.ModifyInstanceAttributeInput{
|
|
|
|
|
_, err_iov := ec2conn.ModifyInstanceAttribute(&ec2.ModifyInstanceAttributeInput{
|
|
|
|
|
InstanceId: instance.InstanceId,
|
|
|
|
|
SriovNetSupport: &ec2.AttributeValue{Value: &simple},
|
|
|
|
|
})
|
|
|
|
|
if err != nil {
|
|
|
|
|
err := fmt.Errorf("Error enabling Enhanced Networking on %s: %s", *instance.InstanceId, err)
|
|
|
|
|
if err_iov != nil {
|
|
|
|
|
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)
|
|
|
|
|
ui.Error(err.Error())
|
|
|
|
|
return multistep.ActionHalt
|
|
|
|
|
|