Enable VlanID

This commit is contained in:
James Johnson 2016-09-21 18:31:06 +00:00 committed by Taliesin Sisson
parent b8554dad7d
commit 48b6cc0650
2 changed files with 9 additions and 3 deletions

View File

@ -11,7 +11,7 @@ import (
)
type StepConfigureVlan struct {
vlanId string
VlanID string
}
func (s *StepConfigureVlan) Run(state multistep.StateBag) multistep.StepAction {
@ -24,10 +24,11 @@ func (s *StepConfigureVlan) Run(state multistep.StateBag) multistep.StepAction {
ui.Say("Configuring vlan...")
vlanId := s.vlanId
vlanId := s.VlanID
if vlanId == "" {
vlanId = "1724"
// If no vlan ID is specified, do not enable Virtual LAN Identification
return multistep.ActionContinue
}
err := driver.SetNetworkAdapterVlanId(switchName, vlanId)

View File

@ -87,6 +87,7 @@ type Config struct {
BootCommand []string `mapstructure:"boot_command"`
SwitchName string `mapstructure:"switch_name"`
VlandID string `mapstructure:"vlan_id"`
Cpu uint `mapstructure:"cpu"`
Generation uint `mapstructure:"generation"`
EnableMacSpoofing bool `mapstructure:"enable_mac_spoofing"`
@ -353,6 +354,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
IsoPaths: b.config.SecondaryDvdImages,
Generation: b.config.Generation,
},
&hypervcommon.StepConfigureVlan{
VlanID: b.config.VlandID,
},
&hypervcommon.StepRun{
BootWait: b.config.BootWait,