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

fix: scsi ids changing on machines built with v2.6.x #2115

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ func (r *NetworkInterfaceSubresource) Update(l object.VirtualDeviceList) ([]type
// in-place modification.
// A result of this is that if you have any SRIOV network interfaces, you
// cannot Update the count of non-SRIOV network interfaces.
if r.HasChange("adapter_type") || r.HasChange("physical_function") {
if r.HasChange("adapter_type") || physicalFunctionChanged(r) {
// Ensure network interfaces aren't changing adapter_type to or from sriov
if err := r.blockAdapterTypeChangeSriov(); err != nil {
return nil, err
Expand Down Expand Up @@ -1513,3 +1513,21 @@ func (r *NetworkInterfaceSubresource) assignEthernetCard(l object.VirtualDeviceL
}
return nil
}

func physicalFunctionChanged(r *NetworkInterfaceSubresource) bool {
old, n := r.GetChange("physical_function")
var oldVal, newVal string
if old == nil {
oldVal = ""
} else {
oldVal = old.(string)
}

if n == nil {
newVal = ""
} else {
newVal = n.(string)
}

return newVal != oldVal
}