Search in sources :

Example 16 with StorageDevice

use of org.ovirt.engine.core.common.businessentities.gluster.StorageDevice in project ovirt-engine by oVirt.

the class StorageDeviceReturn method getStorageDevice.

protected StorageDevice getStorageDevice(Map<String, Object> map) {
    StorageDevice storageDevice = new StorageDevice();
    storageDevice.setName(map.get(NAME).toString());
    storageDevice.setSize((long) (map.containsKey(SIZE) ? Double.valueOf(map.get(SIZE).toString()) : 0));
    storageDevice.setDevPath(map.containsKey(DEV_PATH) ? map.get(DEV_PATH).toString() : null);
    storageDevice.setCanCreateBrick(map.containsKey(CREATE_BRICK) ? Boolean.valueOf(map.get(CREATE_BRICK).toString()) : Boolean.FALSE);
    storageDevice.setFsType(map.containsKey(FILE_SYSTEM_TYPE) && StringUtils.isNotBlank(map.get(FILE_SYSTEM_TYPE).toString()) ? map.get(FILE_SYSTEM_TYPE).toString() : null);
    storageDevice.setMountPoint(map.containsKey(MOUNT_POINT) && StringUtils.isNotBlank(map.get(MOUNT_POINT).toString()) ? map.get(MOUNT_POINT).toString() : null);
    storageDevice.setDevUuid(map.containsKey(DEV_UUID) && StringUtils.isNotBlank(map.get(DEV_UUID).toString()) ? map.get(DEV_UUID).toString() : null);
    storageDevice.setFsUuid(map.containsKey(UUID) && StringUtils.isNotBlank(map.get(UUID).toString()) ? map.get(UUID).toString() : null);
    storageDevice.setDescription(map.containsKey(MODEL) ? map.get(MODEL).toString() : null);
    storageDevice.setDevType(map.containsKey(BUS) && StringUtils.isNotBlank(map.get(BUS).toString()) ? map.get(BUS).toString() : null);
    return storageDevice;
}
Also used : StorageDevice(org.ovirt.engine.core.common.businessentities.gluster.StorageDevice)

Example 17 with StorageDevice

use of org.ovirt.engine.core.common.businessentities.gluster.StorageDevice in project ovirt-engine by oVirt.

the class StoageDeviceDaoTest method getStorageDevice.

private StorageDevice getStorageDevice() {
    StorageDevice storageDevice = new StorageDevice();
    storageDevice.setId(NEW_STORAGE_DEVICE_ID);
    storageDevice.setCanCreateBrick(true);
    storageDevice.setDescription("Test Device");
    storageDevice.setDevPath("/dev/sdc");
    storageDevice.setDevType("SCSI");
    storageDevice.setDevUuid("ocIYJv-Ej8x-vDPm-kcGr-sHqy-jjeo-Jt2hTj");
    storageDevice.setName("sdc");
    storageDevice.setSize(10000L);
    storageDevice.setVdsId(FixturesTool.GLUSTER_BRICK_SERVER1);
    return storageDevice;
}
Also used : StorageDevice(org.ovirt.engine.core.common.businessentities.gluster.StorageDevice)

Example 18 with StorageDevice

use of org.ovirt.engine.core.common.businessentities.gluster.StorageDevice in project ovirt-engine by oVirt.

the class StoageDeviceDaoTest method testRemove.

@Test
public void testRemove() {
    StorageDevice storageDevice = dao.get(EXISTING_STORAGE_DEVICE_ID_2);
    assertNotNull("storage device doesn't exists", storageDevice);
    dao.remove(EXISTING_STORAGE_DEVICE_ID_2);
    storageDevice = dao.get(EXISTING_STORAGE_DEVICE_ID_2);
    assertNull("Failed to remove storage device", storageDevice);
}
Also used : StorageDevice(org.ovirt.engine.core.common.businessentities.gluster.StorageDevice) Test(org.junit.Test)

Example 19 with StorageDevice

use of org.ovirt.engine.core.common.businessentities.gluster.StorageDevice in project ovirt-engine by oVirt.

the class StoageDeviceDaoTest method testSave.

@Test
public void testSave() {
    StorageDevice storageDevice = getStorageDevice();
    dao.save(storageDevice);
    StorageDevice storageDeviceFromDB = dao.get(storageDevice.getId());
    assertEquals("Storage device is not saved correctly", storageDevice, storageDeviceFromDB);
}
Also used : StorageDevice(org.ovirt.engine.core.common.businessentities.gluster.StorageDevice) Test(org.junit.Test)

Example 20 with StorageDevice

use of org.ovirt.engine.core.common.businessentities.gluster.StorageDevice in project ovirt-engine by oVirt.

the class StoageDeviceDaoTest method testGetById.

@Test
public void testGetById() {
    StorageDevice storageDevice = dao.get(EXISTING_STORAGE_DEVICE_ID_1);
    assertNotNull("Failed to retrive storage device", storageDevice);
    assertEquals("Failed to retrive corrective storage device", EXISTING_STORAGE_DEVICE_ID_1, storageDevice.getId());
    storageDevice = dao.get(NON_EXISTING_STORAGE_DEVICE_ID);
    assertNull(storageDevice);
}
Also used : StorageDevice(org.ovirt.engine.core.common.businessentities.gluster.StorageDevice) Test(org.junit.Test)

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