Enable VlanID
This commit is contained in:
parent
b8554dad7d
commit
48b6cc0650
|
@ -11,7 +11,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type StepConfigureVlan struct {
|
type StepConfigureVlan struct {
|
||||||
vlanId string
|
VlanID string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepConfigureVlan) Run(state multistep.StateBag) multistep.StepAction {
|
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...")
|
ui.Say("Configuring vlan...")
|
||||||
|
|
||||||
vlanId := s.vlanId
|
vlanId := s.VlanID
|
||||||
|
|
||||||
if 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)
|
err := driver.SetNetworkAdapterVlanId(switchName, vlanId)
|
||||||
|
|
|
@ -87,6 +87,7 @@ type Config struct {
|
||||||
|
|
||||||
BootCommand []string `mapstructure:"boot_command"`
|
BootCommand []string `mapstructure:"boot_command"`
|
||||||
SwitchName string `mapstructure:"switch_name"`
|
SwitchName string `mapstructure:"switch_name"`
|
||||||
|
VlandID string `mapstructure:"vlan_id"`
|
||||||
Cpu uint `mapstructure:"cpu"`
|
Cpu uint `mapstructure:"cpu"`
|
||||||
Generation uint `mapstructure:"generation"`
|
Generation uint `mapstructure:"generation"`
|
||||||
EnableMacSpoofing bool `mapstructure:"enable_mac_spoofing"`
|
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,
|
IsoPaths: b.config.SecondaryDvdImages,
|
||||||
Generation: b.config.Generation,
|
Generation: b.config.Generation,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
&hypervcommon.StepConfigureVlan{
|
||||||
|
VlanID: b.config.VlandID,
|
||||||
|
},
|
||||||
|
|
||||||
&hypervcommon.StepRun{
|
&hypervcommon.StepRun{
|
||||||
BootWait: b.config.BootWait,
|
BootWait: b.config.BootWait,
|
||||||
|
|
Loading…
Reference in New Issue