Skip to content

Commit

Permalink
Fix #49: Support Privileged mode for containers in Chronos jobs
Browse files Browse the repository at this point in the history
In an hard-coded fashion for now (in the future it will be possible to
specify that from the TOSCA template).
  • Loading branch information
lorenzo-biava committed Jun 1, 2016
1 parent 339403e commit 0ff3060
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import it.infn.ba.indigo.chronos.client.model.v1.Container;
import it.infn.ba.indigo.chronos.client.model.v1.EnvironmentVariable;
import it.infn.ba.indigo.chronos.client.model.v1.Job;
import it.infn.ba.indigo.chronos.client.model.v1.Parameters;
import it.infn.ba.indigo.chronos.client.utils.ChronosException;
import it.reply.orchestrator.controller.DeploymentController;
import it.reply.orchestrator.dal.entity.Deployment;
Expand Down Expand Up @@ -297,7 +298,7 @@ public boolean isDeployed(Deployment deployment) throws DeploymentException {
updateOnError(deployment.getId(), dex);
throw dex;
} catch (RuntimeException ex) {
LOG.error("Failed to update deployment <{}>", ex);
LOG.error(String.format("Failed to update deployment <%s>", deployment.getId()), ex);
return false;
}

Expand Down Expand Up @@ -803,6 +804,14 @@ protected Job createJob(Map<String, NodeTemplate> nodes, String deploymentId, St
Container container = new Container();
container.setType("DOCKER");

// Run the container in Privileged Mode
Parameters param = new Parameters();
param.setKey("privileged");
param.setValue("true");
Collection<Parameters> parameters = new ArrayList<Parameters>();
parameters.add(param);
container.setParameters(parameters);

container
.setImage((String) ((PropertyValue<?>) nodeTemplate.getArtifacts().get("image").getFile())
.getValue());
Expand Down Expand Up @@ -847,4 +856,4 @@ public static JobState getLastState(Job job) {
}
}
}
}
}

0 comments on commit 0ff3060

Please sign in to comment.