X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=yardstick%2Fnetwork_services%2Fnfvi%2Fresource.py;h=dc5c46a86984a910ac4af026c440fcd58256bf08;hb=14a0f0b13e37cf0a65603915b7c75b86fd4a4383;hp=5b96aaf297e3df9c6e63cc9c95caafb2f57749d2;hpb=b346b40f67feb1a38226be12f0d57a6bf6f8a2fe;p=yardstick.git diff --git a/yardstick/network_services/nfvi/resource.py b/yardstick/network_services/nfvi/resource.py index 5b96aaf29..dc5c46a86 100644 --- a/yardstick/network_services/nfvi/resource.py +++ b/yardstick/network_services/nfvi/resource.py @@ -13,20 +13,16 @@ # limitations under the License. """ Resource collection definitions """ -from __future__ import absolute_import -from __future__ import print_function - -import logging -from itertools import chain - import errno -import jinja2 +from itertools import chain +import logging +import multiprocessing import os import os.path import re -import multiprocessing -import pkg_resources +import jinja2 +import pkg_resources from oslo_config import cfg from oslo_utils.encodeutils import safe_decode @@ -55,8 +51,7 @@ class ResourceProfile(object): DEFAULT_TIMEOUT = 3600 OVS_SOCKET_PATH = "/usr/local/var/run/openvswitch/db.sock" - def __init__(self, mgmt, port_names=None, cores=None, plugins=None, - interval=None, timeout=None): + def __init__(self, mgmt, port_names=None, plugins=None, interval=None, timeout=None): if plugins is None: self.plugins = {} @@ -91,10 +86,9 @@ class ResourceProfile(object): plugins = collectd_options.get("plugins", {}) interval = collectd_options.get("interval") - # use default cores = None to MatchAllCores return cls(node, plugins=plugins, interval=interval, timeout=timeout) - def check_if_sa_running(self, process): + def check_if_system_agent_running(self, process): """ verify if system agent is running """ try: err, pid, _ = self.connection.execute("pgrep -f %s" % process) @@ -103,7 +97,7 @@ class ResourceProfile(object): except OSError as e: if e.errno in {errno.ECONNRESET}: # if we can't connect to check, then we won't be able to connect to stop it - LOG.exception("can't connect to host to check collectd status") + LOG.exception("Can't connect to host to check %s status", process) return 1, None raise @@ -245,19 +239,6 @@ class ResourceProfile(object): } self._provide_config_file(config_file_path, self.COLLECTD_CONF, kwargs) - def _setup_intel_pmu(self, connection, bin_path): - pmu_event_path = os.path.join(bin_path, "pmu_event.json") - try: - self.plugins["intel_pmu"]["pmu_event_path"] = pmu_event_path - except KeyError: - # if intel_pmu is not a dict, force it into a dict - self.plugins["intel_pmu"] = {"pmu_event_path": pmu_event_path} - LOG.debug("Downloading event list for pmu_stats plugin") - cmd = 'cd {0}; PMU_EVENTS_PATH={1} python event_download_local.py'.format( - bin_path, pmu_event_path) - cmd = "sudo bash -c '{}'".format(cmd) - connection.execute(cmd) - def _setup_ovs_stats(self, connection): try: socket_path = self.plugins["ovs_stats"].get("ovs_socket_path", self.OVS_SOCKET_PATH) @@ -284,8 +265,6 @@ class ResourceProfile(object): # connection.execute("sudo %s '%s' '%s'" % ( # collectd_installer, http_proxy, https_proxy)) return - if "intel_pmu" in self.plugins: - self._setup_intel_pmu(connection, bin_path) if "ovs_stats" in self.plugins: self._setup_ovs_stats(connection) @@ -344,7 +323,7 @@ class ResourceProfile(object): self.amqp_client.terminate() LOG.debug("Check if %s is running", agent) - status, pid = self.check_if_sa_running(agent) + status, pid = self.check_if_system_agent_running(agent) LOG.debug("status %s pid %s", status, pid) if status != 0: return