/** * Get the current deployment status for a topology. * * @param deployment deployment for which we want the status * @param callback that will be called when status is available* * @return The status of the topology. * @throws alien4cloud.paas.exception.OrchestratorDisabledException In case the cloud selected for * the topology is disabled. */ public void getDeploymentStatus( final Deployment deployment, final IPaaSCallback<DeploymentStatus> callback) throws OrchestratorDisabledException { if (deployment == null) { callback.onSuccess(DeploymentStatus.UNDEPLOYED); return; } IOrchestratorPlugin orchestratorPlugin = orchestratorPluginService.getOrFail(deployment.getOrchestratorId()); PaaSDeploymentContext deploymentContext = new PaaSDeploymentContext(deployment, getRuntimeTopology(deployment.getId())); IPaaSCallback<DeploymentStatus> esCallback = new IPaaSCallback<DeploymentStatus>() { @Override public void onSuccess(DeploymentStatus data) { if (data == DeploymentStatus.UNDEPLOYED) { deployment.setEndDate(new Date()); alienDao.save(deployment); } callback.onSuccess(data); } @Override public void onFailure(Throwable throwable) { callback.onFailure(throwable); } }; orchestratorPlugin.getStatus(deploymentContext, esCallback); }
/** * Get the detailed status for each instance of each node template. * * @param deployment The deployment for witch to get the instance informations. * @param callback callback on witch to send the map of node template's id to map of instance's id * to instance information. * @throws alien4cloud.paas.exception.OrchestratorDisabledException In case the cloud selected for * the topology is disabled. */ public void getInstancesInformation( final Deployment deployment, IPaaSCallback<Map<String, Map<String, InstanceInformation>>> callback) throws OrchestratorDisabledException { Map<String, Map<String, InstanceInformation>> instancesInformation = Maps.newHashMap(); if (deployment == null) { callback.onSuccess(instancesInformation); return; } DeploymentTopology runtimeTopology = alienMonitorDao.findById(DeploymentTopology.class, deployment.getId()); PaaSTopologyDeploymentContext deploymentContext = deploymentContextService.buildTopologyDeploymentContext( deployment, deploymentTopologyService.getLocations(runtimeTopology), runtimeTopology); IOrchestratorPlugin orchestratorPlugin = orchestratorPluginService.getOrFail(deployment.getOrchestratorId()); orchestratorPlugin.getInstancesInformation(deploymentContext, callback); }