From: stevenvanrossem Date: Fri, 27 Jan 2017 21:35:04 +0000 (+0100) Subject: update to use latest docker api version X-Git-Tag: v3.1~45^2~26 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=8a9df3f1c408ceb55146bfbde5a10f5f5b6175eb;p=osm%2Fvim-emu.git update to use latest docker api version --- diff --git a/src/emuvim/api/sonata/dummygatekeeper.py b/src/emuvim/api/sonata/dummygatekeeper.py index 5936d94..f0a7ccd 100755 --- a/src/emuvim/api/sonata/dummygatekeeper.py +++ b/src/emuvim/api/sonata/dummygatekeeper.py @@ -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): """ diff --git a/src/emuvim/dcemulator/node.py b/src/emuvim/dcemulator/node.py index 8e7a63a..8a7be0a 100755 --- a/src/emuvim/dcemulator/node.py +++ b/src/emuvim/dcemulator/node.py @@ -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} )