oVirt / ovirt-engine

The oVirt Engine virtualization manager
Other
513 stars 268 forks source link

Fix unexpected exception on assigning labels on host networks #892

Closed sermakov-orion closed 10 months ago

sermakov-orion commented 10 months ago

Signed-off-by: Stepan Ermakov sermakov@orionsoft.ru

Changes introduced with this PR

This PR fixes the following issue: an error occurs while assigning labels on host network interfaces: "Error while executing action HostSetupNetworks: Unexpected exception" Steps to reproduce:

  1. Open "Compute->Hosts". List of hosts will be displayed.
  2. Click on any host and select "Network Interfaces" tab. Network interfaces of the selected host will be displayed.
  3. Click on "Setup Host Networks". "Setup Host Networks" modal dialog will be displayed.
  4. Click on "Labels". Labels of the host networks will be displayed.
  5. Drag-n-drop "New Label" on any network interface. Enter new label name and click "OK". New label will be added to the selected network.
  6. Click "OK" in the "Setup Host Networks" modal dialog.

Expected behavior The changes applied with no errors Current behavior The error message is displayed: "Error while executing action HostSetupNetworks: Unexpected exception". The new label was not added to the host network.

Background

  1. The HostSetupNetworksCommand verifies if there are changes made in the "Setup Host Networks" modal dialog (see HostSetupNetworksCommand.executeCommand, if (noChangesDetected()) statement).
  2. Since there are some changes (labels were added) it makes the HostSetupNetworks call to the host VDSM but passes empty payload inside the call (because there were no real changes of networks, just labels were changed). And VDSM fails with the Unexpected Error on the empty payload.
  3. In this PR I introduced additional check if (hasNetworkChanges()) that verifies whether the HostSetupNetworks call to the host VDSM is needed or not.

Are you the owner of the code you are sending in, or do you have permission of the owner?

y

michalskrivanek commented 10 months ago

LGTM though i'm not sure about the completeness of the changes that need to go to the actual host, @almusil wdyt?

sermakov-orion commented 10 months ago

@michalskrivanek let me add bit more clarity on why I decided not to go to the actual host in case when there no changes other than labels. The HostSetupNetworks VDSM command is invoked with parameters created by the HostSetupNetworksCommand.createSetupNetworksParameters method. And if you walk through this and underlying methods you may notice that they use everything from getParameters() but not getParametes().getLables() and getParameters().getRemovedLables(). So, It looks that HostSetupNetworks does not require any changes in labels.

sermakov-orion commented 10 months ago

Hi,

thank you for the patch. Please add an explanation to the commit message so it is clear in the history why this change was required.

Hi @almusil. I did this change as well as other mentioned here. Could you please do another round of the review?

almusil commented 10 months ago

/ost

almusil commented 10 months ago

/ost basic-suite-master el9stream