Search in sources :

Example 16 with IscsiBond

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

the class BackendIscsiBondNetworksResource method add.

@Override
public Response add(Network network) {
    org.ovirt.engine.core.common.businessentities.network.Network entity = NetworkMapper.map(network, null);
    IscsiBond iscsiBond = getIscsiBond();
    iscsiBond.getNetworkIds().add(entity.getId());
    return performAction(ActionType.EditIscsiBond, new EditIscsiBondParameters(iscsiBond));
}
Also used : EditIscsiBondParameters(org.ovirt.engine.core.common.action.EditIscsiBondParameters) IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond)

Example 17 with IscsiBond

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

the class BackendIscsiBondStorageConnectionResource method remove.

@Override
public Response remove() {
    get();
    IscsiBond iscsiBond = parent.getIscsiBond();
    iscsiBond.getStorageConnectionIds().remove(id);
    return performAction(ActionType.EditIscsiBond, new EditIscsiBondParameters(iscsiBond));
}
Also used : EditIscsiBondParameters(org.ovirt.engine.core.common.action.EditIscsiBondParameters) IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond)

Example 18 with IscsiBond

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

the class BackendIscsiBondStorageConnectionsResource method add.

@Override
public Response add(StorageConnection conn) {
    StorageServerConnections entity = StorageDomainMapper.map(conn, null);
    IscsiBond iscsiBond = getIscsiBond();
    iscsiBond.getStorageConnectionIds().add(entity.getId());
    return performAction(ActionType.EditIscsiBond, new EditIscsiBondParameters(iscsiBond));
}
Also used : EditIscsiBondParameters(org.ovirt.engine.core.common.action.EditIscsiBondParameters) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond)

Example 19 with IscsiBond

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

the class RemoveIscsiBondCommand method getStoragePoolId.

@Override
public Guid getStoragePoolId() {
    Guid storagePoolId = super.getStoragePoolId();
    if (storagePoolId == null) {
        IscsiBond iscsiBond = getIscsiBond();
        if (iscsiBond != null) {
            storagePoolId = iscsiBond.getStoragePoolId();
            setStoragePoolId(storagePoolId);
        }
    }
    return storagePoolId;
}
Also used : IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond) Guid(org.ovirt.engine.core.compat.Guid)

Example 20 with IscsiBond

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

the class AddIscsiBondCommand method executeCommand.

@Override
protected void executeCommand() {
    final IscsiBond iscsiBond = getIscsiBond();
    iscsiBond.setId(Guid.newGuid());
    TransactionSupport.executeInNewTransaction(() -> {
        iscsiBondDao.save(iscsiBond);
        for (Guid networkId : iscsiBond.getNetworkIds()) {
            iscsiBondDao.addNetworkToIscsiBond(iscsiBond.getId(), networkId);
        }
        for (String connectionId : iscsiBond.getStorageConnectionIds()) {
            iscsiBondDao.addStorageConnectionToIscsiBond(iscsiBond.getId(), connectionId);
        }
        getReturnValue().setActionReturnValue(iscsiBond.getId());
        return null;
    });
    connectAllHostsToStorage(iscsiBond.getStorageConnectionIds());
    setSucceeded(true);
}
Also used : IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond) Guid(org.ovirt.engine.core.compat.Guid)

Aggregations

IscsiBond (org.ovirt.engine.core.common.businessentities.IscsiBond)36 ArrayList (java.util.ArrayList)13 Test (org.junit.Test)12 Guid (org.ovirt.engine.core.compat.Guid)9 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)5 EditIscsiBondParameters (org.ovirt.engine.core.common.action.EditIscsiBondParameters)5 AbstractQueryTest (org.ovirt.engine.core.bll.AbstractQueryTest)4 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)4 Network (org.ovirt.engine.core.common.businessentities.network.Network)4 NetworkCluster (org.ovirt.engine.core.common.businessentities.network.NetworkCluster)2 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)2 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 RemoveIscsiBondParameters (org.ovirt.engine.core.common.action.RemoveIscsiBondParameters)1 StorageServerConnectionQueryParametersBase (org.ovirt.engine.core.common.queries.StorageServerConnectionQueryParametersBase)1 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)1