use of org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase in project ovirt-engine by oVirt.
the class AddStorageDomainRM method prepare6.
private void prepare6() {
ActionReturnValue returnValue = context.addLocalStorageDomainReturnValue;
if (returnValue == null || !returnValue.getSucceeded()) {
StorageServerConnectionParametersBase parameter = new StorageServerConnectionParametersBase(context.connection, context.host.getId(), false);
parameter.setCorrelationId(getCorrelationId());
Frontend.getInstance().runAction(ActionType.DisconnectStorageServerConnection, parameter, result -> {
ActionReturnValue returnValue1 = result.getReturnValue();
context.removeStorageServerConnectionReturnValue = returnValue1;
prepare7();
});
} else {
prepare7();
}
}
use of org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase in project ovirt-engine by oVirt.
the class AddStorageDomainRM method prepare4.
private void prepare4() {
if (timer != null) {
timer.cancel();
timer = null;
}
PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment;
EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
HostListModel<?> model = enlistmentContext.getModel();
ConfigureLocalStorageModel configureModel = (ConfigureLocalStorageModel) model.getWindow();
if (context.host.getStatus() != VDSStatus.Up) {
prepare3();
} else {
// Add storage domain.
StorageServerConnections connection = new StorageServerConnections();
connection.setConnection(configureModel.getStorage().getPath().getEntity());
connection.setStorageType(StorageType.LOCALFS);
context.connection = connection;
StorageServerConnectionParametersBase parameters = new StorageServerConnectionParametersBase(connection, context.host.getId(), false);
parameters.setCorrelationId(getCorrelationId());
Frontend.getInstance().runAction(ActionType.AddStorageServerConnection, parameters, result -> {
ActionReturnValue returnValue = result.getReturnValue();
context.addStorageServerConnectionReturnValue = returnValue;
prepare5();
});
}
}
use of org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase in project ovirt-engine by oVirt.
the class StorageListModel method postImportFileStorage.
public void postImportFileStorage(TaskContext context, boolean isSucceeded, IStorageModel model, String message) {
Frontend.getInstance().runAction(ActionType.DisconnectStorageServerConnection, new StorageServerConnectionParametersBase(fileConnection, hostId, false), result -> {
ActionReturnValue returnValue = result.getReturnValue();
boolean success = returnValue != null && returnValue.getSucceeded();
if (success) {
fileConnection = null;
}
Object[] array = (Object[]) result.getState();
onFinish((TaskContext) array[0], (Boolean) array[1], (IStorageModel) array[2], (String) array[3]);
}, new Object[] { context, isSucceeded, model, message });
}
use of org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase in project ovirt-engine by oVirt.
the class StorageListModel method saveNewNfsStorage.
public void saveNewNfsStorage() {
StorageModel model = (StorageModel) getWindow();
NfsStorageModel nfsModel = (NfsStorageModel) model.getCurrentStorageItem();
VDS host = model.getHost().getSelectedItem();
hostId = host.getId();
// Create storage connection.
StorageServerConnections storageConnection = new StorageServerConnections();
storageConnection.setConnection(path);
storageConnection.setStorageType(nfsModel.getType());
if (isConnectionOverriden()) {
storageConnection.setNfsVersion((NfsVersion) ((EntityModel) nfsModel.getVersion().getSelectedItem()).getEntity());
storageConnection.setNfsRetrans(nfsModel.getRetransmissions().asConvertible().nullableShort());
storageConnection.setNfsTimeo(nfsModel.getTimeout().asConvertible().nullableShort());
storageConnection.setMountOptions(nfsModel.getMountOptions().getEntity());
}
connection = storageConnection;
ArrayList<ActionType> actionTypes = new ArrayList<>();
ArrayList<ActionParametersBase> parameters = new ArrayList<>();
actionTypes.add(ActionType.AddStorageServerConnection);
actionTypes.add(ActionType.AddNFSStorageDomain);
actionTypes.add(ActionType.DisconnectStorageServerConnection);
parameters.add(new StorageServerConnectionParametersBase(connection, host.getId(), false));
StorageDomainManagementParameter tempVar2 = new StorageDomainManagementParameter(storageDomain);
tempVar2.setVdsId(host.getId());
StoragePool dataCenter = model.getDataCenter().getSelectedItem();
tempVar2.setStoragePoolId(dataCenter.getId());
parameters.add(tempVar2);
parameters.add(new StorageServerConnectionParametersBase(connection, host.getId(), false));
IFrontendActionAsyncCallback callback1 = result -> {
StorageListModel storageListModel = (StorageListModel) result.getState();
ActionReturnValue actionReturnValue = result.getReturnValue();
storageListModel.storageDomain.setStorage((String) actionReturnValue.getActionReturnValue());
storageListModel.connection.setId((String) actionReturnValue.getActionReturnValue());
};
IFrontendActionAsyncCallback callback2 = result -> {
StorageListModel storageListModel = (StorageListModel) result.getState();
ActionReturnValue actionReturnValue = result.getReturnValue();
storageListModel.storageId = actionReturnValue.getActionReturnValue();
};
IFrontendActionAsyncCallback callback3 = result -> {
StorageListModel storageListModel = (StorageListModel) result.getState();
StorageModel storageModel = (StorageModel) storageListModel.getWindow();
// Attach storage to data center as necessary.
StoragePool dataCenter1 = storageModel.getDataCenter().getSelectedItem();
if (!dataCenter1.getId().equals(StorageModel.UnassignedDataCenterId)) {
storageListModel.attachStorageToDataCenter(storageListModel.storageId, dataCenter1.getId(), storageModel.getActivateDomain().getEntity());
}
storageListModel.onFinish(storageListModel.context, true, storageListModel.storageModel);
};
IFrontendActionAsyncCallback failureCallback = result -> {
StorageListModel storageListModel = (StorageListModel) result.getState();
storageListModel.cleanConnection(storageListModel.connection, storageListModel.hostId);
storageListModel.onFinish(storageListModel.context, false, storageListModel.storageModel);
};
Frontend.getInstance().runMultipleActions(actionTypes, parameters, new ArrayList<>(Arrays.asList(callback1, callback2, callback3)), failureCallback, this);
}
use of org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase in project ovirt-engine by oVirt.
the class StorageListModel 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 -> {
StorageListModel storageListModel = (StorageListModel) result.getState();
storageListModel.removeConnection = true;
ActionReturnValue actionReturnValue = result.getReturnValue();
storageListModel.storageDomain.setStorage((String) actionReturnValue.getActionReturnValue());
storageListModel.connection.setId((String) actionReturnValue.getActionReturnValue());
};
IFrontendActionAsyncCallback callback2 = result -> {
StorageListModel storageListModel = (StorageListModel) result.getState();
storageListModel.removeConnection = false;
storageListModel.onFinish(storageListModel.context, true, storageListModel.storageModel);
};
IFrontendActionAsyncCallback failureCallback = result -> {
StorageListModel storageListModel = (StorageListModel) result.getState();
if (storageListModel.removeConnection) {
storageListModel.cleanConnection(storageListModel.connection, storageListModel.hostId);
storageListModel.removeConnection = false;
}
storageListModel.onFinish(storageListModel.context, false, storageListModel.storageModel);
};
Frontend.getInstance().runMultipleActions(actionTypes, parameters, new ArrayList<>(Arrays.asList(new IFrontendActionAsyncCallback[] { callback1, callback2 })), failureCallback, this);
}
Aggregations