update to use latest docker api version
authorstevenvanrossem <steven.vanrossem@intec.ugent.be>
Fri, 27 Jan 2017 21:35:04 +0000 (22:35 +0100)
committerstevenvanrossem <steven.vanrossem@intec.ugent.be>
Fri, 27 Jan 2017 21:35:04 +0000 (22:35 +0100)
src/emuvim/api/sonata/dummygatekeeper.py
src/emuvim/dcemulator/node.py

index 5936d94..f0a7ccd 100755 (executable)
@@ -39,7 +39,7 @@ import hashlib
 import zipfile
 import yaml
 import threading
-from docker import Client as DockerClient
+from docker import DockerClient
 from flask import Flask, request
 import flask_restful as fr
 from collections import defaultdict
@@ -514,7 +514,7 @@ class Service(object):
         dc = DockerClient()
         for url in self.remote_docker_image_urls.itervalues():
             if not FORCE_PULL:  # only pull if not present (speedup for development)
-                if len(dc.images(name=url)) > 0:
+                if len(dc.images.list(name=url)) > 0:
                     LOG.debug("Image %r present. Skipping pull." % url)
                     continue
             LOG.info("Pulling image: %r" % url)
@@ -527,7 +527,7 @@ class Service(object):
         :param image_name: name of the docker image
         :return:
         """
-        return len(DockerClient().images(image_name)) > 0
+        return len(DockerClient().images.list(name=image_name)) > 0
 
     def _calculate_placement(self, algorithm):
         """
index 8e7a63a..8a7be0a 100755 (executable)
@@ -90,6 +90,7 @@ class EmulatorCompute(Docker):
         status["memswap_limit"] = self.memswap_limit
         status["state"] = self.dcli.inspect_container(self.dc)["State"]
         status["id"] = self.dcli.inspect_container(self.dc)["Id"]
+        status["short_id"] = self.dcli.inspect_container(self.dc)["Id"][:12]
         status["datacenter"] = (None if self.datacenter is None
                                 else self.datacenter.label)
         return status
@@ -190,7 +191,8 @@ class Datacenter(object):
             datacenter=self,
             flavor_name=flavor_name,
             cpu_period = cpu_period,
-            cpu_quota = cpu_quota
+            cpu_quota = cpu_quota,
+            environment = {'VNF_NAME':name}
         )