X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2Fvim-emu.git;a=blobdiff_plain;f=src%2Femuvim%2Fdcemulator%2Fmonitoring.py;h=ce24a4000867508f92e0cce7c7b326b3c325218a;hp=269a7e0564c6a899d57e1eb1e6e5d145a622ee71;hb=c911ca6a6560d062fed5d294bc5a80c26da69672;hpb=139b0bee04cd9336bcd7acb6728d0cf6976d6f5d diff --git a/src/emuvim/dcemulator/monitoring.py b/src/emuvim/dcemulator/monitoring.py index 269a7e0..ce24a40 100755 --- a/src/emuvim/dcemulator/monitoring.py +++ b/src/emuvim/dcemulator/monitoring.py @@ -34,7 +34,7 @@ import time from prometheus_client import start_http_server, Summary, Histogram, Gauge, Counter, REGISTRY, CollectorRegistry, \ pushadd_to_gateway, push_to_gateway, delete_from_gateway import threading -from subprocess import Popen +from subprocess import Popen, check_call import os import docker import json @@ -535,8 +535,15 @@ class DCNetworkMonitor(): def _stop_container(self, name): - container = self.dockercli.containers.get(name) - container.remove(force=True) + #container = self.dockercli.containers.get(name) + #container.stop() + #container.remove(force=True) + + # the only robust way to stop these containers is via Popen, it seems + time.sleep(1) + cmd = ['docker', 'rm', '-f', name] + Popen(cmd) + def update_skewmon(self, vnf_name, resource_name, action):