&& storageDomain.getStorage()!=null && storageDomain.getStorage().getAddress()!=null ) { return StorageDomainsResource.class.getMethod("addByPath", StorageDomain.class);
case NFS: if(storage.isSetAddress() && storage.isSetPath()) { entity.setConnection(storage.getAddress() + ":" + storage.getPath()); case GLUSTERFS: if (storage.isSetAddress() && storage.isSetPath()) { entity.setConnection(storage.getAddress() + ":" + storage.getPath()); } else if (storage.isSetPath()) { entity.setConnection(storage.getPath());
static void verifyModelSpecific(StorageDomain model, int index) { assertEquals(getSafeEntry(index, GUIDS).toString(), model.getId()); assertEquals(getSafeEntry(index, NAMES), model.getName()); // REVIST No descriptions for storage domains // assertEquals(DESCRIPTIONS[index], model.getDescription()); assertEquals(getSafeEntry(index, TYPES), model.getType()); assertNotNull(model.getStorage()); assertEquals(getSafeEntry(index, STORAGE_TYPES), model.getStorage().getType()); if (index != LOCAL_IDX && index != POSIX_IDX) { assertEquals(getSafeEntry(index, ADDRESSES), model.getStorage().getAddress()); } assertEquals(PATHS[index], model.getStorage().getPath()); assertNotNull(getLinkByName(model, "permissions")); if (model.getType() == StorageDomainType.ISO) { assertEquals(5, model.getLinks().size()); assertNotNull(getLinkByName(model, "files")); } else if (model.getType().equals(TYPES[2])) { assertEquals(7, model.getLinks().size()); assertNotNull(getLinkByName(model, "templates")); assertNotNull(getLinkByName(model, "vms")); } assertNotNull(model.getLinks().get(0).getHref()); }
to.setAddress(from.getAddress());
@Test public void checkPosixStorageConnectionsMappings() { 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"); HostStorage RESTConnection = new HostStorage(); 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"); StorageConnection mappedResult = StorageDomainMapper.map(connection, null); assertEquals(RESTConnection.getId(), mappedResult.getId()); assertEquals(RESTConnection.getType(), mappedResult.getType()); assertEquals(RESTConnection.getAddress(), mappedResult.getAddress()); assertEquals(RESTConnection.getVfsType(), mappedResult.getVfsType()); assertEquals(RESTConnection.getPath(), mappedResult.getPath()); assertEquals(RESTConnection.getMountOptions(), mappedResult.getMountOptions()); }
@Test public void checkISCSIStorageConnectionsMappings() { 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"); HostStorage RESTConnection = new HostStorage(); 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"); StorageConnection mappedResult = StorageDomainMapper.map(connection, null); assertEquals(RESTConnection.getId(), mappedResult.getId()); // Although password was set on StorageServerConnections object, it should not be returned via REST // thus testing here that it remains empty. assertEquals(RESTConnection.getPassword(), mappedResult.getPassword()); assertEquals(RESTConnection.getType(), mappedResult.getType()); assertEquals(RESTConnection.getAddress(), mappedResult.getAddress()); assertEquals(RESTConnection.getUsername(), mappedResult.getUsername()); assertEquals(RESTConnection.getTarget(), mappedResult.getTarget()); }
@Test public void checkNFSStorageConnectionsMappings() { 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"); HostStorage RESTConnection = new HostStorage(); 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"); StorageConnection mappedResult = StorageDomainMapper.map(connection, null); assertEquals(RESTConnection.getId(), mappedResult.getId()); assertEquals(RESTConnection.getType(), mappedResult.getType()); assertEquals(RESTConnection.getAddress(), mappedResult.getAddress()); assertEquals(RESTConnection.getPath(), mappedResult.getPath()); assertEquals(RESTConnection.getNfsRetrans(), mappedResult.getNfsRetrans()); assertEquals(RESTConnection.getNfsTimeo(), mappedResult.getNfsTimeo()); assertEquals(RESTConnection.getNfsVersion(), mappedResult.getNfsVersion()); assertEquals(RESTConnection.getMountOptions(), mappedResult.getMountOptions()); }