Search in sources :

Example 1 with LUNStorageServerConnectionMapId

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()));
        }
    }
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) LUNStorageServerConnectionMapId(org.ovirt.engine.core.common.businessentities.storage.LUNStorageServerConnectionMapId) LUNStorageServerConnectionMap(org.ovirt.engine.core.common.businessentities.storage.LUNStorageServerConnectionMap)

Aggregations

StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)1 LUNStorageServerConnectionMap (org.ovirt.engine.core.common.businessentities.storage.LUNStorageServerConnectionMap)1 LUNStorageServerConnectionMapId (org.ovirt.engine.core.common.businessentities.storage.LUNStorageServerConnectionMapId)1