use of org.ovirt.engine.ui.uicompat.Enlistment in project ovirt-engine by oVirt.
the class AddDataCenterRM method rollback3.
public void rollback3() {
Enlistment enlistment = context.enlistment;
EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
HostListModel<?> model = enlistmentContext.getModel();
VDS host = context.hostFoundById;
boolean abort = false;
if (model.getSelectedItem() != null) {
// Perform rollback only when the host is in maintenance.
if (host.getStatus() != VDSStatus.Maintenance) {
abort = true;
}
} else {
abort = true;
}
if (abort) {
context.enlistment = null;
enlistment.done();
return;
}
StoragePool dataCenter = context.dataCenterFoundById;
// Perform rollback only when the Data Center is un uninitialized.
if (dataCenter.getStatus() != StoragePoolStatus.Uninitialized) {
context.enlistment = null;
enlistment.done();
return;
}
if (enlistmentContext.getOldClusterId() != null) {
// Switch host back to previous cluster.
Frontend.getInstance().runAction(ActionType.ChangeVDSCluster, new ChangeVDSClusterParameters(enlistmentContext.getOldClusterId(), host.getId()), result -> {
ActionReturnValue returnValue = result.getReturnValue();
context.changeVDSClusterReturnValue = returnValue;
rollback4();
});
} else {
context.enlistment = null;
enlistment.done();
}
}
use of org.ovirt.engine.ui.uicompat.Enlistment in project ovirt-engine by oVirt.
the class AddDataCenterRM method rollback4.
private void rollback4() {
Enlistment enlistment = context.enlistment;
EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
ActionReturnValue returnValue = context.changeVDSClusterReturnValue;
if (returnValue != null && returnValue.getSucceeded()) {
// Remove cluster.
if (enlistmentContext.getClusterId() != null) {
Frontend.getInstance().runAction(ActionType.RemoveCluster, new ClusterParametersBase(enlistmentContext.getClusterId()), result -> rollback5());
}
} else {
context.enlistment = null;
enlistment.done();
}
}
use of org.ovirt.engine.ui.uicompat.Enlistment in project ovirt-engine by oVirt.
the class AddDataCenterRM method rollback2.
public void rollback2() {
Enlistment enlistment = context.enlistment;
EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
HostListModel<?> model = enlistmentContext.getModel();
VDS host = model.getSelectedItem();
// Retrieve host to make sure we have an updated status etc.
AsyncDataProvider.getInstance().getHostById(new AsyncQuery<>(returnValue -> {
context.hostFoundById = returnValue;
rollback3();
}), host.getId());
}
use of org.ovirt.engine.ui.uicompat.Enlistment 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.Enlistment in project ovirt-engine by oVirt.
the class AddDataCenterRM method rollback1.
public void rollback1() {
Enlistment enlistment = context.enlistment;
EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
if (enlistmentContext.getDataCenterId() != null) {
AsyncDataProvider.getInstance().getDataCenterById(new AsyncQuery<>(returnValue -> {
context.dataCenterFoundById = returnValue;
rollback2();
}), enlistmentContext.getDataCenterId());
} else {
rollback3();
}
}
Aggregations