Tal Nisan 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(a)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:
Allon Mureinik: Looks good to me, approved
Liron Aravot: Verified
--
To view, visit
http://gerrit.ovirt.org/36236
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I997ba0fbc6e984a9e6782502c6b36b1f9a1f3d8c
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Liron Aravot <laravot(a)redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini(a)redhat.com>
Gerrit-Reviewer: Liron Aravot <laravot(a)redhat.com>
Gerrit-Reviewer: Tal Nisan <tnisan(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org