Search in sources :

Example 21 with StorageDevice

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

Example 22 with StorageDevice

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

the class HostGlusterStorageDevicesListModel method canCreateBrick.

private boolean canCreateBrick() {
    boolean canCreateBrick = false;
    List<StorageDevice> selectedDevices = getSelectedItems();
    if (selectedDevices != null) {
        for (StorageDevice device : selectedDevices) {
            if (device.getCanCreateBrick()) {
                canCreateBrick = true;
            } else {
                canCreateBrick = false;
                break;
            }
        }
    }
    return canCreateBrick;
}
Also used : StorageDevice(org.ovirt.engine.core.common.businessentities.gluster.StorageDevice)

Example 23 with StorageDevice

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

the class CreateBrickModel method updateBrickSize.

private void updateBrickSize() {
    long totalSize = 0;
    // capacity.
    if (getStorageDevices().getSelectedItems() != null) {
        for (StorageDevice storageDevice : getStorageDevices().getSelectedItems()) {
            totalSize += storageDevice.getSize();
        }
    }
    Pair<SizeUnit, Double> convertedSize = SizeConverter.autoConvert(totalSize, SizeUnit.MiB);
    setBrickSize(convertedSize);
}
Also used : SizeUnit(org.ovirt.engine.core.common.utils.SizeConverter.SizeUnit) StorageDevice(org.ovirt.engine.core.common.businessentities.gluster.StorageDevice)

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