Search in sources :

Example 1 with AttachStorageDomainToPoolParameters

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

the class ImportHostedEngineStorageDomainCommand method executeCommand.

@Override
protected void executeCommand() {
    StorageDomainManagementParameter addSdParams = new StorageDomainManagementParameter(heStorageDomain.getStorageStaticData());
    addSdParams.setVdsId(getParameters().getVdsId());
    addSdParams.setStoragePoolId(getVds().getStoragePoolId());
    ActionType actionType = null;
    switch(heStorageDomain.getStorageType()) {
        case NFS:
        case GLUSTERFS:
            actionType = ActionType.AddExistingFileStorageDomain;
            addStorageServerConnection();
            break;
        case ISCSI:
            discoverBlockConnectionDetails();
        case FCP:
            actionType = ActionType.AddExistingBlockStorageDomain;
            removeHostedEngineLunDisk();
            break;
    }
    if (getSucceeded()) {
        setSucceeded(backend.runInternalAction(actionType, addSdParams, getContext()).getSucceeded());
    }
    if (getSucceeded()) {
        AttachStorageDomainToPoolParameters attachSdParams = new AttachStorageDomainToPoolParameters(addSdParams.getStorageDomainId(), addSdParams.getStoragePoolId());
        setSucceeded(backend.runInternalAction(ActionType.AttachStorageDomainToPool, attachSdParams, getContext()).getSucceeded());
    }
    setActionReturnValue(heStorageDomain);
}
Also used : AttachStorageDomainToPoolParameters(org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters) ActionType(org.ovirt.engine.core.common.action.ActionType) StorageDomainManagementParameter(org.ovirt.engine.core.common.action.StorageDomainManagementParameter)

Example 2 with AttachStorageDomainToPoolParameters

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

the class BackendAttachedStorageDomainsResource method add.

@Override
public Response add(StorageDomain storageDomain) {
    validateParameters(storageDomain, "id|name");
    Guid storageDomainId;
    if (storageDomain.isSetId()) {
        storageDomainId = asGuid(storageDomain.getId());
    } else {
        storageDomainId = lookupStorageDomainIdByName(storageDomain.getName());
    }
    return performCreate(ActionType.AttachStorageDomainToPool, new AttachStorageDomainToPoolParameters(storageDomainId, dataCenterId), new StorageDomainIdResolver(storageDomainId));
}
Also used : AttachStorageDomainToPoolParameters(org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters) Guid(org.ovirt.engine.core.compat.Guid)

Example 3 with AttachStorageDomainToPoolParameters

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

the class AddLocalStorageDomainCommand method executeCommand.

@Override
protected void executeCommand() {
    super.executeCommand();
    if (getSucceeded()) {
        ActionReturnValue returnValue = Backend.getInstance().runInternalAction(ActionType.AttachStorageDomainToPool, new AttachStorageDomainToPoolParameters(getStorageDomain().getId(), getStoragePool().getId()));
        if (!returnValue.getSucceeded()) {
            getReturnValue().setSucceeded(false);
            getReturnValue().setFault(returnValue.getFault());
        }
    }
}
Also used : AttachStorageDomainToPoolParameters(org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue)

Example 4 with AttachStorageDomainToPoolParameters

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

the class StorageDataCenterListModel method executeAttachStorageDomains.

public void executeAttachStorageDomains(Model model) {
    ArrayList<ActionParametersBase> parameters = new ArrayList<>();
    for (StoragePool dataCenter : getSelectedDataCentersForAttach()) {
        parameters.add(new AttachStorageDomainToPoolParameters(getEntity().getId(), dataCenter.getId()));
    }
    Frontend.getInstance().runMultipleAction(ActionType.AttachStorageDomainToPool, parameters, result -> {
        ListModel localModel = (ListModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, model);
}
Also used : AttachStorageDomainToPoolParameters(org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) ArrayList(java.util.ArrayList) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 5 with AttachStorageDomainToPoolParameters

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

the class StorageListModel method attachStorageToDataCenter.

private void attachStorageToDataCenter(Guid storageId, Guid dataCenterId, Boolean activateDomain) {
    AttachStorageDomainToPoolParameters params = new AttachStorageDomainToPoolParameters(storageId, dataCenterId);
    if (activateDomain != null) {
        params.setActivate(activateDomain);
    }
    Frontend.getInstance().runAction(ActionType.AttachStorageDomainToPool, params, null, this);
}
Also used : AttachStorageDomainToPoolParameters(org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters)

Aggregations

AttachStorageDomainToPoolParameters (org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters)5 ArrayList (java.util.ArrayList)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1 StorageDomainManagementParameter (org.ovirt.engine.core.common.action.StorageDomainManagementParameter)1 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)1 Guid (org.ovirt.engine.core.compat.Guid)1 ListModel (org.ovirt.engine.ui.uicommonweb.models.ListModel)1 SearchableListModel (org.ovirt.engine.ui.uicommonweb.models.SearchableListModel)1