use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class DisksFilterTest method createDisk.
private Disk createDisk(DiskStorageType type, boolean isActive, boolean isShareable, boolean isSnapable, boolean isPlugged) {
Disk disk = null;
switch(type) {
case IMAGE:
disk = new DiskImage();
setDiskImageProperties((DiskImage) disk, isActive, isShareable, isSnapable);
break;
case LUN:
if (isSnapable) {
throw new IllegalArgumentException("A LUN disk cannot be snapable");
}
disk = new LunDisk();
break;
case CINDER:
disk = new CinderDisk();
setDiskImageProperties((DiskImage) disk, isActive, isShareable, isSnapable);
break;
}
disk.setPlugged(isPlugged);
return disk;
}
use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class DisksFilterTest method testFilterNonCinderDisks.
@Test
public void testFilterNonCinderDisks() {
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<CinderDisk> filteredList = DisksFilter.filterCinderDisks(disksList);
assertEquals(1, filteredList.size());
assertThat(filteredList, containsInAnyOrder(cinderDisk));
}
use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class AddDiskCommandTest method createISCSILunDisk.
private static LunDisk createISCSILunDisk() {
LunDisk disk = new LunDisk();
LUNs lun = new LUNs();
lun.setLUNId("lunid");
lun.setLunType(StorageType.ISCSI);
StorageServerConnections connection = new StorageServerConnections();
connection.setIqn("a");
connection.setConnection("0.0.0.0");
connection.setPort("1234");
ArrayList<StorageServerConnections> connections = new ArrayList<>();
connections.add(connection);
lun.setLunConnections(connections);
disk.setLun(lun);
disk.setId(Guid.newGuid());
return disk;
}
use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class AddDiskCommandTest method testIscsiLunDiskWithNoAddressCantBeAdded.
@Test
public void testIscsiLunDiskWithNoAddressCantBeAdded() {
LunDisk disk = createISCSILunDisk();
command.getParameters().setDiskInfo(disk);
disk.getLun().getLunConnections().get(0).setConnection(null);
assertFalse("checkIfLunDiskCanBeAdded() succeded for ISCSI lun which LUNs has storage_server_connection with a null address", command.checkIfLunDiskCanBeAdded(spyDiskValidator(disk)));
ValidateTestUtils.assertValidationMessages("checkIfLunDiskCanBeAdded() failed but correct can do action hasn't been added to the return response", command, EngineMessage.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS);
clearValidationMessages();
disk.getLun().getLunConnections().get(0).setConnection("");
assertFalse("checkIfLunDiskCanBeAdded() succeded for ISCSI lun which LUNs has storage_server_connection with a empty address", command.checkIfLunDiskCanBeAdded(spyDiskValidator(disk)));
ValidateTestUtils.assertValidationMessages("checkIfLunDiskCanBeAdded() failed but correct can do action hasn't been added to the return response", command, EngineMessage.ACTION_TYPE_FAILED_DISK_LUN_ISCSI_MISSING_CONNECTION_PARAMS);
}
use of org.ovirt.engine.core.common.businessentities.storage.LunDisk in project ovirt-engine by oVirt.
the class GetDiskAndSnapshotsByDiskIdQueryTest method testQueryWithLunDisk.
@Test
public void testQueryWithLunDisk() {
Disk disk = executeQuery(lunDisk);
assertTrue("disk should be from type LunDisk", disk instanceof LunDisk);
}
Aggregations