Change in ovirt-engine[master]: core: Fix VmDevicesConverter managed devices sorting

Code Review gerrit at ovirt.org
Sun Aug 6 16:48:50 UTC 2017


>From Allon Mureinik <amureini at redhat.com>:

Allon Mureinik has submitted this change and it was merged. ( https://gerrit.ovirt.org/80221 )

Change subject: core: Fix VmDevicesConverter managed devices sorting
......................................................................


core: Fix VmDevicesConverter managed devices sorting

The current comparator breaks Comparator.compare's contract by
violating the total order requirement.
If two [non] managed devices are compared, the first [second] one
will always be returned, violating the requirement that
sgn(compare(x, y)) == -sgn(compare(y, x)).

This patch fixes the problem by using Java 8's built in
Comparator.comparing method.

Change-Id: Ifd7ec5f36e00f4a4cbe7da64ea01d892c546a0a7
Signed-off-by: Allon Mureinik <amureini at redhat.com>
---
M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/libvirt/VmDevicesConverter.java
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Tal Nisan: Looks good to me, approved
  Jenkins CI: Passed CI tests
  Allon Mureinik: Verified



-- 
To view, visit https://gerrit.ovirt.org/80221
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifd7ec5f36e00f4a4cbe7da64ea01d892c546a0a7
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Tal Nisan <tnisan at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>


More information about the Engine-commits mailing list