From 8a9df3f1c408ceb55146bfbde5a10f5f5b6175eb Mon Sep 17 00:00:00 2001 From: stevenvanrossem Date: Fri, 27 Jan 2017 22:35:04 +0100 Subject: [PATCH] update to use latest docker api version --- src/emuvim/api/sonata/dummygatekeeper.py | 6 +++--- src/emuvim/dcemulator/node.py | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) 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} ) -- 2.25.1