Skip to content

Commit

Permalink
Update the logging namespace - openvswitch
Browse files Browse the repository at this point in the history
Issue: autotest#3048

Signed-off-by: Xu Han <[email protected]>
  • Loading branch information
luckyh authored and leidwang committed Aug 5, 2022
1 parent d552615 commit a859290
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
9 changes: 4 additions & 5 deletions openvswitch/tests/load_module.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import sys
import traceback
import logging
import six

from avocado.utils import process
Expand Down Expand Up @@ -44,8 +43,8 @@ def run(test, params, env):
if _e is None:
raise
else:
logging.error("Cleaning function raised exception too: \n%s",
"".join(traceback.format_exception(e[0],
e[1],
e[2])))
test.log.error("Cleaning function raised exception too: \n%s",
"".join(traceback.format_exception(e[0],
e[1],
e[2])))
six.reraise(_e[0], _e[1], _e[2])
16 changes: 9 additions & 7 deletions openvswitch/tests/ovs_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from virttest import data_dir
from virttest import error_context

LOG_JOB = logging.getLogger('avocado.test')


def allow_iperf_firewall(machine):
machine.cmd("iptables -I INPUT -p tcp --dport 5001 --j ACCEPT")
Expand Down Expand Up @@ -70,7 +72,7 @@ def setup(self, test, params, env):
self.br0_name,
self.ovs)

logging.debug(self.ovs.status())
LOG_JOB.debug(self.ovs.status())
self.host = ovs_utils.Machine(src=test.workdir)
self.mvms = [ovs_utils.Machine(vm) for vm in self.vms]
self.machines = [self.host] + self.mvms
Expand Down Expand Up @@ -174,16 +176,16 @@ def test(self, test, params, env):
# Test TCP bandwidth
error_context.context("Test iperf bandwidth tcp.")
speeds = self.test_bandwidth()
logging.info("TCP Bandwidth from vm->host: %s", speeds[0])
logging.info("TCP Bandwidth from host->vm: %s", speeds[1])
logging.info("TCP Bandwidth from vm->vm: %s", speeds[2])
test.log.info("TCP Bandwidth from vm->host: %s", speeds[0])
test.log.info("TCP Bandwidth from host->vm: %s", speeds[1])
test.log.info("TCP Bandwidth from vm->vm: %s", speeds[2])

# test udp bandwidth limited to 1Gb
error_context.context("Test iperf bandwidth udp.")
speeds = self.test_bandwidth("-u -b 1G")
logging.info("UDP Bandwidth from vm->host: %s", speeds[0])
logging.info("UDP Bandwidth from host->vm: %s", speeds[1])
logging.info("UDP Bandwidth from vm->vm: %s", speeds[2])
test.log.info("UDP Bandwidth from vm->host: %s", speeds[0])
test.log.info("UDP Bandwidth from host->vm: %s", speeds[1])
test.log.info("UDP Bandwidth from vm->vm: %s", speeds[2])

def clean(self, test, params, env):
self.host.cmd("killall -9 iperf")
Expand Down

0 comments on commit a859290

Please sign in to comment.