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 <lara...@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 <lara...@redhat.com>
Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com>
Gerrit-Reviewer: Daniel Erez <de...@redhat.com>
Gerrit-Reviewer: Liron Aravot <lara...@redhat.com>
Gerrit-Reviewer: Tal Nisan <tni...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to