From 0ff306014e3c3a97b8578ead82c40c00d0338bdf Mon Sep 17 00:00:00 2001 From: Lorenzo Biava Date: Wed, 1 Jun 2016 14:48:46 +0200 Subject: [PATCH] Fix #49: Support Privileged mode for containers in Chronos jobs In an hard-coded fashion for now (in the future it will be possible to specify that from the TOSCA template). --- .../deployment/providers/ChronosServiceImpl.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/it/reply/orchestrator/service/deployment/providers/ChronosServiceImpl.java b/src/main/java/it/reply/orchestrator/service/deployment/providers/ChronosServiceImpl.java index 86f1c97add..85ceb8177e 100644 --- a/src/main/java/it/reply/orchestrator/service/deployment/providers/ChronosServiceImpl.java +++ b/src/main/java/it/reply/orchestrator/service/deployment/providers/ChronosServiceImpl.java @@ -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; @@ -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; } @@ -803,6 +804,14 @@ protected Job createJob(Map 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 = new ArrayList(); + parameters.add(param); + container.setParameters(parameters); + container .setImage((String) ((PropertyValue) nodeTemplate.getArtifacts().get("image").getFile()) .getValue()); @@ -847,4 +856,4 @@ public static JobState getLastState(Job job) { } } } -} +} \ No newline at end of file