use of org.ovirt.engine.core.common.businessentities.gluster.StorageDevice in project ovirt-engine by oVirt.
the class StoageDeviceDaoTest method updateIsFreeFlag.
@Test
public void updateIsFreeFlag() {
StorageDevice storageDevice = dao.get(EXISTING_STORAGE_DEVICE_ID_2);
assertNotNull("storage device doesn't exists", storageDevice);
dao.updateIsFreeFlag(EXISTING_STORAGE_DEVICE_ID_2, false);
storageDevice = dao.get(EXISTING_STORAGE_DEVICE_ID_2);
assertFalse("canCreateBrick is not updated", storageDevice.getCanCreateBrick());
dao.updateIsFreeFlag(EXISTING_STORAGE_DEVICE_ID_2, true);
storageDevice = dao.get(EXISTING_STORAGE_DEVICE_ID_2);
assertTrue("canCreateBrick is not updated", storageDevice.getCanCreateBrick());
}
use of org.ovirt.engine.core.common.businessentities.gluster.StorageDevice in project ovirt-engine by oVirt.
the class StoageDeviceDaoTest method testUpdateStorageDevice.
@Test
public void testUpdateStorageDevice() {
StorageDevice storageDevice = dao.get(EXISTING_STORAGE_DEVICE_ID_2);
assertNotNull("storage device doesn't exists", storageDevice);
storageDevice.setSize(1234567L);
storageDevice.setMountPoint("/gluster-bricks/brick1");
storageDevice.setFsType("xfs");
dao.update(storageDevice);
StorageDevice storageDeviceFromDB = dao.get(EXISTING_STORAGE_DEVICE_ID_2);
assertEquals("Failed to update Storage Device", storageDevice, storageDeviceFromDB);
}
use of org.ovirt.engine.core.common.businessentities.gluster.StorageDevice in project ovirt-engine by oVirt.
the class CreateBrickCommandTest method getStorageDevice.
private StorageDevice getStorageDevice(String name) {
StorageDevice storageDevice = new StorageDevice();
storageDevice.setCanCreateBrick(true);
storageDevice.setDescription("Test Device" + name);
storageDevice.setDevPath("/dev/" + name);
storageDevice.setDevType("SCSI");
storageDevice.setName(name);
storageDevice.setSize(10000L);
storageDevice.setId(Guid.newGuid());
return storageDevice;
}
use of org.ovirt.engine.core.common.businessentities.gluster.StorageDevice in project ovirt-engine by oVirt.
the class CreateBrickCommandTest method validateFailsForDeviceAlreadyInUse.
@Test
public void validateFailsForDeviceAlreadyInUse() {
StorageDevice storageDevice = getStorageDevice("sda");
storageDevice.setCanCreateBrick(false);
doReturn(new CreateBrickParameters(HOST_ID, "brick1", "/gluster-bricks/brick1", RaidType.RAID0, null, null, Collections.singletonList(storageDevice), getStorageDevice("sda"), CacheModeType.writethrough, 10)).when(cmd).getParameters();
prepareMocks(VDSStatus.Up);
assertFalse(cmd.validate());
}
use of org.ovirt.engine.core.common.businessentities.gluster.StorageDevice in project ovirt-engine by oVirt.
the class CreateBrickCommandTest method validateFailsForDifferentStorageDevice.
@Test
public void validateFailsForDifferentStorageDevice() {
StorageDevice storageDevice1 = getStorageDevice("sda");
StorageDevice storageDevice2 = getStorageDevice("sdb");
storageDevice2.setDevType("SDA");
doReturn(new CreateBrickParameters(HOST_ID, "brick1", "/gluster-bricks/brick1", RaidType.RAID0, null, null, Arrays.asList(storageDevice1, storageDevice2), getStorageDevice("sdb"), CacheModeType.writethrough, 10)).when(cmd).getParameters();
prepareMocks(VDSStatus.Up);
assertFalse(cmd.validate());
}
Aggregations