Add support to explicitly disable ENA support
If `ena_support` is set to false then it previously didn't do anything whereas now it will explicitly disable ENA support. Fixes #6852
This commit is contained in:
parent
50b0dd6381
commit
9e0fae9db3
|
@ -3,6 +3,7 @@ package common
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
|
@ -37,20 +38,24 @@ func (s *StepModifyEBSBackedInstance) Run(_ context.Context, state multistep.Sta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set EnaSupport to true.
|
// Handle EnaSupport flag.
|
||||||
// As of February 2017, this applies to C5, I3, P2, R4, X1, and m4.16xlarge
|
// As of February 2017, this applies to C5, I3, P2, R4, X1, and m4.16xlarge
|
||||||
|
var prefix string
|
||||||
if s.EnableAMIENASupport {
|
if s.EnableAMIENASupport {
|
||||||
ui.Say("Enabling Enhanced Networking (ENA)...")
|
prefix = "En"
|
||||||
_, err := ec2conn.ModifyInstanceAttribute(&ec2.ModifyInstanceAttributeInput{
|
} else {
|
||||||
InstanceId: instance.InstanceId,
|
prefix = "Dis"
|
||||||
EnaSupport: &ec2.AttributeBooleanValue{Value: aws.Bool(true)},
|
}
|
||||||
})
|
ui.Say(fmt.Sprintf("%sabling Enhanced Networking (ENA)...", prefix))
|
||||||
if err != nil {
|
_, err := ec2conn.ModifyInstanceAttribute(&ec2.ModifyInstanceAttributeInput{
|
||||||
err := fmt.Errorf("Error enabling Enhanced Networking (ENA) on %s: %s", *instance.InstanceId, err)
|
InstanceId: instance.InstanceId,
|
||||||
state.Put("error", err)
|
EnaSupport: &ec2.AttributeBooleanValue{Value: aws.Bool(s.EnableAMIENASupport)},
|
||||||
ui.Error(err.Error())
|
})
|
||||||
return multistep.ActionHalt
|
if err != nil {
|
||||||
}
|
err := fmt.Errorf("Error %sabling Enhanced Networking (ENA) on %s: %s", strings.ToLower(prefix), *instance.InstanceId, err)
|
||||||
|
state.Put("error", err)
|
||||||
|
ui.Error(err.Error())
|
||||||
|
return multistep.ActionHalt
|
||||||
}
|
}
|
||||||
|
|
||||||
return multistep.ActionContinue
|
return multistep.ActionContinue
|
||||||
|
|
Loading…
Reference in New Issue