use of org.ovirt.engine.core.common.businessentities.storage.LUNStorageServerConnectionMapId in project ovirt-engine by oVirt.
the class LunHelper method proceedLUNInDb.
public void proceedLUNInDb(final LUNs lun, StorageType storageType, String volumeGroupId) {
lun.setVolumeGroupId(volumeGroupId);
if (lunDao.get(lun.getLUNId()) == null) {
lunDao.save(lun);
} else if (!volumeGroupId.isEmpty()) {
lunDao.update(lun);
}
if (storageType == StorageType.FCP) {
// No need to handle connections (FCP storage doesn't utilize connections).
return;
}
for (StorageServerConnections connection : lun.getLunConnections()) {
StorageServerConnections dbConnection = iscsiStorageHelper.findConnectionWithSameDetails(connection);
if (dbConnection == null) {
connection.setId(Guid.newGuid().toString());
connection.setStorageType(storageType);
storageServerConnectionDao.save(connection);
} else {
connection.setId(dbConnection.getId());
}
if (storageServerConnectionLunMapDao.get(new LUNStorageServerConnectionMapId(lun.getLUNId(), connection.getId())) == null) {
storageServerConnectionLunMapDao.save(new LUNStorageServerConnectionMap(lun.getLUNId(), connection.getId()));
}
}
}
Aggregations