use of org.ovirt.engine.ui.uicompat.PreparingEnlistment in project ovirt-engine by oVirt.
the class AddDataCenterRM method prepare2.
private void prepare2() {
PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment;
EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
HostListModel<?> model = enlistmentContext.getModel();
ConfigureLocalStorageModel configureModel = (ConfigureLocalStorageModel) model.getWindow();
StoragePool candidate = configureModel.getCandidateDataCenter();
DataCenterModel dataCenterModel = configureModel.getDataCenter();
String dataCenterName = dataCenterModel.getName().getEntity();
if (candidate == null || !Objects.equals(candidate.getName(), dataCenterName)) {
// Try to find existing data center with the specified name.
StoragePool dataCenter = context.dataCenterFoundByName;
if (dataCenter != null) {
enlistmentContext.setDataCenterId(dataCenter.getId());
context.enlistment = null;
enlistment.prepared();
} else {
dataCenter = new StoragePool();
dataCenter.setName(dataCenterName);
dataCenter.setdescription(dataCenterModel.getDescription().getEntity());
dataCenter.setComment(dataCenterModel.getComment().getEntity());
dataCenter.setIsLocal(dataCenterModel.getStoragePoolType().getSelectedItem());
dataCenter.setCompatibilityVersion(dataCenterModel.getVersion().getSelectedItem());
StoragePoolManagementParameter parameters = new StoragePoolManagementParameter(dataCenter);
parameters.setCorrelationId(getCorrelationId());
Frontend.getInstance().runAction(ActionType.AddEmptyStoragePool, parameters, result -> {
context.addDataCenterReturnValue = result.getReturnValue();
prepare3();
});
}
} else {
enlistmentContext.setDataCenterId(configureModel.getDataCenter().getDataCenterId());
context.enlistment = null;
enlistment.prepared();
}
}
use of org.ovirt.engine.ui.uicompat.PreparingEnlistment in project ovirt-engine by oVirt.
the class AddStorageDomainRM method prepare2.
private void prepare2() {
PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment;
ActionReturnValue returnValue = context.activateVdsReturnValue;
if (returnValue == null || !returnValue.getSucceeded()) {
context.enlistment = null;
enlistment.forceRollback();
} else {
prepare3();
}
}
use of org.ovirt.engine.ui.uicompat.PreparingEnlistment 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.ui.uicompat.PreparingEnlistment in project ovirt-engine by oVirt.
the class AddStorageDomainRM method prepare3.
private void prepare3() {
PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment;
EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
HostListModel<?> model = enlistmentContext.getModel();
VDS host = model.getSelectedItem();
if (context.waitTries < MaxWaitTries) {
context.waitTries++;
AsyncDataProvider.getInstance().getHostById(new AsyncQuery<>(returnValue -> {
context.host = returnValue;
timer = new Timer() {
@Override
public void run() {
prepare4();
}
};
timer.scheduleRepeating(WaitInterval);
}), host.getId());
} else {
context.enlistment = null;
enlistment.forceRollback();
}
}
use of org.ovirt.engine.ui.uicompat.PreparingEnlistment in project ovirt-engine by oVirt.
the class AddStorageDomainRM method prepare7.
private void prepare7() {
PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment;
ActionReturnValue returnValue = context.removeStorageServerConnectionReturnValue;
context.enlistment = null;
// ReturnValue not equals null means remove connection occurred.
if (returnValue != null) {
// Don't rollback.
enlistment.done();
} else {
enlistment.prepared();
}
}
Aggregations