use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class VMsTree method getDiskNode.
private TreeItem getDiskNode(ArrayList<Disk> disks) {
if (disks.isEmpty()) {
return null;
}
VerticalPanel vPanel = new VerticalPanel();
// $NON-NLS-1$
vPanel.setWidth("100%");
for (Disk disk : disks) {
HorizontalPanel panel = new HorizontalPanel();
ImageResource image = resources.diskImage();
String name = disk.getDiskAlias();
// $NON-NLS-1$
addItemToPanel(panel, new Image(image), "25px");
// $NON-NLS-1$
addTextBoxToPanel(panel, new StringValueLabel(), name, "");
// $NON-NLS-1$ //$NON-NLS-2$
addTextBoxToPanel(panel, new StringValueLabel(), "", "80px");
// $NON-NLS-1$ //$NON-NLS-2$
addTextBoxToPanel(panel, new StringValueLabel(), "", "160px");
boolean isDiskImage = disk.getDiskStorageType() == DiskStorageType.IMAGE;
Double actualSize = isDiskImage ? ((DiskImage) disk).getActualDiskWithSnapshotsSize() : (long) ((LunDisk) disk).getLun().getDeviceSize();
Long virtualSize = isDiskImage ? disk.getSize() : (long) (((LunDisk) disk).getLun().getDeviceSize() * Math.pow(1024, 3));
// $NON-NLS-1$
addValueLabelToPanel(panel, new DiskSizeLabel<Long>(SizeConverter.SizeUnit.BYTES), virtualSize, "110px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new DiskSizeLabel<Double>(SizeConverter.SizeUnit.GiB), actualSize, "110px");
addValueLabelToPanel(panel, new FullDateTimeLabel(), disk.getDiskStorageType() == DiskStorageType.IMAGE ? ((DiskImage) disk).getCreationDate() : null, // $NON-NLS-1$
"140px");
panel.setSpacing(1);
// $NON-NLS-1$
panel.setWidth("100%");
vPanel.add(panel);
}
TreeItem treeItem = new TreeItem(vPanel);
treeItem.setUserObject(disks.get(0).getId());
return treeItem;
}
use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class RunVmCommandBase method connectLunDisks.
protected boolean connectLunDisks(Guid hostId) {
if (getVm().getDiskMap().isEmpty()) {
vmHandler.updateDisksFromDb(getVm());
}
List<LunDisk> lunDisks = DisksFilter.filterLunDisks(getVm().getDiskMap().values());
Map<StorageType, List<StorageServerConnections>> connectionsByType = lunDisks.stream().flatMap(d -> storageServerConnectionDao.getAllForLun(d.getLun().getLUNId()).stream()).distinct().collect(groupingBy(StorageServerConnections::getStorageType, toList()));
return connectionsByType.entrySet().stream().map(entry -> runVdsCommand(VDSCommandType.ConnectStorageServer, new StorageServerConnectionManagementVDSParameters(hostId, getStoragePoolId(), entry.getKey(), entry.getValue()))).noneMatch(vdsReturnValue -> !vdsReturnValue.getSucceeded());
}
use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class RemoveDiskCommandTest method testPreImportedHostedEngineLunDiskRemove.
@Test
public void testPreImportedHostedEngineLunDiskRemove() {
disk = new LunDisk();
setupDisk();
disk.setDiskAlias(StorageConstants.HOSTED_ENGINE_LUN_DISK_ALIAS);
doReturn(disk).when(cmd).getDisk();
ValidateTestUtils.runAndAssertValidateSuccess(cmd);
}
use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class RemoveDiskCommandTest method testImportedHostedEngineLunDiskRemove.
@Test
public void testImportedHostedEngineLunDiskRemove() {
vm.setOrigin(OriginType.MANAGED_HOSTED_ENGINE);
vm.setStatus(VMStatus.Up);
disk = new LunDisk();
setupDisk();
disk.setDiskAlias(StorageConstants.HOSTED_ENGINE_LUN_DISK_ALIAS);
doReturn(disk).when(cmd).getDisk();
ValidateTestUtils.runAndAssertValidateSuccess(cmd);
}
use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class DisksFilterTest method testFilterNonImageDisks.
@Test
public void testFilterNonImageDisks() {
Disk lunDisk = createDisk(DiskStorageType.LUN, false, false, false, false);
Disk imageDisk = createDisk(DiskStorageType.IMAGE, false, false, true, false);
Disk cinderDisk = createDisk(DiskStorageType.CINDER, false, false, true, false);
List<Disk> disksList = Arrays.asList(lunDisk, imageDisk, cinderDisk);
List<DiskImage> filteredList = DisksFilter.filterImageDisks(disksList);
assertEquals(1, filteredList.size());
assertThat(filteredList, containsInAnyOrder(imageDisk));
}
Aggregations