From d1626e553c62a53c3f042515dfcb8f3f9a382524 Mon Sep 17 00:00:00 2001 From: edmaas Date: Sun, 2 Apr 2017 16:21:57 +0200 Subject: [PATCH] finished implementing passing a folder as volume to docker files for log collection --- src/emuvim/api/sonata/dummygatekeeper.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/emuvim/api/sonata/dummygatekeeper.py b/src/emuvim/api/sonata/dummygatekeeper.py index 770bae6..93d5cda 100755 --- a/src/emuvim/api/sonata/dummygatekeeper.py +++ b/src/emuvim/api/sonata/dummygatekeeper.py @@ -45,7 +45,6 @@ import flask_restful as fr from collections import defaultdict import pkg_resources from subprocess import Popen -import tempfile logging.basicConfig() LOG = logging.getLogger("sonata-dummy-gatekeeper") @@ -349,15 +348,11 @@ class Service(object): # 4. generate the volume paths for the docker container volumes=list() # a volume to extract log files - #tempfile.mkdtemp(dir="/tmp/results/%s/%s"%(self.uuid,vnf_name)) docker_log_path = "/tmp/results/%s/%s"%(self.uuid,vnf_name) LOG.debug("LOG path for vnf %s is %s."%(vnf_name,docker_log_path)) - #docker_log_path = tempfile.mkdtemp(dir=docker_log_path) if not os.path.exists(docker_log_path): + LOG.debug("Creating folder %s"%docker_log_path) os.makedirs(docker_log_path) - with open(docker_log_path+"/testfile", "w") as tf: - tf.write("placeholder") - tf.close() volumes.append(docker_log_path+":/mnt/share/") @@ -399,6 +394,7 @@ class Service(object): # Find the correct datacenter status = vnfi.getStatus() dc = vnfi.datacenter + # stop the vnfi LOG.info("Stopping the vnf instance contained in %r in DC %r" % (status["name"], dc)) dc.stopCompute(status["name"]) @@ -726,7 +722,7 @@ class Instantiations(fr.Resource): Will return a new UUID to identify the running service instance. :return: UUID """ - LOG.info("POST /instantiations (or /reqeusts) called") + LOG.info("POST /instantiations (or /requests) called") # try to extract the service uuid from the request json_data = request.get_json(force=True) service_uuid = json_data.get("service_uuid") -- 2.25.1