Skip to content
New issue

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

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

Already on GitHub? # to your account

fix: Prevent unsupported traffic classes to be set and cause crash #1633

Merged
merged 1 commit into from
Mar 22, 2022
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
5 changes: 5 additions & 0 deletions vsphere/distributed_virtual_switch_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,11 @@ func expandSliceOfDvsHostInfrastructureTrafficResource(d *schema.ResourceData) [
// flattenSliceOfDvsHostInfrastructureTrafficResource reads in the supplied network I/O control allocation entries supplied via a respective DVSConfigInfo field and sets the appropriate keys in the supplied ResourceData.
func flattenSliceOfDvsHostInfrastructureTrafficResource(d *schema.ResourceData, s []types.DvsHostInfrastructureTrafficResource) error {
for _, v := range s {
if !stringInSlice(v.Key, infrastructureTrafficClassValues) {
// this would imply there are new classes introduced by the vCenter
// API but not yet supported by govmomi/provider
continue
}
if err := flattenDvsHostInfrastructureTrafficResource(d, v, v.Key); err != nil {
return err
}
Expand Down
10 changes: 10 additions & 0 deletions vsphere/util.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package vsphere

func stringInSlice(s string, list []string) bool {
for _, i := range list {
if i == s {
return true
}
}
return false
}
3 changes: 2 additions & 1 deletion website/docs/r/distributed_virtual_switch.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ pools, if their use is so desired.

#### Network I/O control traffic classes

There are currently 9 traffic classes that can be used for network I/O
There are currently 10 traffic classes that can be used for network I/O
tenthirtyam marked this conversation as resolved.
Show resolved Hide resolved
control - they are below.

Each of these classes has 4 options that can be tuned that are discussed in the
Expand All @@ -254,6 +254,7 @@ next section.
<tr><td>Virtual Machine Traffic</td><td>`virtualmachine`</td></tr>
<tr><td>vMotion Traffic</td><td>`vmotion`</td></tr>
<tr><td>VSAN Traffic</td><td>`vsan`</td></tr>
<tr><td>Backup NFC</td><td>`backupnfc`</td></tr>
</table>

#### Traffic class resource options
Expand Down