Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
status, result = commands.getstatusoutput(
"teamnl team2 setoption mode activebackup")
if status == 0:
self.nfail += 1
raise error.TestError(
'\n teamnl succeeded to setoption. No ports can be present during mode change')
else:
logging.info(
'\n teamnl succeeded to identify no ports can be present during mode change.')
# Remove ports and try
utils.system("teamdctl team2 port remove veth0")
utils.system("teamdctl team2 port remove veth1")
# Testing monitor
p = aexpect.Spawn('teamnl team2 monitor all')
os.system("teamnl team2 setoption mode activebackup")
teamnl_getopt = utils.system_output("teamnl team2 getoption mode")
if "activebackup" not in teamnl_getopt:
self.nfail += 1
raise error.TestError('\n teamnl setoption failed')
output_aexpect = p.get_output()
p.close()
if "mode activebackup changed" not in output_aexpect:
self.nfail += 1
raise error.TestError(
'\n teamnl monitor failed to detect mode change')
test.update(self_dict)
test_iterations = int(test.get("iterations", 1))
status = run_test_func("kvm", params=test,
tag=test.get("shortname"),
iterations=test_iterations)
w.write("done %s %s\n" % (test_index, status))
w.write("ready\n")
# The scheduler wants this worker to free its used resources
elif cmd[0] == "cleanup":
env_filename = os.path.join(self.bindir, self_dict["env"])
env = utils_misc.Env(env_filename)
for obj in env.values():
if isinstance(obj, virt_vm.BaseVM):
obj.destroy()
elif isinstance(obj, aexpect.Spawn):
obj.close()
env.save()
w.write("cleanup_done\n")
w.write("ready\n")
# There's no more work for this worker
elif cmd[0] == "terminate":
break
test.update(self_dict)
test_iterations = int(test.get("iterations", 1))
status = run_test_func("kvm", params=test,
tag=test.get("shortname"),
iterations=test_iterations)
w.write("done %s %s\n" % (test_index, status))
w.write("ready\n")
# The scheduler wants this worker to free its used resources
elif cmd[0] == "cleanup":
env_filename = os.path.join(self.bindir, self_dict["env"])
env = utils_misc.Env(env_filename)
for obj in env.values():
if isinstance(obj, virt_vm.BaseVM):
obj.destroy()
elif isinstance(obj, aexpect.Spawn):
obj.close()
env.save()
w.write("cleanup_done\n")
w.write("ready\n")
# There's no more work for this worker
elif cmd[0] == "terminate":
break
test.update(self_dict)
test_iterations = int(test.get("iterations", 1))
status = run_test_func("kvm", params=test,
tag=test.get("shortname"),
iterations=test_iterations)
w.write("done %s %s\n" % (test_index, status))
w.write("ready\n")
# The scheduler wants this worker to free its used resources
elif cmd[0] == "cleanup":
env_filename = os.path.join(self.bindir, self_dict["env"])
env = utils_env.Env(env_filename)
for obj in list(env.values()):
if isinstance(obj, virt_vm.BaseVM):
obj.destroy()
elif isinstance(obj, aexpect.Spawn):
obj.close()
env.save()
w.write("cleanup_done\n")
w.write("ready\n")
# There's no more work for this worker
elif cmd[0] == "terminate":
break