Search in sources :

Example 1 with AddSANStorageDomainParameters

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

the class StorageListModel method saveNewSanStorage.

public void saveNewSanStorage() {
    StorageModel model = (StorageModel) getWindow();
    SanStorageModelBase sanModel = (SanStorageModelBase) model.getCurrentStorageItem();
    VDS host = model.getHost().getSelectedItem();
    boolean force = sanModel.isForce();
    HashSet<String> lunIds = new HashSet<>();
    for (LunModel lun : sanModel.getAddedLuns()) {
        lunIds.add(lun.getLunId());
    }
    AddSANStorageDomainParameters params = new AddSANStorageDomainParameters(storageDomain);
    params.setVdsId(host.getId());
    params.setLunIds(lunIds);
    params.setForce(force);
    Frontend.getInstance().runAction(ActionType.AddSANStorageDomain, params, result -> {
        StorageListModel storageListModel = (StorageListModel) result.getState();
        StorageModel storageModel = (StorageModel) storageListModel.getWindow();
        storageListModel.storageModel = storageModel.getCurrentStorageItem();
        if (!result.getReturnValue().getSucceeded()) {
            storageListModel.onFinish(storageListModel.context, false, storageListModel.storageModel);
            return;
        }
        StoragePool dataCenter = storageModel.getDataCenter().getSelectedItem();
        if (!dataCenter.getId().equals(StorageModel.UnassignedDataCenterId)) {
            ActionReturnValue returnValue = result.getReturnValue();
            Guid storageId = returnValue.getActionReturnValue();
            storageListModel.attachStorageToDataCenter(storageId, dataCenter.getId(), storageModel.getActivateDomain().getEntity());
        }
        storageListModel.onFinish(storageListModel.context, true, storageListModel.storageModel);
    }, this);
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) VDS(org.ovirt.engine.core.common.businessentities.VDS) Guid(org.ovirt.engine.core.compat.Guid) AddSANStorageDomainParameters(org.ovirt.engine.core.common.action.AddSANStorageDomainParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) HashSet(java.util.HashSet)

Example 2 with AddSANStorageDomainParameters

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

the class DataCenterGuideModel method onSaveSanStorage.

private void onSaveSanStorage() {
    ConfirmationModel confirmationModel = (ConfirmationModel) getConfirmWindow();
    if (confirmationModel != null && !confirmationModel.validate()) {
        return;
    }
    cancelConfirm();
    getWindow().startProgress();
    StorageModel model = (StorageModel) getWindow();
    SanStorageModelBase sanModel = (SanStorageModelBase) model.getCurrentStorageItem();
    VDS host = model.getHost().getSelectedItem();
    boolean force = sanModel.isForce();
    HashSet<String> lunIds = new HashSet<>();
    for (LunModel lun : sanModel.getAddedLuns()) {
        lunIds.add(lun.getLunId());
    }
    AddSANStorageDomainParameters params = new AddSANStorageDomainParameters(storageDomain);
    params.setVdsId(host.getId());
    params.setLunIds(new HashSet<>(lunIds));
    params.setForce(force);
    Frontend.getInstance().runAction(ActionType.AddSANStorageDomain, params, result -> {
        DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
        StorageModel storageModel = (StorageModel) dataCenterGuideModel.getWindow();
        StoragePool dataCenter = storageModel.getDataCenter().getSelectedItem();
        if (!dataCenter.getId().equals(StorageModel.UnassignedDataCenterId)) {
            ActionReturnValue returnValue = result.getReturnValue();
            Guid storageId = returnValue.getActionReturnValue();
            dataCenterGuideModel.attachStorageToDataCenter(storageId, dataCenter.getId());
        }
        dataCenterGuideModel.onFinish(dataCenterGuideModel.context, true, dataCenterGuideModel.storageModel);
    }, this);
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) SanStorageModelBase(org.ovirt.engine.ui.uicommonweb.models.storage.SanStorageModelBase) VDS(org.ovirt.engine.core.common.businessentities.VDS) PosixStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.PosixStorageModel) IStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.IStorageModel) StorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.StorageModel) NfsStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.NfsStorageModel) LocalStorageModel(org.ovirt.engine.ui.uicommonweb.models.storage.LocalStorageModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) Guid(org.ovirt.engine.core.compat.Guid) AddSANStorageDomainParameters(org.ovirt.engine.core.common.action.AddSANStorageDomainParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) LunModel(org.ovirt.engine.ui.uicommonweb.models.storage.LunModel) HashSet(java.util.HashSet)

Example 3 with AddSANStorageDomainParameters

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

the class BackendStorageDomainsResource method getSanAddParams.

private AddSANStorageDomainParameters getSanAddParams(StorageDomainStatic entity, Guid hostId, Set<String> lunIds, boolean force) {
    AddSANStorageDomainParameters params = new AddSANStorageDomainParameters(entity);
    params.setVdsId(hostId);
    params.setLunIds(lunIds);
    params.setForce(force);
    return params;
}
Also used : AddSANStorageDomainParameters(org.ovirt.engine.core.common.action.AddSANStorageDomainParameters)

Aggregations

AddSANStorageDomainParameters (org.ovirt.engine.core.common.action.AddSANStorageDomainParameters)3 HashSet (java.util.HashSet)2 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)2 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)2 VDS (org.ovirt.engine.core.common.businessentities.VDS)2 Guid (org.ovirt.engine.core.compat.Guid)2 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)1 IStorageModel (org.ovirt.engine.ui.uicommonweb.models.storage.IStorageModel)1 LocalStorageModel (org.ovirt.engine.ui.uicommonweb.models.storage.LocalStorageModel)1 LunModel (org.ovirt.engine.ui.uicommonweb.models.storage.LunModel)1 NfsStorageModel (org.ovirt.engine.ui.uicommonweb.models.storage.NfsStorageModel)1 PosixStorageModel (org.ovirt.engine.ui.uicommonweb.models.storage.PosixStorageModel)1 SanStorageModelBase (org.ovirt.engine.ui.uicommonweb.models.storage.SanStorageModelBase)1 StorageModel (org.ovirt.engine.ui.uicommonweb.models.storage.StorageModel)1