}
List<StoragePoolVO> pools = _storagePoolDao.listPoolByHostPath(storageHost, hostPath);
if (!pools.isEmpty() && !scheme.equalsIgnoreCase("sharedmountpoint")) {
Long oldPodId = pools.get(0).getPodId();
throw new ResourceInUseException("Storage pool " + uri + " already in use by another pod (id=" + oldPodId + ")", "StoragePool", uri.toASCIIString());
}
long poolId = _storagePoolDao.getNextInSequence(Long.class, "id");
String uuid = null;
if (scheme.equalsIgnoreCase("sharedmountpoint") || scheme.equalsIgnoreCase("clvm")) {
uuid = UUID.randomUUID().toString();
} else if (scheme.equalsIgnoreCase("PreSetup")) {
uuid = hostPath.replace("/", "");
} else {
uuid = UUID.nameUUIDFromBytes(new String(storageHost + hostPath).getBytes()).toString();
}
List<StoragePoolVO> spHandles = _storagePoolDao.findIfDuplicatePoolsExistByUUID(uuid);
if ((spHandles != null) && (spHandles.size() > 0)) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Another active pool with the same uuid already exists");
}
throw new ResourceInUseException("Another active pool with the same uuid already exists");
}
if (s_logger.isDebugEnabled()) {
s_logger.debug("In createPool Setting poolId - " + poolId + " uuid - " + uuid + " zoneId - " + zoneId + " podId - " + podId + " poolName - " + cmd.getStoragePoolName());
}