Search in sources :

Example 1 with CreateBrickParameters

use of org.ovirt.engine.core.common.action.gluster.CreateBrickParameters in project ovirt-engine by oVirt.

the class CreateBrickCommandTest method validateSucceeds.

@Test
public void validateSucceeds() {
    doReturn(new CreateBrickParameters(HOST_ID, "brick1", "/gluster-bricks/brick1", RaidType.RAID0, null, null, Collections.singletonList(getStorageDevice("sda")), getStorageDevice("sdb"), CacheModeType.writethrough, 10)).when(cmd).getParameters();
    prepareMocks(VDSStatus.Up);
    assertTrue(cmd.validate());
}
Also used : CreateBrickParameters(org.ovirt.engine.core.common.action.gluster.CreateBrickParameters) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 2 with CreateBrickParameters

use of org.ovirt.engine.core.common.action.gluster.CreateBrickParameters 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 3 with CreateBrickParameters

use of org.ovirt.engine.core.common.action.gluster.CreateBrickParameters in project ovirt-engine by oVirt.

the class CreateBrickCommandTest method validateFailsForNoStorageDevice.

@Test
public void validateFailsForNoStorageDevice() {
    doReturn(new CreateBrickParameters(HOST_ID, "brick1", "/gluster-bricks/brick1", RaidType.RAID0, null, null, Collections.emptyList(), getStorageDevice("sdd"), CacheModeType.writethrough, 10)).when(cmd).getParameters();
    prepareMocks(VDSStatus.Up);
    assertFalse(cmd.validate());
}
Also used : CreateBrickParameters(org.ovirt.engine.core.common.action.gluster.CreateBrickParameters) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 4 with CreateBrickParameters

use of org.ovirt.engine.core.common.action.gluster.CreateBrickParameters 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)

Example 5 with CreateBrickParameters

use of org.ovirt.engine.core.common.action.gluster.CreateBrickParameters in project ovirt-engine by oVirt.

the class HostGlusterStorageDevicesListModel method onCreateBrick.

private void onCreateBrick() {
    CreateBrickModel lvModel = (CreateBrickModel) getWindow();
    if (lvModel == null) {
        return;
    }
    if (!lvModel.validate()) {
        return;
    }
    VDS host = getEntity();
    if (host == null) {
        return;
    }
    lvModel.startProgress();
    List<StorageDevice> selectedDevices = new ArrayList<>();
    for (StorageDevice device : lvModel.getStorageDevices().getSelectedItems()) {
        selectedDevices.add(device);
    }
    CreateBrickParameters parameters = new CreateBrickParameters(host.getId(), lvModel.getLvName().getEntity(), lvModel.getMountPoint().getEntity(), lvModel.getRaidTypeList().getSelectedItem(), lvModel.getNoOfPhysicalDisksInRaidVolume().getEntity(), lvModel.getStripeSize().getEntity(), selectedDevices, lvModel.getCacheDevicePathTypeList().getSelectedItem(), lvModel.getCacheModeTypeList().getSelectedItem(), lvModel.getCacheSize().getEntity());
    Frontend.getInstance().runAction(ActionType.CreateBrick, parameters, result -> postCreateBrick(result.getReturnValue()), this);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) StorageDevice(org.ovirt.engine.core.common.businessentities.gluster.StorageDevice) ArrayList(java.util.ArrayList) CreateBrickParameters(org.ovirt.engine.core.common.action.gluster.CreateBrickParameters)

Aggregations

CreateBrickParameters (org.ovirt.engine.core.common.action.gluster.CreateBrickParameters)5 Test (org.junit.Test)4 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)4 StorageDevice (org.ovirt.engine.core.common.businessentities.gluster.StorageDevice)3 ArrayList (java.util.ArrayList)1 VDS (org.ovirt.engine.core.common.businessentities.VDS)1