static StorageServerConnections setUpEntityExpectations(StorageServerConnections entity, int index) { when(entity.getId()).thenReturn(GUIDS[index].toString()); when(entity.getStorageType()).thenReturn(STORAGE_TYPES_MAPPED[index]); when(entity.getConnection()).thenReturn("/data1"); if (STORAGE_TYPES_MAPPED[index].equals(StorageType.ISCSI)) { when(entity.getPort()).thenReturn("3260"); } return entity; }
static StorageServerConnections setUpEntityExpectations(StorageServerConnections entity, int index) { when(entity.getId()).thenReturn(GUIDS[index].toString()); when(entity.getStorageType()).thenReturn(STORAGE_TYPES_MAPPED[index]); when(entity.getConnection()).thenReturn("1.1.1.255"); if (STORAGE_TYPES_MAPPED[index].equals(StorageType.ISCSI)) { when(entity.getPort()).thenReturn("3260"); } return entity; } }
private void updateIscsiBondListAvailability(StoragePool storagePool) { AsyncDataProvider.getInstance().getStorageConnectionsByDataCenterIdAndStorageType(new AsyncQuery<>(connections -> { boolean hasIscsiStorage = false; for (StorageServerConnections connection : connections) { if (connection.getStorageType() == StorageType.ISCSI) { hasIscsiStorage = true; break; } } iscsiBondListModel.setIsAvailable(hasIscsiStorage); }), storagePool.getId(), StorageType.ISCSI); }
static StorageServerConnections setUpEntityExpectations(StorageServerConnections entity, int index) { when(entity.getId()).thenReturn(GUIDS[index].toString()); when(entity.getStorageType()).thenReturn(STORAGE_TYPES_MAPPED[index]); if (STORAGE_TYPES_MAPPED[index].equals(StorageType.ISCSI)) { when(entity.getPort()).thenReturn("3260"); when(entity.getConnection()).thenReturn("1.122.10.125"); } if (STORAGE_TYPES_MAPPED[index].equals(StorageType.NFS)) { when(entity.getConnection()).thenReturn("1.122.10.125:/data1"); } return entity; }
StorageConnection model = template != null ? template : new StorageConnection(); model.setId(entity.getId()); model.setType(map(entity.getStorageType(), null)); if (entity.getStorageType() == org.ovirt.engine.core.common.businessentities.storage.StorageType.ISCSI) { model.setAddress(entity.getConnection()); model.setPort(Integer.parseInt(entity.getPort())); model.setTarget(entity.getIqn()); if (entity.getStorageType().isFileDomain()) { setPath(entity, model); if (entity.getStorageType().equals(org.ovirt.engine.core.common.businessentities.storage.StorageType.NFS)) { if (entity.getNfsVersion() != null) { model.setNfsVersion(map(entity.getNfsVersion(), null)); model.setMountOptions(entity.getMountOptions()); } else if (entity.getStorageType().equals(org.ovirt.engine.core.common.businessentities.storage.StorageType.POSIXFS) || entity.getStorageType().equals(org.ovirt.engine.core.common.businessentities.storage.StorageType.GLUSTERFS)) { model.setMountOptions(entity.getMountOptions()); model.setVfsType(entity.getVfsType());
@Test public void testGetConnectableFileStorageConnectionsByStorageType() { List<StorageServerConnections> conns = dao.getConnectableStorageConnectionsByStorageType(FixturesTool.STORAGE_POOL_MIXED_TYPES, StorageType.NFS); assertNotNull(conns); assertEquals(1, conns.size()); for (StorageServerConnections conn : conns) { assertEquals(StorageType.NFS, conn.getStorageType()); } }
@Test public void testGetConnectableBlockStorageConnections() { List<StorageServerConnections> conns = dao.getConnectableStorageConnectionsByStorageType(FixturesTool.STORAGE_POOL_RHEL6_ISCSI_OTHER, StorageType.ISCSI); assertNotNull(conns); assertEquals(2, conns.size()); for (StorageServerConnections conn : conns) { assertEquals(StorageType.ISCSI, conn.getStorageType()); } }
public void getStorageConnectionsByStorageTypeWithRecords(EnumSet<StorageDomainStatus> statuses, Collection<Guid> expectedDomains) { List<StoragePoolIsoMap> poolIsoMap = storagePoolIsoMapDao.getAllForStoragePool(FixturesTool.STORAGE_POOL_MIXED_TYPES); List<Guid> storageDomainIds = poolIsoMap.stream() .filter(isoMap -> statuses.contains(isoMap.getStatus())) .map(StoragePoolIsoMap::getStorageId) .collect(Collectors.toList()); assertTrue(CollectionUtils.isEqualCollection(expectedDomains, storageDomainIds), "the list of the pool domains expected to be in the given statuses doesn't match the queried data"); List<StorageServerConnections> result = dao.getStorageConnectionsByStorageTypeAndStatus(FixturesTool.STORAGE_POOL_MIXED_TYPES, StorageType.NFS, statuses); assertFalse(result.isEmpty(), "there should be connections for the tested domains to verify the correctness"); for (StorageServerConnections storageServerConnection : result) { assertEquals(StorageType.NFS, storageServerConnection.getStorageType(), "connections were loaded with incorrect storage type"); } List<StorageServerConnections> domainConnections = new LinkedList<>(); for (Guid domainId : storageDomainIds) { domainConnections.addAll(dao.getAllForDomain(domainId)); } assertTrue(CollectionUtils.isEqualCollection(domainConnections, result), "the connections loaded by the given dao function should match the connections loaded separately"); }
Response response = null; boolean isConnNew = false; if (connection.getStorageType().isFileDomain() && StringUtils.isEmpty(connection.getId())) { isConnNew = true; connection.setId(addStorageServerConnection(connection, hostId));
hostId = getHostId(storageConn.getHost()); switch (storageConnection.getStorageType()) { case ISCSI: validateParameters(storageConn, "address", "target", "port");
_writer.writeAttributeString(getOvfUri(), LUNS_IQN, conn.getIqn()); _writer.writeAttributeString(getOvfUri(), LUNS_PORT, conn.getPort()); _writer.writeAttributeString(XSI_URI, LUNS_STORAGE_TYPE, conn.getStorageType().name()); _writer.writeAttributeString(XSI_URI, LUNS_PORTAL, conn.getPortal()); _writer.writeEndElement();
private MapSqlParameterSource getFullParameterSource(final StorageServerConnections connection) { return getIdParameterSource(connection.getId()) .addValue("connection", connection.getConnection()) .addValue("iqn", connection.getIqn()) .addValue("port", connection.getPort()) .addValue("portal", connection.getPortal()) .addValue("password", DbFacadeUtils.encryptPassword(connection.getPassword())) .addValue("storage_type", connection.getStorageType()) .addValue("user_name", connection.getUserName()) .addValue("mount_options", connection.getMountOptions()) .addValue("vfs_type", connection.getVfsType()) .addValue("nfs_version", (connection.getNfsVersion() != null) ? connection.getNfsVersion().getValue() : null) .addValue("nfs_timeo", connection.getNfsTimeo()) .addValue("nfs_retrans", connection.getNfsRetrans()) .addValue("gluster_volume_id", connection.getGlusterVolumeId()); }
storageType = map(model.getType(), null); } else if (template != null) { storageType = template.getStorageType();
validateParameters(storageDomain, "storage.type"); cnx = mapToCnx(storageDomain); if (cnx.getStorageType().isFileDomain()) { validateParameters(storageConnectionFromUser, "path"); storageDomain.getStorage().setType(mapType(cnx.getStorageType()));
@Test public void checkPosixStorageConnectionsMappingsToBll() { StorageServerConnections connection = new StorageServerConnections(); Guid connId = Guid.newGuid(); connection.setId(connId.toString()); connection.setStorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType.POSIXFS); connection.setConnection("1.2.135.255:/myshare/data"); connection.setVfsType("nfs"); connection.setMountOptions("timeo=30"); StorageConnection RESTConnection = new StorageConnection(); RESTConnection.setId(connId.toString()); RESTConnection.setType(StorageType.POSIXFS); RESTConnection.setAddress("1.2.135.255"); RESTConnection.setPath("/myshare/data"); RESTConnection.setVfsType("nfs"); RESTConnection.setMountOptions("timeo=30"); StorageServerConnections mappedResult = StorageDomainMapper.map(RESTConnection, null); assertEquals(connection.getId(), mappedResult.getId()); assertEquals(connection.getStorageType(), mappedResult.getStorageType()); assertEquals(connection.getConnection(), mappedResult.getConnection()); assertEquals(connection.getVfsType(), mappedResult.getVfsType()); assertEquals(connection.getMountOptions(), mappedResult.getMountOptions()); }
@Test public void checkNFSStorageConnectionsMappingsToBll() { StorageServerConnections connection = new StorageServerConnections(); Guid connId = Guid.newGuid(); connection.setId(connId.toString()); connection.setStorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType.NFS); connection.setConnection("1.2.135.255:/myshare/data"); connection.setNfsRetrans((short) 200); connection.setNfsTimeo((short) 400); connection.setNfsVersion(org.ovirt.engine.core.common.businessentities.NfsVersion.V3); connection.setMountOptions("tcp"); StorageConnection RESTConnection = new StorageConnection(); RESTConnection.setId(connId.toString()); RESTConnection.setType(StorageType.NFS); RESTConnection.setAddress("1.2.135.255"); RESTConnection.setPath("/myshare/data"); RESTConnection.setNfsRetrans(200); RESTConnection.setNfsTimeo(400); RESTConnection.setNfsVersion(NfsVersion.V3); RESTConnection.setMountOptions("tcp"); StorageServerConnections mappedResult = StorageDomainMapper.map(RESTConnection, null); assertEquals(connection.getId(), mappedResult.getId()); assertEquals(connection.getStorageType(), mappedResult.getStorageType()); assertEquals(connection.getConnection(), mappedResult.getConnection()); assertEquals(connection.getNfsRetrans(), mappedResult.getNfsRetrans()); assertEquals(connection.getNfsTimeo(), mappedResult.getNfsTimeo()); assertEquals(connection.getNfsVersion(), mappedResult.getNfsVersion()); assertEquals(connection.getMountOptions(), mappedResult.getMountOptions()); }
@Test public void checkISCSISStorageConnectionsMappingsToBll() { StorageServerConnections connection = new StorageServerConnections(); Guid connId = Guid.newGuid(); connection.setId(connId.toString()); connection.setIqn("iqn.my.target1"); connection.setPort("3260"); connection.setStorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType.ISCSI); connection.setConnection("1.2.135.255"); connection.setUserName("myuser1"); connection.setPassword("123"); StorageConnection RESTConnection = new StorageConnection(); RESTConnection.setId(connId.toString()); RESTConnection.setType(StorageType.ISCSI); RESTConnection.setPort(3260); RESTConnection.setTarget("iqn.my.target1"); RESTConnection.setAddress("1.2.135.255"); RESTConnection.setUsername("myuser1"); RESTConnection.setPassword("123"); StorageServerConnections mappedResult = StorageDomainMapper.map(RESTConnection, null); assertEquals(mappedResult.getId(), mappedResult.getId()); assertEquals(mappedResult.getStorageType(), mappedResult.getStorageType()); assertEquals(mappedResult.getConnection(), mappedResult.getConnection()); assertEquals(mappedResult.getIqn(), mappedResult.getIqn()); assertEquals(mappedResult.getUserName(), mappedResult.getUserName()); assertEquals(mappedResult.getPassword(), mappedResult.getPassword()); assertEquals(mappedResult.getPort(), mappedResult.getPort()); }