[PATCH-next] lnst.Recipes.ENRT.VirtualBridgeVlansOverBondRecipe: mistakes in names
by csfakian@redhat.com
From: Christos Sfakianakis <csfakian(a)redhat.com>
'eth2' or 'eth3' devices are not defined. Replace 'eth{2,3}' with 'tap{0,1}'
accordingly.
Signed-off-by: Christos Sfakianakis <csfakian(a)redhat.com>
---
.../Recipes/ENRT/VirtualBridgeVlansOverBondRecipe.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/lnst/Recipes/ENRT/VirtualBridgeVlansOverBondRecipe.py b/lnst/Recipes/ENRT/VirtualBridgeVlansOverBondRecipe.py
index 5917b88..162e3c1 100644
--- a/lnst/Recipes/ENRT/VirtualBridgeVlansOverBondRecipe.py
+++ b/lnst/Recipes/ENRT/VirtualBridgeVlansOverBondRecipe.py
@@ -50,8 +50,8 @@ class VirtualBridgeVlansOverBondRecipe(BaseEnrtRecipe):
for m, n in [(host1, 10),(host2, 10)]:
m.eth0.down()
m.eth1.down()
- m.eth2.down()
- m.eth3.down()
+ m.tap0.down()
+ m.tap1.down()
m.bond = BondDevice(mode=self.params.bonding_mode, miimon=self.params.miimon_value)
m.bond.slave_add(m.eth0)
m.bond.slave_add(m.eth1)
@@ -59,10 +59,10 @@ class VirtualBridgeVlansOverBondRecipe(BaseEnrtRecipe):
m.vlan2 = VlanDevice(realdev=m.bond, vlan_id=2*n)
m.br0 = BridgeDevice()
m.br0.slave_add(m.vlan1)
- m.br0.slave_add(m.eth2)
+ m.br0.slave_add(m.tap0)
m.br1 = BridgeDevice()
m.br1.slave_add(m.vlan2)
- m.br1.slave_add(m.eth3)
+ m.br1.slave_add(m.tap1)
for m in (guest1, guest2, guest3, guest4):
m.eth0.down()
@@ -100,8 +100,8 @@ class VirtualBridgeVlansOverBondRecipe(BaseEnrtRecipe):
for m, g1, g2 in [(host1, guest1, guest2), (host2, guest3, guest4)]:
m.eth0.up()
m.eth1.up()
- m.eth2.up()
- m.eth3.up()
+ m.tap0.up()
+ m.tap1.up()
m.bond.up()
m.vlan1.up()
m.vlan2.up()
--
2.17.1
4 years, 8 months
[PATCH-master-py3] Python2 to Python3 conversion fixes
by jurbanov@redhat.com
From: Jozef Urbanovsky <jurbanov(a)redhat.com>
lnst/Common/Daemon.py
===================================
Issue#191 - daemonize doesn't work with py3
- Replaces file method with open method instead
lnst/Controller/SlavePool.py
===================================
Unable to match specific test cases
- Deleted iter from sorted list, as iterator object not needed
lnst/Controller/Task.py
===================================
Hash creation was unsuccessful due to type mismatch
- hashlib.sha1 is expecting str, instead of unicode object
- Changed encoding to utf-8 str
lnst/Slave/NetTestSlave.py
===================================
Top-level exception was thrown instead of specific one, could catch
exception, that wasn't meant for Slave process
- Created specific SystemCallException
- Throwing and expecting SystemCallException instead of general one
recipes/regression_tests/phase3/ipsec_esp_aead.py
===================================
Type mismatch
- py3 divison is float by default, added explicit conversion to int
test_modules/Netperf.py
===================================
Unable to interrupt netperf server instance
- Created new InterruptException
- Created new method wait_for_interrupt to catch sigint, instead
of waiting for exception, that's no longer thrown with PEP 475
- py3 divison is float by default, added explicit conversion to int
Signed-off-by: Jozef Urbanovsky <jurbanov(a)redhat.com>
---
lnst/Common/Daemon.py | 10 +++---
lnst/Controller/SlavePool.py | 4 +--
lnst/Controller/Task.py | 8 ++---
lnst/Slave/NetTestSlave.py | 9 +++--
.../regression_tests/phase3/ipsec_esp_aead.py | 2 +-
test_modules/Netperf.py | 33 ++++++++++++++-----
6 files changed, 43 insertions(+), 23 deletions(-)
diff --git a/lnst/Common/Daemon.py b/lnst/Common/Daemon.py
index 6fbf950..23bb77e 100644
--- a/lnst/Common/Daemon.py
+++ b/lnst/Common/Daemon.py
@@ -25,7 +25,7 @@ class Daemon:
def _read_pid(self):
try:
- handle = file(self._pidfile, "r")
+ handle = open(self._pidfile, "r")
pid = int(handle.read().strip())
handle.close()
except IOError:
@@ -33,7 +33,7 @@ class Daemon:
return pid
def _write_pid(self, pid):
- handle = file(self._pidfile, "w")
+ handle = open(self._pidfile, "w")
handle.write("%s\n" % str(pid))
handle.close()
self._pid_written = True
@@ -86,9 +86,9 @@ class Daemon:
sys.stdout.flush()
sys.stderr.flush()
- si = file("/dev/null", 'r')
- so = file("/dev/null", 'a+')
- se = file("/dev/null", 'a+', 0)
+ si = open("/dev/null", 'r')
+ so = open("/dev/null", 'a+')
+ se = open("/dev/null", 'a+', 0)
os.dup2(si.fileno(), sys.stdin.fileno())
os.dup2(so.fileno(), sys.stdout.fileno())
os.dup2(se.fileno(), sys.stderr.fileno())
diff --git a/lnst/Controller/SlavePool.py b/lnst/Controller/SlavePool.py
index 8166816..b271158 100644
--- a/lnst/Controller/SlavePool.py
+++ b/lnst/Controller/SlavePool.py
@@ -451,7 +451,7 @@ class SetupMapper(object):
self._pool = self._pools[self._pool_name]
self._unmatched_pool_machines = []
- for p_id, p_machine in sorted(iter(self._pool.items()), reverse=True):
+ for p_id, p_machine in sorted(self._pool.items(), reverse=True):
if self._virtual_matching:
if "libvirt_domain" in p_machine["params"]:
self._unmatched_pool_machines.append(p_id)
@@ -516,7 +516,7 @@ class SetupMapper(object):
self._pool_name)
self._unmatched_pool_machines = []
- for p_id, p_machine in sorted(iter(self._pool.items()), reverse=True):
+ for p_id, p_machine in sorted(self._pool.items(), reverse=True):
if self._virtual_matching:
if "libvirt_domain" in p_machine["params"]:
self._unmatched_pool_machines.append(p_id)
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py
index e2b98d0..42a50ab 100644
--- a/lnst/Controller/Task.py
+++ b/lnst/Controller/Task.py
@@ -1259,9 +1259,9 @@ class PerfRepoResult(object):
params = self._testExecution.get_parameters()
sha1 = hashlib.sha1()
- sha1.update(self._testExecution.get_testUid())
+ sha1.update((self._testExecution.get_testUid()).encode("utf-8"))
for i in sorted(tags):
- sha1.update(i)
+ sha1.update(i.encode("utf-8"))
for i in sorted(params, key=lambda x: x[0]):
skip = False
for j in ignore:
@@ -1270,8 +1270,8 @@ class PerfRepoResult(object):
break
if skip:
continue
- sha1.update(i[0])
- sha1.update(str(i[1]))
+ sha1.update(i[0].encode("utf-8"))
+ sha1.update(str(i[1]).encode("utf-8"))
return sha1.hexdigest()
class PerfRepoBaseline(object):
diff --git a/lnst/Slave/NetTestSlave.py b/lnst/Slave/NetTestSlave.py
index 7c61d23..a861d2c 100644
--- a/lnst/Slave/NetTestSlave.py
+++ b/lnst/Slave/NetTestSlave.py
@@ -43,6 +43,11 @@ from lnst.Slave.InterfaceManager import InterfaceManager
from lnst.Slave.BridgeTool import BridgeTool
from lnst.Slave.SlaveSecSocket import SlaveSecSocket, SecSocketException
+class SystemCallException(Exception):
+ """Exception used to handle SIGINT waiting for system calls"""
+ pass
+
+
class SlaveMethods:
'''
Exported xmlrpc methods
@@ -1407,7 +1412,7 @@ class NetTestSlave:
for msg in msgs:
self._process_msg(msg[1])
- except:
+ except SystemCallException:
break
self._methods.machine_cleanup()
@@ -1509,7 +1514,7 @@ class NetTestSlave:
def _signal_die_handler(self, signum, frame):
logging.info("Caught signal %d -> dying" % signum)
- raise Exception("Recieved interrupt to system call")
+ raise SystemCallException()
def _parent_resend_signal_handler(self, signum, frame):
logging.info("Caught signal %d -> resending to parent" % signum)
diff --git a/recipes/regression_tests/phase3/ipsec_esp_aead.py b/recipes/regression_tests/phase3/ipsec_esp_aead.py
index 3c5028e..752448c 100644
--- a/recipes/regression_tests/phase3/ipsec_esp_aead.py
+++ b/recipes/regression_tests/phase3/ipsec_esp_aead.py
@@ -14,7 +14,7 @@ from lnst.RecipeCommon.PerfRepo import generate_perfrepo_comment
#lenth param is in bits
def generate_key(length):
key = "0x"
- key = key + (length/8) * "0b"
+ key = key + (int(length/8)) * "0b"
return key
algorithm = []
diff --git a/test_modules/Netperf.py b/test_modules/Netperf.py
index 7e9fbd0..8732bea 100644
--- a/test_modules/Netperf.py
+++ b/test_modules/Netperf.py
@@ -7,12 +7,17 @@ jprochaz(a)redhat.com (Jiri Prochazka)
"""
import logging
-import errno
import re
+import signal
from lnst.Common.TestsCommon import TestGeneric
from lnst.Common.ShellProcess import ShellProcess
from lnst.Common.Utils import std_deviation, is_installed, int_it
+class InterruptException(Exception):
+ """Exception used to handle SIGINT waiting"""
+ pass
+
+
class Netperf(TestGeneric):
supported_tests = ["TCP_STREAM", "TCP_RR", "UDP_STREAM", "UDP_RR",
@@ -384,10 +389,21 @@ class Netperf(TestGeneric):
logging.debug("running as server...")
server = ShellProcess(cmd)
try:
- server.wait()
- except OSError as e:
- if e.errno == errno.EINTR:
- server.kill()
+ self.wait_for_interrupt()
+ except InterruptException:
+ server.kill()
+
+ def wait_for_interrupt(self):
+ def handler(signum, frame):
+ raise InterruptException()
+
+ try:
+ old_handler = signal.signal(signal.SIGINT, handler)
+ signal.pause()
+ except InterruptException:
+ pass
+ finally:
+ signal.signal(signal.SIGINT, old_handler)
def _pretty_rate(self, rate, unit=None):
pretty_rate = {}
@@ -468,9 +484,8 @@ class Netperf(TestGeneric):
try:
ret_code = client.wait()
rv += ret_code
- except OSError as e:
- if e.errno == errno.EINTR:
- client.kill()
+ except InterruptException:
+ client.kill()
output = client.read_nonblocking()
logging.debug(output)
@@ -502,7 +517,7 @@ class Netperf(TestGeneric):
rate_deviation = 2*res_data["std_deviation"]
elif len(rates) == 1 and self._confidence is not None:
result = results[0]
- rate_deviation = rate * (result["confidence"][1] / 100)
+ rate_deviation = rate * (int(result["confidence"][1]) / 100)
else:
rate_deviation = 0.0
--
2.19.1
4 years, 8 months
代开真发票13883169292
by ctmtc@ctmtc.com.cn
我公司有本地各行业正规发票,点数优惠,可验证后付款
有需要联系:13883169292 郝立恒(加微信同号)
4 years, 9 months
专题五:劳动关系解除与终止
by 闵爵
金钱损失了还能挽回,一旦失去信誉就很难挽回。9爱上你不需要理由,但如果真的需要,一万个理由也不够!
4 years, 9 months
[PATCH] recipes: regression_tests: phase3: fix machine names in
2_virt_ovs_vxlan.py
by Jan Tluka
Fixes: bacd8310("regression_tests: add ovs rpm version to TestExec comment")
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
recipes/regression_tests/phase3/2_virt_ovs_vxlan.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/recipes/regression_tests/phase3/2_virt_ovs_vxlan.py b/recipes/regression_tests/phase3/2_virt_ovs_vxlan.py
index 1d81f65..c033a54 100644
--- a/recipes/regression_tests/phase3/2_virt_ovs_vxlan.py
+++ b/recipes/regression_tests/phase3/2_virt_ovs_vxlan.py
@@ -50,8 +50,8 @@ pr_user_comment = ctl.get_alias("perfrepo_comment")
nperf_protocols = ctl.get_alias("nperf_protocols")
official_result = bool_it(ctl.get_alias("official_result"))
-h1_ovs_rpm_version = h1.run("rpm -qf `which ovs-vswitchd` || true").get_result()["res_data"]["stdout"]
-h2_ovs_rpm_version = h2.run("rpm -qf `which ovs-vswitchd` || true").get_result()["res_data"]["stdout"]
+h1_ovs_rpm_version = host1.run("rpm -qf `which ovs-vswitchd` || true").get_result()["res_data"]["stdout"]
+h2_ovs_rpm_version = host2.run("rpm -qf `which ovs-vswitchd` || true").get_result()["res_data"]["stdout"]
pr_comment = generate_perfrepo_comment([guest1, guest2, guest3, guest4],
pr_user_comment)
--
2.14.5
4 years, 9 months
如需:进项、报销(发--票)找我电+微137^6448^8837张
by iaoihfugz
DsuoFwmXpC
4 years, 9 months
[PATCH] recipes: short_lived_connections: move configuration of
multi netperf before loop
by Jan Tluka
This patch avoids repeated configuration of netperf in multi mode when
iterating over nperf_sizes. It's sufficient to configure it before the loop.
Additionally it fixes potential bug when only TCP_CRR is selected for multi
mode. In that case the netperf won't be properly configured because the
configuration remains in TCP_RR branch.
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
.../phase3/short_lived_connections.py | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/recipes/regression_tests/phase3/short_lived_connections.py b/recipes/regression_tests/phase3/short_lived_connections.py
index 9a701f4..8457e13 100644
--- a/recipes/regression_tests/phase3/short_lived_connections.py
+++ b/recipes/regression_tests/phase3/short_lived_connections.py
@@ -112,6 +112,17 @@ netperf_srv = ctl.get_module("Netperf",
"bind" : m1_testiface.get_ip(0)
})
+if nperf_mode == "multi":
+ netperf_cli_tcp_rr.unset_option("confidence")
+ netperf_cli_tcp_crr.unset_option("confidence")
+
+ netperf_cli_tcp_rr.update_options({"num_parallel": nperf_num_parallel})
+ netperf_cli_tcp_crr.update_options({"num_parallel": nperf_num_parallel})
+
+ # we have to use multiqueue qdisc to get appropriate data
+ m1.run("tc qdisc replace dev %s root mq" % m1_testiface.get_devname())
+ m2.run("tc qdisc replace dev %s root mq" % m2_testiface.get_devname())
+
ctl.wait(15)
# start netperf server
@@ -122,17 +133,6 @@ for size in nperf_sizes.split():
if 'TCP_RR' in nperf_tests.split():
netperf_cli_tcp_rr.update_options({"testoptions": "-r %s" % size})
- if nperf_mode == "multi":
- netperf_cli_tcp_rr.unset_option("confidence")
- netperf_cli_tcp_crr.unset_option("confidence")
-
- netperf_cli_tcp_rr.update_options({"num_parallel": nperf_num_parallel})
- netperf_cli_tcp_crr.update_options({"num_parallel": nperf_num_parallel})
-
- # we have to use multiqueue qdisc to get appropriate data
- m1.run("tc qdisc replace dev %s root mq" % m1_testiface.get_devname())
- m2.run("tc qdisc replace dev %s root mq" % m2_testiface.get_devname())
-
# prepare PerfRepo result for tcp_rr
result_tcp_rr = perf_api.new_result("tcp_rr_id",
"tcp_rr_result",
--
2.14.5
4 years, 9 months
[PATCH] recipes: short_lived_connections: fix configuration of size
parameter for TCP_CRR
by Jan Tluka
Signed-off-by: Jan Tluka <jtluka(a)redhat.com>
---
recipes/regression_tests/phase3/short_lived_connections.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/recipes/regression_tests/phase3/short_lived_connections.py b/recipes/regression_tests/phase3/short_lived_connections.py
index ecb7194..9a701f4 100644
--- a/recipes/regression_tests/phase3/short_lived_connections.py
+++ b/recipes/regression_tests/phase3/short_lived_connections.py
@@ -121,7 +121,6 @@ ctl.wait(2)
for size in nperf_sizes.split():
if 'TCP_RR' in nperf_tests.split():
netperf_cli_tcp_rr.update_options({"testoptions": "-r %s" % size})
- netperf_cli_tcp_crr.update_options({"testoptions": "-r %s" % size})
if nperf_mode == "multi":
netperf_cli_tcp_rr.unset_option("confidence")
@@ -158,6 +157,8 @@ for size in nperf_sizes.split():
perf_api.save_result(result_tcp_rr, official_result)
if 'TCP_CRR' in nperf_tests.split():
+ netperf_cli_tcp_crr.update_options({"testoptions": "-r %s" % size})
+
# prepare PerfRepo result for tcp_crr
result_tcp_crr = perf_api.new_result("tcp_crr_id",
"tcp_crr_result",
--
2.14.5
4 years, 9 months