Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing port group resource to enable LACP only in virtual switch, not in port group. #1214

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vsphere/distributed_port_group_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func expandDVPortgroupConfigSpec(d *schema.ResourceData) types.DVPortgroupConfig
Name: d.Get("name").(string),
NumPorts: int32(d.Get("number_of_ports").(int)),
PortNameFormat: d.Get("port_name_format").(string),
DefaultPortConfig: expandVMwareDVSPortSetting(d),
DefaultPortConfig: expandVMwareDVSPortSetting(d, "distributed_port_group"),
Description: d.Get("description").(string),
Type: d.Get("type").(string),
Policy: expandVMwareDVSPortgroupPolicy(d),
Expand Down
8 changes: 6 additions & 2 deletions vsphere/distributed_virtual_port_setting_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,11 @@ func flattenDVSTrafficShapingPolicyEgress(d *schema.ResourceData, obj *types.DVS

// expandVMwareDVSPortSetting reads certain ResourceData keys and
// returns a VMwareDVSPortSetting.
func expandVMwareDVSPortSetting(d *schema.ResourceData) *types.VMwareDVSPortSetting {
func expandVMwareDVSPortSetting(d *schema.ResourceData, resourceType string) *types.VMwareDVSPortSetting {
var lacpPolicy *types.VMwareUplinkLacpPolicy = nil
if resourceType == "distributed_virtual_switch" {
lacpPolicy = expandVMwareUplinkLacpPolicy(d)
}
obj := &types.VMwareDVSPortSetting{
DVPortSetting: types.DVPortSetting{
Blocked: structure.GetBoolPolicy(d, "block_all_ports"),
Expand All @@ -569,7 +573,7 @@ func expandVMwareDVSPortSetting(d *schema.ResourceData) *types.VMwareDVSPortSett
SecurityPolicy: expandDVSSecurityPolicy(d),
IpfixEnabled: structure.GetBoolPolicy(d, "netflow_enabled"),
TxUplink: structure.GetBoolPolicy(d, "tx_uplink"),
LacpPolicy: expandVMwareUplinkLacpPolicy(d),
LacpPolicy: lacpPolicy,
}

if structure.AllFieldsEmpty(obj) {
Expand Down
2 changes: 1 addition & 1 deletion vsphere/distributed_virtual_switch_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ func expandVMwareDVSConfigSpec(d *schema.ResourceData) *types.VMwareDVSConfigSpe
DVSConfigSpec: types.DVSConfigSpec{
Name: d.Get("name").(string),
ConfigVersion: d.Get("config_version").(string),
DefaultPortConfig: expandVMwareDVSPortSetting(d),
DefaultPortConfig: expandVMwareDVSPortSetting(d, "distributed_virtual_switch"),
Host: expandSliceOfDistributedVirtualSwitchHostMemberConfigSpec(d),
Description: d.Get("description").(string),
Contact: expandDVSContactInfo(d),
Expand Down