use of org.ovirt.engine.core.common.action.StorageDomainManagementParameter in project ovirt-engine by oVirt.
the class DataCenterGuideModel method saveNewLocalStorage.
public void saveNewLocalStorage() {
StorageModel model = (StorageModel) getWindow();
LocalStorageModel localModel = (LocalStorageModel) model.getCurrentStorageItem();
VDS host = model.getHost().getSelectedItem();
hostId = host.getId();
// Create storage connection.
StorageServerConnections tempVar = new StorageServerConnections();
tempVar.setConnection(path);
tempVar.setStorageType(localModel.getType());
connection = tempVar;
ArrayList<ActionType> actionTypes = new ArrayList<>();
ArrayList<ActionParametersBase> parameters = new ArrayList<>();
actionTypes.add(ActionType.AddStorageServerConnection);
actionTypes.add(ActionType.AddLocalStorageDomain);
parameters.add(new StorageServerConnectionParametersBase(connection, host.getId(), false));
StorageDomainManagementParameter tempVar2 = new StorageDomainManagementParameter(storageDomain);
tempVar2.setVdsId(host.getId());
parameters.add(tempVar2);
IFrontendActionAsyncCallback callback1 = result -> {
DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
dataCenterGuideModel.removeConnection = true;
ActionReturnValue actionReturnValue = result.getReturnValue();
dataCenterGuideModel.storageDomain.setStorage((String) actionReturnValue.getActionReturnValue());
};
IFrontendActionAsyncCallback callback2 = result -> {
DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
dataCenterGuideModel.removeConnection = false;
dataCenterGuideModel.onFinish(dataCenterGuideModel.context, true, dataCenterGuideModel.storageModel);
};
IFrontendActionAsyncCallback failureCallback = result -> {
DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
if (dataCenterGuideModel.removeConnection) {
dataCenterGuideModel.cleanConnection(dataCenterGuideModel.connection, dataCenterGuideModel.hostId);
dataCenterGuideModel.removeConnection = false;
}
dataCenterGuideModel.onFinish(dataCenterGuideModel.context, false, dataCenterGuideModel.storageModel);
};
Frontend.getInstance().runMultipleActions(actionTypes, parameters, new ArrayList<>(Arrays.asList(new IFrontendActionAsyncCallback[] { callback1, callback2 })), failureCallback, this);
}
use of org.ovirt.engine.core.common.action.StorageDomainManagementParameter in project ovirt-engine by oVirt.
the class BackendStorageDomainsResource method getAddParams.
private StorageDomainManagementParameter getAddParams(StorageDomainStatic entity, Guid hostId) {
StorageDomainManagementParameter params = new StorageDomainManagementParameter(entity);
params.setVdsId(hostId);
return params;
}
use of org.ovirt.engine.core.common.action.StorageDomainManagementParameter in project ovirt-engine by oVirt.
the class BackendStorageDomainsResource method addExistingSAN.
private Response addExistingSAN(StorageDomain model, StorageType storageType, Guid hostId) {
getEntity(VDS.class, QueryType.GetVdsByVdsId, new IdQueryParameters(hostId), "Host: id=" + hostId);
List<LUNs> existingLuns = getDeviceList(hostId, storageType);
List<StorageServerConnections> existingStorageServerConnections = getLunsWithInitializedStorageType(existingLuns, storageType);
List<org.ovirt.engine.core.common.businessentities.StorageDomain> existingStorageDomains = getExistingBlockStorageDomain(hostId, storageType, existingStorageServerConnections);
StorageDomainStatic storageDomainToImport = getMatchingStorageDomain(asGuid(model.getId()), existingStorageDomains);
if (storageDomainToImport == null) {
throw new WebFaultException(new WebApplicationException(), "Storage Domain id " + model.getId() + " Does not exists", Status.NOT_FOUND);
}
StorageDomainMapper.map(model, storageDomainToImport);
StorageDomainManagementParameter parameters = new StorageDomainManagementParameter(storageDomainToImport);
parameters.setVdsId(hostId);
return performCreate(ActionType.AddExistingBlockStorageDomain, parameters, ID_RESOLVER);
}
use of org.ovirt.engine.core.common.action.StorageDomainManagementParameter in project ovirt-engine by oVirt.
the class DataCenterGuideModel method saveNewPosixStorage.
private void saveNewPosixStorage() {
StorageModel model = (StorageModel) getWindow();
PosixStorageModel posixModel = (PosixStorageModel) model.getCurrentStorageItem();
VDS host = model.getHost().getSelectedItem();
hostId = host.getId();
// Create storage connection.
StorageServerConnections connection = new StorageServerConnections();
connection.setConnection(path);
connection.setStorageType(posixModel.getType());
connection.setVfsType(posixModel.getVfsType().getEntity());
connection.setMountOptions(posixModel.getMountOptions().getEntity());
this.connection = connection;
ArrayList<ActionType> actionTypes = new ArrayList<>();
ArrayList<ActionParametersBase> parameters = new ArrayList<>();
actionTypes.add(ActionType.AddStorageServerConnection);
actionTypes.add(posixModel.getAddStorageDomainVdcAction());
parameters.add(new StorageServerConnectionParametersBase(this.connection, host.getId(), false));
StorageDomainManagementParameter parameter = new StorageDomainManagementParameter(storageDomain);
parameter.setVdsId(host.getId());
StoragePool dataCenter = model.getDataCenter().getSelectedItem();
parameter.setStoragePoolId(dataCenter.getId());
parameters.add(parameter);
IFrontendActionAsyncCallback callback1 = result -> {
DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
ActionReturnValue actionReturnValue = result.getReturnValue();
dataCenterGuideModel.storageDomain.setStorage((String) actionReturnValue.getActionReturnValue());
dataCenterGuideModel.connection.setId((String) actionReturnValue.getActionReturnValue());
};
IFrontendActionAsyncCallback callback2 = result -> {
DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
ActionReturnValue actionReturnValue = result.getReturnValue();
dataCenterGuideModel.storageId = actionReturnValue.getActionReturnValue();
// Attach storage to data center as necessary.
StorageModel storageModel = (StorageModel) dataCenterGuideModel.getWindow();
StoragePool selectedDataCenter = storageModel.getDataCenter().getSelectedItem();
if (!selectedDataCenter.getId().equals(StorageModel.UnassignedDataCenterId)) {
dataCenterGuideModel.attachStorageToDataCenter(dataCenterGuideModel.storageId, selectedDataCenter.getId());
}
dataCenterGuideModel.onFinish(dataCenterGuideModel.context, true, dataCenterGuideModel.storageModel);
};
IFrontendActionAsyncCallback failureCallback = result -> {
DataCenterGuideModel dataCenterGuideModel = (DataCenterGuideModel) result.getState();
dataCenterGuideModel.cleanConnection(dataCenterGuideModel.connection, dataCenterGuideModel.hostId);
dataCenterGuideModel.onFinish(dataCenterGuideModel.context, false, dataCenterGuideModel.storageModel);
};
Frontend.getInstance().runMultipleActions(actionTypes, parameters, new ArrayList<>(Arrays.asList(new IFrontendActionAsyncCallback[] { callback1, callback2 })), failureCallback, this);
}
use of org.ovirt.engine.core.common.action.StorageDomainManagementParameter in project ovirt-engine by oVirt.
the class HostedEngineImporter method getHEStorageDomain.
private StorageDomain getHEStorageDomain(VM vm, StoragePool storagePool, Guid storageDomainId) {
StorageDomain storageDomain = storageDomainDao.getForStoragePool(storageDomainId, storagePool.getId());
if (storageDomain != null) {
return storageDomain;
}
StorageDomainManagementParameter importParams = new StorageDomainManagementParameter();
importParams.setStorageDomainId(storageDomainId);
importParams.setVdsId(vm.getRunOnVds());
return backend.runInternalAction(ActionType.ImportHostedEngineStorageDomain, importParams).getActionReturnValue();
}
Aggregations