summaryrefslogtreecommitdiff
path: root/vendor/github.com/mitchellh/packer/builder/amazon/chroot
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/mitchellh/packer/builder/amazon/chroot')
-rw-r--r--vendor/github.com/mitchellh/packer/builder/amazon/chroot/builder.go14
-rw-r--r--vendor/github.com/mitchellh/packer/builder/amazon/chroot/lockfile_unix.go7
-rw-r--r--vendor/github.com/mitchellh/packer/builder/amazon/chroot/step_register_ami.go9
3 files changed, 20 insertions, 10 deletions
diff --git a/vendor/github.com/mitchellh/packer/builder/amazon/chroot/builder.go b/vendor/github.com/mitchellh/packer/builder/amazon/chroot/builder.go
index 65660cf4..a259960d 100644
--- a/vendor/github.com/mitchellh/packer/builder/amazon/chroot/builder.go
+++ b/vendor/github.com/mitchellh/packer/builder/amazon/chroot/builder.go
@@ -213,9 +213,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
if !b.config.FromScratch {
steps = append(steps,
&awscommon.StepSourceAMIInfo{
- SourceAmi: b.config.SourceAmi,
- EnhancedNetworking: b.config.AMIEnhancedNetworking,
- AmiFilters: b.config.SourceAmiFilter,
+ SourceAmi: b.config.SourceAmi,
+ EnableAMISriovNetSupport: b.config.AMISriovNetSupport,
+ EnableAMIENASupport: b.config.AMIENASupport,
+ AmiFilters: b.config.SourceAmiFilter,
},
&StepCheckRootDevice{},
)
@@ -245,17 +246,22 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
&StepEarlyCleanup{},
&StepSnapshot{},
&awscommon.StepDeregisterAMI{
+ AccessConfig: &b.config.AccessConfig,
ForceDeregister: b.config.AMIForceDeregister,
ForceDeleteSnapshot: b.config.AMIForceDeleteSnapshot,
AMIName: b.config.AMIName,
+ Regions: b.config.AMIRegions,
},
&StepRegisterAMI{
- RootVolumeSize: b.config.RootVolumeSize,
+ RootVolumeSize: b.config.RootVolumeSize,
+ EnableAMISriovNetSupport: b.config.AMISriovNetSupport,
+ EnableAMIENASupport: b.config.AMIENASupport,
},
&awscommon.StepCreateEncryptedAMICopy{
KeyID: b.config.AMIKmsKeyId,
EncryptBootVolume: b.config.AMIEncryptBootVolume,
Name: b.config.AMIName,
+ AMIMappings: b.config.AMIBlockDevices.AMIMappings,
},
&awscommon.StepAMIRegionCopy{
AccessConfig: &b.config.AccessConfig,
diff --git a/vendor/github.com/mitchellh/packer/builder/amazon/chroot/lockfile_unix.go b/vendor/github.com/mitchellh/packer/builder/amazon/chroot/lockfile_unix.go
index 43e92af2..0d0f8c8f 100644
--- a/vendor/github.com/mitchellh/packer/builder/amazon/chroot/lockfile_unix.go
+++ b/vendor/github.com/mitchellh/packer/builder/amazon/chroot/lockfile_unix.go
@@ -4,7 +4,8 @@ package chroot
import (
"os"
- "syscall"
+
+ "golang.org/x/sys/unix"
)
// See: http://linux.die.net/include/sys/file.h
@@ -13,7 +14,7 @@ const LOCK_NB = 4
const LOCK_UN = 8
func lockFile(f *os.File) error {
- err := syscall.Flock(int(f.Fd()), LOCK_EX)
+ err := unix.Flock(int(f.Fd()), LOCK_EX)
if err != nil {
return err
}
@@ -22,5 +23,5 @@ func lockFile(f *os.File) error {
}
func unlockFile(f *os.File) error {
- return syscall.Flock(int(f.Fd()), LOCK_UN)
+ return unix.Flock(int(f.Fd()), LOCK_UN)
}
diff --git a/vendor/github.com/mitchellh/packer/builder/amazon/chroot/step_register_ami.go b/vendor/github.com/mitchellh/packer/builder/amazon/chroot/step_register_ami.go
index d387eada..a19266f5 100644
--- a/vendor/github.com/mitchellh/packer/builder/amazon/chroot/step_register_ami.go
+++ b/vendor/github.com/mitchellh/packer/builder/amazon/chroot/step_register_ami.go
@@ -12,7 +12,9 @@ import (
// StepRegisterAMI creates the AMI.
type StepRegisterAMI struct {
- RootVolumeSize int64
+ RootVolumeSize int64
+ EnableAMIENASupport bool
+ EnableAMISriovNetSupport bool
}
func (s *StepRegisterAMI) Run(state multistep.StateBag) multistep.StepAction {
@@ -75,11 +77,12 @@ func (s *StepRegisterAMI) Run(state multistep.StateBag) multistep.StepAction {
registerOpts = buildRegisterOpts(config, image, newMappings)
}
- if config.AMIEnhancedNetworking {
+ if s.EnableAMISriovNetSupport {
// 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")
-
+ }
+ if s.EnableAMIENASupport {
// Set EnaSupport to true
// As of February 2017, this applies to C5, I3, P2, R4, X1, and m4.16xlarge
registerOpts.EnaSupport = aws.Bool(true)