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());
}
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());
}
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());
}
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());
}
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);
}
Aggregations