private void rollback5() { Enlistment enlistment = context.enlistment; EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext(); // Try to remove data center. if (enlistmentContext.getDataCenterId() != null) { Frontend.getInstance().runAction(ActionType.RemoveStoragePool, new StoragePoolParametersBase(enlistmentContext.getDataCenterId())); } // Call done, no matter whether the data center deletion was successful. context.enlistment = null; enlistment.done(); }
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()); }
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(); } }
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(); } }
public void prepare1() { EnlistmentContext enlistmentContext = (EnlistmentContext) context.enlistment.getContext(); HostListModel<?> model = enlistmentContext.getModel(); final VDS host = model.getSelectedItem(); VdsActionParameters parameters = new VdsActionParameters(host.getId()); parameters.setCorrelationId(getCorrelationId()); Frontend.getInstance().runAction(ActionType.ActivateVds, parameters, result -> { ActionReturnValue returnValue = result.getReturnValue(); context.activateVdsReturnValue = returnValue; prepare2(); }); }
private void prepare1() { EnlistmentContext enlistmentContext = (EnlistmentContext) context.enlistment.getContext(); HostListModel<?> model = enlistmentContext.getModel(); ConfigureLocalStorageModel configureModel = (ConfigureLocalStorageModel) model.getWindow(); DataCenterModel dataCenterModel = configureModel.getDataCenter(); String dataCenterName = dataCenterModel.getName().getEntity(); if (!StringHelper.isNullOrEmpty(dataCenterName)) { AsyncDataProvider.getInstance().getDataCenterListByName(new AsyncQuery<>( returnValue -> { context.dataCenterFoundByName = Linq.firstOrNull(returnValue); prepare2(); }), dataCenterName); } else { prepare2(); } }
public void prepare1() { EnlistmentContext enlistmentContext = (EnlistmentContext) context.enlistment.getContext(); HostListModel<?> model = enlistmentContext.getModel(); ConfigureLocalStorageModel configureModel = (ConfigureLocalStorageModel) model.getWindow(); ClusterModel clusterModel = configureModel.getCluster(); String clusterName = clusterModel.getName().getEntity(); if (!StringHelper.isNullOrEmpty(clusterName)) { AsyncDataProvider.getInstance().getClusterListByName(new AsyncQuery<>( returnValue -> { context.clusterFoundByName = Linq.firstOrNull(returnValue); prepare2(); }), clusterName); } else { prepare2(); } }
public void prepare1() { PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment; EnlistmentContext enlistmentContext = (EnlistmentContext) context.enlistment.getContext(); HostListModel<?> model = enlistmentContext.getModel(); VDS host = model.getSelectedItem(); if (!enlistmentContext.getClusterId().equals(host.getClusterId())) { enlistmentContext.setOldClusterId(host.getClusterId()); ChangeVDSClusterParameters parameters = new ChangeVDSClusterParameters(enlistmentContext.getClusterId(), host.getId()); parameters.setCorrelationId(getCorrelationId()); Frontend.getInstance().runAction(ActionType.ChangeVDSCluster, parameters, result -> { ActionReturnValue returnValue = result.getReturnValue(); context.changeVDSClusterReturnValue = returnValue; prepare2(); }); } else { context.enlistment = null; enlistment.prepared(); } }
public void rollback3() { EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext(); HostListModel<?> model = enlistmentContext.getModel();