Search in sources :

Example 6 with StorageDevice

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());
}
Also used : StorageDevice(org.ovirt.engine.core.common.businessentities.gluster.StorageDevice) Test(org.junit.Test)

Example 7 with StorageDevice

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);
}
Also used : StorageDevice(org.ovirt.engine.core.common.businessentities.gluster.StorageDevice) Test(org.junit.Test)

Example 8 with StorageDevice

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;
}
Also used : StorageDevice(org.ovirt.engine.core.common.businessentities.gluster.StorageDevice)

Example 9 with 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());
}
Also used : StorageDevice(org.ovirt.engine.core.common.businessentities.gluster.StorageDevice) CreateBrickParameters(org.ovirt.engine.core.common.action.gluster.CreateBrickParameters) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 10 with StorageDevice

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());
}
Also used : StorageDevice(org.ovirt.engine.core.common.businessentities.gluster.StorageDevice) CreateBrickParameters(org.ovirt.engine.core.common.action.gluster.CreateBrickParameters) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Aggregations

StorageDevice (org.ovirt.engine.core.common.businessentities.gluster.StorageDevice)23 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)6 CreateBrickParameters (org.ovirt.engine.core.common.action.gluster.CreateBrickParameters)4 List (java.util.List)3 SizeUnit (org.ovirt.engine.core.common.utils.SizeConverter.SizeUnit)3 HashSet (java.util.HashSet)2 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)2 VDS (org.ovirt.engine.core.common.businessentities.VDS)2 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)2 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 Pattern (java.util.regex.Pattern)1 HostValidator (org.ovirt.engine.core.bll.validator.HostValidator)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1 SyncGlusterStorageDevicesParameter (org.ovirt.engine.core.common.action.gluster.SyncGlusterStorageDevicesParameter)1 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1 RaidType (org.ovirt.engine.core.common.businessentities.RaidType)1 VDSStatus (org.ovirt.engine.core.common.businessentities.VDSStatus)1