From f28c3877e3b087d321f2924c6b504ec1093dc29b Mon Sep 17 00:00:00 2001 From: Marin Salinas Date: Fri, 5 Apr 2019 16:06:17 -0600 Subject: [PATCH] refactor: remove unused attributes --- builder/osc/bsu/builder.go | 12 +++--------- builder/osc/bsusurrogate/builder.go | 20 +++----------------- builder/osc/chroot/builder.go | 8 +++----- builder/osc/common/omi_config.go | 2 -- builder/osc/common/step_source_omi_info.go | 8 +++----- 5 files changed, 12 insertions(+), 38 deletions(-) diff --git a/builder/osc/bsu/builder.go b/builder/osc/bsu/builder.go index c04e451c2..5c5a2fc20 100644 --- a/builder/osc/bsu/builder.go +++ b/builder/osc/bsu/builder.go @@ -108,11 +108,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { ForceDeregister: b.config.OMIForceDeregister, }, &osccommon.StepSourceOMIInfo{ - SourceOmi: b.config.SourceOmi, - EnableOMISriovNetSupport: b.config.OMISriovNetSupport, - EnableOMIENASupport: b.config.OMIENASupport, - OmiFilters: b.config.SourceOmiFilter, - OMIVirtType: b.config.OMIVirtType, //TODO: Remove if it is not used + SourceOmi: b.config.SourceOmi, + OmiFilters: b.config.SourceOmiFilter, + OMIVirtType: b.config.OMIVirtType, //TODO: Remove if it is not used }, &osccommon.StepNetworkInfo{ NetId: b.config.NetId, @@ -177,10 +175,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { Skip: false, DisableStopVm: b.config.DisableStopVm, }, - &osccommon.StepUpdateBSUBackedVm{ - EnableAMISriovNetSupport: b.config.OMISriovNetSupport, - EnableAMIENASupport: b.config.OMIENASupport, - }, &osccommon.StepDeregisterOMI{ AccessConfig: &b.config.AccessConfig, ForceDeregister: b.config.OMIForceDeregister, diff --git a/builder/osc/bsusurrogate/builder.go b/builder/osc/bsusurrogate/builder.go index bc6822b60..52b32130d 100644 --- a/builder/osc/bsusurrogate/builder.go +++ b/builder/osc/bsusurrogate/builder.go @@ -89,14 +89,6 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { errs = packer.MultiErrorAppend(errs, fmt.Errorf("no volume with name '%s' is found", b.config.RootDevice.SourceDeviceName)) } - //TODO: Chek if this is necessary - if b.config.IsSpotVm() && ((b.config.OMIENASupport != nil && *b.config.OMIENASupport) || b.config.OMISriovNetSupport) { - errs = packer.MultiErrorAppend(errs, - fmt.Errorf("Spot instances do not support modification, which is required "+ - "when either `ena_support` or `sriov_support` are set. Please ensure "+ - "you use an OMI that already has either SR-IOV or ENA enabled.")) - } - if errs != nil && len(errs.Errors) > 0 { return nil, errs } @@ -139,11 +131,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { ForceDeregister: b.config.OMIForceDeregister, }, &osccommon.StepSourceOMIInfo{ - SourceOmi: b.config.SourceOmi, - EnableOMISriovNetSupport: b.config.OMISriovNetSupport, - EnableOMIENASupport: b.config.OMIENASupport, - OmiFilters: b.config.SourceOmiFilter, - OMIVirtType: b.config.OMIVirtType, //TODO: Remove if it is not used + SourceOmi: b.config.SourceOmi, + OmiFilters: b.config.SourceOmiFilter, + OMIVirtType: b.config.OMIVirtType, //TODO: Remove if it is not used }, &osccommon.StepNetworkInfo{ NetId: b.config.NetId, @@ -208,10 +198,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { Skip: false, DisableStopVm: b.config.DisableStopVm, }, - &osccommon.StepUpdateBSUBackedVm{ - EnableAMISriovNetSupport: b.config.OMISriovNetSupport, - EnableAMIENASupport: b.config.OMIENASupport, - }, &StepSnapshotVolumes{ LaunchDevices: launchDevices, }, diff --git a/builder/osc/chroot/builder.go b/builder/osc/chroot/builder.go index c5bcf950d..8606bf0b8 100644 --- a/builder/osc/chroot/builder.go +++ b/builder/osc/chroot/builder.go @@ -228,11 +228,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook) (packer.Artifact, error) { if !b.config.FromScratch { steps = append(steps, &osccommon.StepSourceOMIInfo{ - SourceOmi: b.config.SourceOMI, - EnableOMISriovNetSupport: b.config.OMISriovNetSupport, - EnableOMIENASupport: b.config.OMIENASupport, - OmiFilters: b.config.SourceOMIFilter, - OMIVirtType: b.config.OMIVirtType, + SourceOmi: b.config.SourceOMI, + OmiFilters: b.config.SourceOMIFilter, + OMIVirtType: b.config.OMIVirtType, }, &StepCheckRootDevice{}, ) diff --git a/builder/osc/common/omi_config.go b/builder/osc/common/omi_config.go index 5e7b520fd..6ac8711b0 100644 --- a/builder/osc/common/omi_config.go +++ b/builder/osc/common/omi_config.go @@ -19,8 +19,6 @@ type OMIConfig struct { OMIRegions []string `mapstructure:"omi_regions"` OMISkipRegionValidation bool `mapstructure:"skip_region_validation"` OMITags TagMap `mapstructure:"tags"` - OMIENASupport *bool `mapstructure:"ena_support"` - OMISriovNetSupport bool `mapstructure:"sriov_support"` OMIForceDeregister bool `mapstructure:"force_deregister"` OMIForceDeleteSnapshot bool `mapstructure:"force_delete_snapshot"` SnapshotTags TagMap `mapstructure:"snapshot_tags"` diff --git a/builder/osc/common/step_source_omi_info.go b/builder/osc/common/step_source_omi_info.go index f602b5cc7..19ec926cc 100644 --- a/builder/osc/common/step_source_omi_info.go +++ b/builder/osc/common/step_source_omi_info.go @@ -18,11 +18,9 @@ import ( // Produces: // source_image *oapi.Image - the source OMI info type StepSourceOMIInfo struct { - SourceOmi string - EnableOMISriovNetSupport bool - EnableOMIENASupport *bool - OMIVirtType string - OmiFilters OmiFilterOptions + SourceOmi string + OMIVirtType string + OmiFilters OmiFilterOptions } type imageSort []oapi.Image