-
Notifications
You must be signed in to change notification settings - Fork 270
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 unexpected exception on assigning labels on host networks #892
Conversation
LGTM though i'm not sure about the completeness of the changes that need to go to the actual host, @almusil wdyt? |
@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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
|
||
if (succeeded) { | ||
setSucceeded(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setSucceeded(true)
can be moved to the if
above when there is only single boolean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
if (retVal != null) { | ||
if (!retVal.getSucceeded() && retVal.getVdsError() == null && getParameters().rollbackOnFailure()) { | ||
throw new EngineException(EngineError.SETUP_NETWORKS_ROLLBACK, retVal.getExceptionString()); | ||
boolean networksUpdated = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need only single boolean. The fact that we have propagated succeed even if retVal.getSucceeded() == false
seems to be a mistake. That was introduced by 28f34a4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@almusil this significantly simplifies the proposed changes. Thanks a lot! Will do it soon - it may take a while to verify the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
} | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can flip the succeeded
logic to avoid this else branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
boolean succeeded = false; | ||
|
||
if (hasNetworkChanges()) { | ||
//Update networks configuration on the host |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add space after //
and period at the end, that applies to all comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Signed-off-by: Stepan Ermakov <sermakov@orionsoft.ru> 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: The HostSetupNetworksCommand verifies if there are changes made in the "Setup Host Networks" modal dialog (see HostSetupNetworksCommand.executeCommand, "if (noChangesDetected())" statement). 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. In this PR I introduced additional check "if (hasNetworkChanges())" that verifies whether the HostSetupNetworks call to the host VDSM is needed or not.
37c9ba4
to
6e8f1e3
Compare
Hi @almusil. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks! @michalskrivanek do we want to run ost? It will most likely fail in the UI tests though.
/ost |
/ost basic-suite-master el9stream |
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:
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
if (noChangesDetected())
statement).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