private String getLocalStoragesFormattedString() { return getSelectedItems() .stream() .filter(a -> a.getStorageType() == StorageType.LOCALFS) .map(StorageDomain::getStorageName) .collect(Collectors.joining(", ")); //$NON-NLS-1$ }
private boolean isDiskValidForStorage(DiskImage disk, StorageDomain storage) { if (disk.isShareable() && storage.getStorageType() == StorageType.GLUSTERFS) { return false; } return true; }
private boolean containsLocalStorage(ConfirmationModel model) { for (StorageDomain a : getSelectedItems()) { if (a.getStorageType() == StorageType.LOCALFS) { return true; } } return false; }
public static Collection<StorageDomain> filterStorageDomainsByStorageType( Collection<StorageDomain> source, final StorageType storageType) { return where(source, sd -> sd.getStorageType() == storageType); }
@Override protected List<StorageDomain> filterStorageDomains(List<StorageDomain> storageDomains) { List<StorageDomain> availableStorageDomains = new ArrayList<>(); // Take only GLANCE domains for (StorageDomain storageDomainItem : storageDomains) { if (storageDomainItem.getStorageType() == StorageType.GLANCE) { availableStorageDomains.add(storageDomainItem); } } // Sorting by name Collections.sort(availableStorageDomains, new NameableComparator()); return availableStorageDomains; }
public boolean isShared() { return getStorageType().isShared(); }
public boolean isLocal() { return getStorageType().isLocal(); }
private String getLocalStoragesFormattedString() { StringBuilder localStorages = new StringBuilder(); for (StorageDomain a : getSelectedItems()) { if (a.getStorageType() == StorageType.LOCALFS) { localStorages.append(a.getStorageName()).append(", "); //$NON-NLS-1$ } } return localStorages.substring(0, localStorages.length() - 2); }
private boolean isPathEditable(StorageDomain storage) { if (storage.getStorageType().isFileDomain()) { StorageDomainType storageDomainType = storage.getStorageDomainType(); return storageDomainType.isInternalDomain() && isStorageStatusValidForPathEditing(storage); } return false; }
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; }
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; }
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; }
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) {
protected void updateCinderVolumeTypes() { StorageDomain storageDomain = getStorageDomain().getSelectedItem(); if (storageDomain == null || storageDomain.getStorageType() != StorageType.CINDER) { return; } AsyncDataProvider.getInstance().getCinderVolumeTypesList(new AsyncQuery<>(cinderVolumeTypes -> { List<String> volumeTypesNames = new ArrayList<>(); for (CinderVolumeType cinderVolumeType : cinderVolumeTypes) { volumeTypesNames.add(cinderVolumeType.getName()); } getCinderVolumeType().setItems(volumeTypesNames); }), storageDomain.getId()); }
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 void updateActionAvailability() { StorageDomain storageDomain = getEntity(); if (storageDomain != null && storageDomain.getStorageType() == StorageType.GLANCE) { getImportImagesCommand().setIsAvailable(true); getImportImagesCommand().setIsExecutionAllowed(getSelectedItems() != null && getSelectedItems().size() > 0); } else { getImportImagesCommand().setIsAvailable(false); } }
@Override public String render(T storageDomain) { if (storageDomain == null) { return ""; //$NON-NLS-1$ } if (storageDomain.getAvailableDiskSize() == null || storageDomain.getStorageType() == StorageType.CINDER) { // 'getAvailableDiskSize' may return null when there's a connectivity issue with the storage domain return storageDomain.getStorageName(); } return messages.storageDomainFreeSpace(storageDomain.getStorageName(), storageDomain.getAvailableDiskSize(), storageDomain.getTotalDiskSize()); } }
@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; }
protected void updateWipeAfterDeleteChangeability() { if (!isVmAttachedToPool()) { getIsWipeAfterDelete().setIsChangeable( !(getDiskStorageType().getEntity() == DiskStorageType.IMAGE && getStorageDomain().getSelectedItem() != null && getStorageDomain().getSelectedItem().getStorageType().isBlockDomain() && getPassDiscard().getIsChangable() && getPassDiscard().getEntity()), constants.theUnderlyingStorageDoesNotSupportWipeAfterDeleteWhenDiscardIsEnabled()); } else { getIsWipeAfterDelete().setIsChangeable(false); } }