Skip to content

Commit

Permalink
fix: scsi ids changing on machines built with v2.6.x (#2115)
Browse files Browse the repository at this point in the history
Ref: #2089

Signed-off-by: Vasil Atanasov <[email protected]>
  • Loading branch information
vasilsatanasov authored Jan 16, 2024
1 parent 5d08466 commit cc7366c
Showing 1 changed file with 19 additions and 1 deletion.
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
}

0 comments on commit cc7366c

Please sign in to comment.