private org.ovirt.engine.core.common.businessentities.StorageDomain getFcpEntity() { org.ovirt.engine.core.common.businessentities.StorageDomain entity = mock(org.ovirt.engine.core.common.businessentities.StorageDomain.class); when(entity.getId()).thenReturn(GUIDS[0]); when(entity.getStorageName()).thenReturn(NAMES[0]); when(entity.getStorageDomainType()).thenReturn(org.ovirt.engine.core.common.businessentities.StorageDomainType.Data); when(entity.getStorageType()).thenReturn(org.ovirt.engine.core.common.businessentities.storage.StorageType.FCP); when(entity.getStorage()).thenReturn(GUIDS[0].toString()); return entity; }
private org.ovirt.engine.core.common.businessentities.StorageDomain setUpDomainExpectations(StorageType type) { org.ovirt.engine.core.common.businessentities.StorageDomain domain = mock(org.ovirt.engine.core.common.businessentities.StorageDomain.class); when(domain.getId()).thenReturn(STORAGE_DOMAIN_ID); when(domain.getStorageDomainType()).thenReturn(StorageDomainType.Master); when(domain.getStorageType()).thenReturn(type); when(domain.getStorage()).thenReturn(STORAGE_CONNECTION_ID.toString()); return domain; }
@Mapping(from = org.ovirt.engine.core.common.businessentities.StorageDomain.class, to = HostStorage.class) public static HostStorage map(org.ovirt.engine.core.common.businessentities.StorageDomain entity, HostStorage template) { HostStorage model = template != null ? template : new HostStorage(); model.setId(entity.getStorage()); model.setType(StorageDomainMapper.map(entity.getStorageType(), null)); model.setVolumeGroup(new VolumeGroup()); model.getVolumeGroup().setId(entity.getStorage()); return model; }
private List<StorageDomain> getStorageDomains() { StorageDomain storageDomain = mock(StorageDomain.class); when(storageDomain.getId()).thenReturn(GUIDS[0]); when(storageDomain.getStorage()).thenReturn(GUIDS[0].toString()); return Collections.singletonList(storageDomain); }
protected org.ovirt.engine.core.common.businessentities.StorageDomain getIscsiEntity() { org.ovirt.engine.core.common.businessentities.StorageDomain entity = mock(org.ovirt.engine.core.common.businessentities.StorageDomain.class); when(entity.getId()).thenReturn(GUIDS[0]); when(entity.getStorageName()).thenReturn(NAMES[0]); when(entity.getStorageDomainType()).thenReturn(TYPES_MAPPED[0]); when(entity.getStorageType()).thenReturn(org.ovirt.engine.core.common.businessentities.storage.StorageType.ISCSI); when(entity.getStorage()).thenReturn(GUIDS[GUIDS.length - 1].toString()); return entity; }
private static org.ovirt.engine.core.common.businessentities.StorageDomain setUpEntityExpectations(org.ovirt.engine.core.common.businessentities.StorageDomain entity, int index, StorageType storageType) { when(entity.getId()).thenReturn(GUIDS[index]); when(entity.getStatus()).thenReturn(StorageDomainStatus.Active); when(entity.getStorageDomainType()).thenReturn(StorageDomainType.Master); when(entity.getStorageType()).thenReturn(storageType); when(entity.getStorage()).thenReturn(GUIDS[0].toString()); return entity; }
protected void mapFileDomain(StorageDomain model, org.ovirt.engine.core.common.businessentities.StorageDomain entity) { final HostStorage storage = model.getStorage(); StorageServerConnections cnx = getStorageServerConnection(entity.getStorage()); if (cnx.getConnection().startsWith("[")) { String[] parts = cnx.getConnection().split("]:"); storage.setAddress(parts[0].substring(1)); storage.setPath(parts[1]); } else if (cnx.getConnection().contains(":")) { String[] parts = cnx.getConnection().split(":"); storage.setAddress(parts[0]); storage.setPath(parts[1]); } else { storage.setPath(cnx.getConnection()); } storage.setMountOptions(cnx.getMountOptions()); storage.setVfsType(cnx.getVfsType()); if (entity.getStorageType() == StorageType.NFS) { if (cnx.getNfsRetrans() != null) { storage.setNfsRetrans(cnx.getNfsRetrans().intValue()); } if (cnx.getNfsTimeo() != null) { storage.setNfsTimeo(cnx.getNfsTimeo().intValue()); } if (cnx.getNfsVersion() != null) { storage.setNfsVersion(StorageDomainMapper.map(cnx.getNfsVersion(), null)); } } }
private List<StorageDomain> getStorageDomains() { StorageDomain storageDomain = mock(StorageDomain.class); when(storageDomain.getId()).thenReturn(GUIDS[0]); when(storageDomain.getStorage()).thenReturn(GUIDS[0].toString()); return Collections.singletonList(storageDomain); }
static org.ovirt.engine.core.common.businessentities.StorageDomain setUpStorageDomainEntityExpectations(org.ovirt.engine.core.common.businessentities.StorageDomain entity, StorageType storageType) { when(entity.getId()).thenReturn(GUIDS[3]); when(entity.getStorageName()).thenReturn(NAMES[2]); when(entity.getStatus()).thenReturn(StorageDomainStatus.Active); when(entity.getStorageDomainType()).thenReturn(StorageDomainType.Master); when(entity.getStorageType()).thenReturn(storageType); when(entity.getStorage()).thenReturn(GUIDS[0].toString()); return entity; } private Action setUpCopyParams(boolean byName) {
setPath(null); }), storageDomain.getStorage(), false); } else { setPath(null);
private List<StorageDomain> getStorageDomains() { StorageDomain storageDomain = mock(StorageDomain.class); when(storageDomain.getId()).thenReturn(GUIDS[0]); when(storageDomain.getStorage()).thenReturn(GUIDS[0].toString()); return Collections.singletonList(storageDomain); }
static org.ovirt.engine.core.common.businessentities.StorageDomain setUpEntityExpectations(org.ovirt.engine.core.common.businessentities.StorageDomain entity, int index) { when(entity.getId()).thenReturn(getSafeEntry(index, GUIDS)); when(entity.getStorageName()).thenReturn(getSafeEntry(index, NAMES)); // REVIST No descriptions for storage domains // expect(entity.getDescription()).andReturn(DESCRIPTIONS[index]).anyTimes(); when(entity.getStorageDomainType()).thenReturn(getSafeEntry(index, TYPES_MAPPED)); when(entity.getStorageType()).thenReturn(getSafeEntry(index, STORAGE_TYPES_MAPPED)); when(entity.getStorage()).thenReturn(getSafeEntry(index, GUIDS).toString()); return entity; }
private List<StorageDomain> getStorageDomains() { StorageDomain storageDomain = mock(StorageDomain.class); when(storageDomain.getId()).thenReturn(GUIDS[0]); when(storageDomain.getStorage()).thenReturn(GUIDS[0].toString()); return Collections.singletonList(storageDomain); }
entity.getStorageType() == org.ovirt.engine.core.common.businessentities.storage.StorageType.FCP) { model.getStorage().setVolumeGroup(new VolumeGroup()); model.getStorage().getVolumeGroup().setId(entity.getStorage());
/** * Finds the identifier of the storage domain corresponding to the given provider. * * @param resource the resource that will be used to perform the operation * @param providerId identifier of the provider * @return the identifier of the corresponding storage domain or {@code null} if no such storage domain exists */ public static Guid getStorageDomainId(BackendResource resource, String providerId) { // The backend doesn't have any mechanism to obtain the images other than listing the images provided by the // storage domain that is created for the provider, and the only way to find that provider is to iterate the // complete list. This is potentially very slow, so it should be improved in the future. Guid storageDomainId = null; List<StorageDomain> storageDomains = resource.runQuery(QueryType.GetAllStorageDomains, new QueryParametersBase()).getReturnValue(); for (StorageDomain storageDomain : storageDomains) { String storageId = storageDomain.getStorage(); if (providerId.equals(storageId)) { storageDomainId = storageDomain.getId(); break; } } return storageDomainId; } }
private void postPrepareSanStorageForEdit(final SanStorageModelBase model, boolean isStorageActive, StorageDomain storage) { model.setStorageDomain(storage); VDS host = getContainer().getHost().getSelectedItem(); if (Objects.equals(previousGetLunsByVGIdHost, host) && isStorageActive) { return; } previousGetLunsByVGIdHost = host; Guid hostId = host != null && isStorageActive ? host.getId() : null; setValuesForMaintenance(model); getContainer().startProgress(); AsyncDataProvider.getInstance().getLunsByVgId(new AsyncQuery<>(lunList -> model.applyData(lunList, true, Linq.findSelectedItems((Collection<EntityModel<?>>) getSelectedItem()), isInMaintenance, metadata)), storage.getStorage(), hostId); }
public void prepareForEdit(StorageDomain storage) { boolean isEditable = isEditable(storage); getPath().setIsChangeable(isEditable); AsyncDataProvider.getInstance().getStorageConnectionById(new AsyncQuery<>(connection -> { getPath().setEntity(connection.getConnection()); prepareConnectionForEditing(connection); }), storage.getStorage(), true); setHostChangeability(isEditable); }
private AsyncCallback<QueryReturnValue> createGetStorageDomainsByStoragePoolIdCallback() { return returnValue -> { List<StorageDomain> storageDomains = returnValue.getReturnValue(); exportDomain.setEntity(getExportDomain(storageDomains)); if (exportDomain.getEntity() == null) { stopProgress(); } else { setExportName(exportDomain.getEntity().getName()); setExportDescription(exportDomain.getEntity().getDescription()); // get export-path AsyncDataProvider.getInstance().getStorageConnectionById(new AsyncQuery<>(connection -> { setExportPath(connection == null ? null : connection.getConnection()); stopProgress(); }), exportDomain.getEntity().getStorage(), true); } validateSource(); }; }
private AsyncCallback<QueryReturnValue> createGetStorageDomainsByStoragePoolIdCallback() { return returnValue -> { List<StorageDomain> storageDomains = returnValue.getReturnValue(); exportDomain.setEntity(getExportDomain(storageDomains)); if (exportDomain.getEntity() == null) { stopProgress(); } else { setExportName(exportDomain.getEntity().getName()); setExportDescription(exportDomain.getEntity().getDescription()); // get export-path AsyncDataProvider.getInstance().getStorageConnectionById(new AsyncQuery<>(connection -> { setExportPath(connection == null ? null : connection.getConnection()); stopProgress(); }), exportDomain.getEntity().getStorage(), true); } validateSource(); }; }