private boolean isCopyCommandAvailable() { List<DiskImage> disks = getSelectedItems() != null ? getSelectedItems() : new ArrayList<DiskImage>(); for (DiskImage disk : disks) { if (disk.getImageStatus() != ImageStatus.OK || disk.getDiskStorageType() != DiskStorageType.IMAGE) { return false; } } return true; }
protected DiskImage setUpStatisticalExpectations() { DiskImage entity = mock(DiskImage.class); when(entity.getId()).thenReturn(DISK_ID); when(entity.getReadRate()).thenReturn(10); when(entity.getWriteRate()).thenReturn(20); when(entity.getReadLatency()).thenReturn(30.0); when(entity.getWriteLatency()).thenReturn(40.0); when(entity.getFlushLatency()).thenReturn(50.0); when(entity.getDiskStorageType()).thenReturn(DiskStorageType.IMAGE); setUpGetEntityExpectations(1, entity); return entity; }
static org.ovirt.engine.core.common.businessentities.storage.Disk setUpEntityExpectations(DiskImage entity, int index) { when(entity.getId()).thenReturn(GUIDS[index]); when(entity.getVmSnapshotId()).thenReturn(GUIDS[2]); when(entity.getVolumeFormat()).thenReturn(VolumeFormat.RAW); when(entity.getImageStatus()).thenReturn(ImageStatus.OK); when(entity.getVolumeType()).thenReturn(VolumeType.Sparse); when(entity.isShareable()).thenReturn(false); when(entity.getPropagateErrors()).thenReturn(PropagateErrors.On); when(entity.getDiskStorageType()).thenReturn(DiskStorageType.IMAGE); when(entity.getImageId()).thenReturn(GUIDS[1]); ArrayList<Guid> sdIds = new ArrayList<>(); sdIds.add(Guid.Empty); when(entity.getStorageIds()).thenReturn(sdIds); return setUpStatisticalEntityExpectations(entity); }
private org.ovirt.engine.core.common.businessentities.storage.Disk setUpEntityExpectations(DiskImage entity, int index) { when(entity.getId()).thenReturn(GUIDS[index]); when(entity.getVmSnapshotId()).thenReturn(GUIDS[2]); when(entity.getVolumeFormat()).thenReturn(VolumeFormat.RAW); when(entity.getImageStatus()).thenReturn(ImageStatus.OK); when(entity.getVolumeType()).thenReturn(VolumeType.Sparse); when(entity.isShareable()).thenReturn(false); when(entity.getPropagateErrors()).thenReturn(PropagateErrors.On); when(entity.getDiskStorageType()).thenReturn(DiskStorageType.IMAGE); when(entity.getImageId()).thenReturn(GUIDS[1]); ArrayList<Guid> sdIds = new ArrayList<>(); sdIds.add(Guid.Empty); when(entity.getStorageIds()).thenReturn(sdIds); return setUpStatisticalEntityExpectations(entity); }
private org.ovirt.engine.core.common.businessentities.storage.Disk setUpEntityExpectations(DiskImage entity, int index) { when(entity.getId()).thenReturn(GUIDS[index]); when(entity.getVmSnapshotId()).thenReturn(GUIDS[2]); when(entity.getVolumeFormat()).thenReturn(VolumeFormat.RAW); when(entity.getImageStatus()).thenReturn(ImageStatus.OK); when(entity.getVolumeType()).thenReturn(VolumeType.Sparse); when(entity.isShareable()).thenReturn(false); when(entity.getPropagateErrors()).thenReturn(PropagateErrors.On); when(entity.getDiskStorageType()).thenReturn(DiskStorageType.IMAGE); when(entity.getImageId()).thenReturn(GUIDS[1]); ArrayList<Guid> sdIds = new ArrayList<>(); sdIds.add(Guid.Empty); when(entity.getStorageIds()).thenReturn(sdIds); return setUpStatisticalEntityExpectations(entity); }
static org.ovirt.engine.core.common.businessentities.storage.Disk setUpEntityExpectations(DiskImage entity, int index) { when(entity.getId()).thenReturn(GUIDS[index]); when(entity.getVmSnapshotId()).thenReturn(GUIDS[2]); when(entity.getVolumeFormat()).thenReturn(VolumeFormat.RAW); when(entity.getImageStatus()).thenReturn(ImageStatus.OK); when(entity.getVolumeType()).thenReturn(VolumeType.Sparse); when(entity.isShareable()).thenReturn(false); when(entity.getPropagateErrors()).thenReturn(PropagateErrors.On); when(entity.getDiskStorageType()).thenReturn(DiskStorageType.IMAGE); when(entity.getImageId()).thenReturn(GUIDS[1]); ArrayList<Guid> sdIds = new ArrayList<>(); sdIds.add(Guid.Empty); when(entity.getStorageIds()).thenReturn(sdIds); return setUpStatisticalEntityExpectations(entity); }
@Override protected void writeFile(DiskImage image) { _writer.writeAttributeString(getOvfUri(), "href", OvfParser.createImageFile(image)); _writer.writeAttributeString(getOvfUri(), "id", image.getImageId().toString()); _writer.writeAttributeString(getOvfUri(), "size", String.valueOf(image.getActualSizeInBytes())); // these properties have to be written for forward compatibility // with previous versions of the engine _writer.writeAttributeString(getOvfUri(), "description", StringUtils.defaultString(image.getDescription())); _writer.writeAttributeString(getOvfUri(), "disk_storage_type", image.getDiskStorageType().name()); _writer.writeAttributeString(getOvfUri(), "cinder_volume_type", StringUtils.defaultString(image.getCinderVolumeType())); }
diskModel.getVolumeType().setIsAvailable(false); switch (disk.getDiskStorageType()) { case IMAGE: diskModel.setSize(new EntityModel<>((int) disk.getSizeInGigabytes()));
_writer.writeAttributeString(OVF_PREFIX, getOvfUri(), "description", StringUtils.defaultString(image.getDescription())); _writer.writeAttributeString(OVF_PREFIX, getOvfUri(), "disk_storage_type", image.getDiskStorageType().name()); _writer.writeAttributeString(OVF_PREFIX, getOvfUri(), "cinder_volume_type", StringUtils.defaultString(image.getCinderVolumeType()));
SafeHtmlUtils.fromString(String.valueOf(image.getImageId())), dl); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.typeDisk()), SafeHtmlUtils.fromString(String.valueOf(image.getDiskStorageType())), dl); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.descriptionDisk()), SafeHtmlUtils.fromString(StringHelper.isNotNullOrEmpty(image.getDiskDescription()) ? image.getDiskDescription()