Change in ovirt-engine[master]: core: avoid saving duplicate records when saving LUN connect...

laravot at redhat.com laravot at redhat.com
Wed Dec 17 11:44:32 UTC 2014


Liron Aravot has submitted this change and it was merged.

Change subject: core: avoid saving duplicate records when saving LUN connections
......................................................................


core: avoid saving duplicate records when saving LUN connections

When adding a LUN to the db, StorageHandlingCommandBase.proceedLUNInDb()
is executed. Among its other operations, this method checks if
connections with the same details as the LUN connections already exists
by executing Getstorage_server_connectionsByKey and if not a new connection
record is being saved, otherwise the existing one is used.

Getstorage_server_connectionsByKey currently checks if connection with the same
details exists according to the iqn, connection, port, portal username
and password fields - the problem is that those fields could be
set and persisted with with empty string or null, which will lead to
duplicate records.

*This patch only avoid having empty string in those fields - further
patch will fix the current state in the db and will add proper
contraints.

*Further fix that's done in this patch is to remove the password field
from Getstorage_server_connectionsByKey - each time we save/fetch a
connection from the db by it's details we encrypt the password - as the
encrypted password is different each time, we'll never be able to fetch
an existing record.

Change-Id: I997ba0fbc6e984a9e6782502c6b36b1f9a1f3d8c
Bug-Url: https://bugzilla.redhat.com/1173951
Signed-off-by: Liron Aravot <laravot at redhat.com>
---
M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/StorageServerConnections.java
M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageServerConnectionDAODbFacadeImpl.java
M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StorageServerConnectionDAOTest.java
M backend/manager/modules/dal/src/test/resources/fixtures.xml
M packaging/dbscripts/storages_san_sp.sql
5 files changed, 107 insertions(+), 37 deletions(-)

Approvals:
  Liron Aravot: Verified; Looks good to me, approved



-- 
To view, visit http://gerrit.ovirt.org/36212
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I997ba0fbc6e984a9e6782502c6b36b1f9a1f3d8c
Gerrit-PatchSet: 7
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liron Aravot <laravot at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Daniel Erez <derez at redhat.com>
Gerrit-Reviewer: Liron Aravot <laravot at redhat.com>
Gerrit-Reviewer: Tal Nisan <tnisan at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server



More information about the Engine-commits mailing list