Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix duplicated network interfaces on ESXi provider (#1183)
Bug MTV-1291 describes an issue where, on ESXi providers, opening the modal dialog for changing the migration network for a host may display a list with multiple copies of the same network listed as options. This same issue was not observed with the vCenter endpoint type for the same provider. I managed to reproduce this behavior by simply starting a vm on the host. After the VM boots up, the ESXi provider will emit an ObjectUpdate for the host object which contains ChangeSets that assign new values to the list of PNICs, VNICs, portgroups, and vswitches for that host. It doesn't appear that these values have changed, so it's unclear why we're getting change notifications for them. But, the end result is that every time a vm is started, a duplicate list of networks is being appended to the current list of networks for the host. So when I started a VM 5 times on the host, the list of networks ended up with 5 duplicates of each network interface. When getting object updates from the ESXi server, object values that are array types (such as vswitch, portgroup, pnic, vnic), were being appended to our current list of values for those properties. But since the object update contains the entire list of values for those properties, this ended up adding duplicate values to our list. The solution to the issue is to *replace* our current array of networks with the values that we receive from the object update event rather than appending them to our current array. As far as I can tell, the vCenter provider doesn't seem to trigger the host object update event when a vm starts, which is why the same behavior was not seen for this provider type. But it seems that it would also be susceptible to the same bug if the update did ever occur. Fixes: https://issues.redhat.com/browse/MTV-1291 Signed-off-by: Jonathon Jongsma <[email protected]>
- Loading branch information