/** * Retrieve NFS version to be used for imgStoreId store, if provided in image_store_details table * @param imgStoreId store id * @return "secstorage.nfs.version" associated value for imgStoreId in image_store_details table if exists, null if not */ protected Integer getNfsVersion(long imgStoreId){ Map<String, String> imgStoreDetails = _imageStoreDetailsDao.getDetails(imgStoreId); String nfsVersionKey = CapacityManager.ImageStoreNFSVersion.key(); if (imgStoreDetails != null && imgStoreDetails.containsKey(nfsVersionKey)){ String nfsVersionParam = imgStoreDetails.get(nfsVersionKey); return (nfsVersionParam != null ? Integer.valueOf(nfsVersionParam) : null); } return null; }
@Override public void doInTransactionWithoutResult(TransactionStatus status) { // first delete from image_store_details table, we need to do that since // we are not actually deleting record from main // image_data_store table, so delete cascade will not work _imageStoreDetailsDao.deleteDetails(storeId); _snapshotStoreDao.deletePrimaryRecordsForStore(storeId, DataStoreRole.Image); _volumeStoreDao.deletePrimaryRecordsForStore(storeId); _templateStoreDao.deletePrimaryRecordsForStore(storeId); _imageStoreDao.remove(storeId); } });
imageStoreDetailsDao.persist(detail);
final ImageStoreVO imgStore = _imageStoreDao.findById(resourceId); Preconditions.checkState(imgStore != null); _imageStoreDetailsDao.addDetail(resourceId, name, value, true); break;
@Override public void doInTransactionWithoutResult(TransactionStatus status) { // first delete from image_store_details table, we need to do that since // we are not actually deleting record from main // image_data_store table, so delete cascade will not work _imageStoreDetailsDao.deleteDetails(storeId); _snapshotStoreDao.deletePrimaryRecordsForStore(storeId, DataStoreRole.ImageCache); _volumeStoreDao.deletePrimaryRecordsForStore(storeId); _templateStoreDao.deletePrimaryRecordsForStore(storeId); _imageStoreDao.remove(storeId); } });
@Override public DataStoreTO getStoreTO(DataStore store) { ImageStoreImpl imgStore = (ImageStoreImpl)store; Map<String, String> details = _imageStoreDetailsDao.getDetails(imgStore.getId()); return new SwiftTO(imgStore.getId(), imgStore.getUri(), details.get(ApiConstants.ACCOUNT), details.get(ApiConstants.USERNAME), details.get(ApiConstants.KEY), details.get(ApiConstants.STORAGE_POLICY)); }
/** * Obtain NFS protocol version (if provided) for a store id, if not use default config value<br/> * @param storeId image store id * @return {@code null} if {@code secstorage.nfs.version} is not found for storeId <br/> * {@code X} if {@code secstorage.nfs.version} is found found for storeId */ public Integer getNfsVersion(long storeId) throws NumberFormatException { final Map<String, String> storeDetails = imageStoreDetailsDao.getDetails(storeId); if (storeDetails != null && storeDetails.containsKey(CapacityManager.ImageStoreNFSVersion.key())) { final String version = storeDetails.get(CapacityManager.ImageStoreNFSVersion.key()); return (version != null ? Integer.valueOf(version) : null); } return getGlobalDefaultNfsVersion(); }
@Override public DataStoreTO getStoreTO(DataStore store) { ImageStoreImpl imgStore = (ImageStoreImpl)store; Map<String, String> details = _imageStoreDetailsDao.getDetails(imgStore.getId()); return new S3TO(imgStore.getId(), imgStore.getUuid(), details.get(ApiConstants.S3_ACCESS_KEY), details.get(ApiConstants.S3_SECRET_KEY), details.get(ApiConstants.S3_END_POINT), details.get(ApiConstants.S3_BUCKET_NAME), details.get(ApiConstants.S3_SIGNER), details.get(ApiConstants.S3_HTTPS_FLAG) == null ? false : Boolean.parseBoolean(details.get(ApiConstants.S3_HTTPS_FLAG)), details.get(ApiConstants.S3_CONNECTION_TIMEOUT) == null ? null : Integer.valueOf(details.get(ApiConstants.S3_CONNECTION_TIMEOUT)), details.get(ApiConstants.S3_MAX_ERROR_RETRY) == null ? null : Integer.valueOf(details.get(ApiConstants.S3_MAX_ERROR_RETRY)), details.get(ApiConstants.S3_SOCKET_TIMEOUT) == null ? null : Integer.valueOf(details.get(ApiConstants.S3_SOCKET_TIMEOUT)), imgStore.getCreated(), _configDao.getValue(Config.S3EnableRRS.toString()) == null ? false : Boolean.parseBoolean(_configDao.getValue(Config.S3EnableRRS.toString())), getMaxSingleUploadSizeInBytes(), details.get(ApiConstants.S3_CONNECTION_TTL) == null ? null : Integer.valueOf(details.get(ApiConstants.S3_CONNECTION_TTL)), details.get(ApiConstants.S3_USE_TCP_KEEPALIVE) == null ? null : Boolean.parseBoolean(details.get(ApiConstants.S3_USE_TCP_KEEPALIVE))); }