[lnst] be quiet on mode removal
by Jiří Pírko
commit 30a94a9e1c2fad085b1f36d6b1a9de846e8b9fd1
Author: Jiri Pirko <jiri(a)resnulli.us>
Date: Tue Aug 21 16:08:24 2012 +0200
be quiet on mode removal
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
NetConfig/NetConfigDevice.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/NetConfig/NetConfigDevice.py b/NetConfig/NetConfigDevice.py
index e26629b..24799b5 100644
--- a/NetConfig/NetConfigDevice.py
+++ b/NetConfig/NetConfigDevice.py
@@ -69,7 +69,7 @@ class NetConfigDeviceGeneric:
exec_cmd(self._cleanupcmd, die_on_err=False)
if self._modulename:
kmod_in_use(self._modulename, 300)
- exec_cmd("modprobe -r %s" % self._modulename, die_on_err=False)
+ exec_cmd("modprobe -q -r %s" % self._modulename, die_on_err=False)
class NetConfigDeviceEth(NetConfigDeviceGeneric):
def configure(self):
11 years, 3 months
[lnst] #3: NetTestCommandSystemConfig: multiple values for one option
by fedora-badges
#3: NetTestCommandSystemConfig: multiple values for one option
------------------------+-------------------------
Reporter: olichtne | Owner: olichtne@…
Type: task | Status: new
Priority: major | Milestone:
Component: component1 | Version:
Keywords: | Blocked By:
Blocking: |
------------------------+-------------------------
System config options can have multiple values. This happens when the same
option is specified multiple times in the recipe.
Currently running the system config command uses only the first value that
was specified.
Is this behavior expected?
Shouldn't this be the other way around- use the last value, as in
everytime you specify a value for the same option you overwrite the
previous one?
Or use all of them if there are any options that require multiple values?
--
Ticket URL: <https://fedorahosted.org/lnst/ticket/3>
lnst <http://example.org/>
My example project
11 years, 3 months
[lnst] put all team ports down first
by Jiří Pírko
commit eae3529132f8980a70374b21782238e4d6315639
Author: Jiri Pirko <jiri(a)resnulli.us>
Date: Tue Aug 21 14:08:25 2012 +0200
put all team ports down first
This ensures that even if user specifies ports directly in config, they
will get enslaved.
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
NetConfig/NetConfigDevice.py | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/NetConfig/NetConfigDevice.py b/NetConfig/NetConfigDevice.py
index 688077b..e26629b 100644
--- a/NetConfig/NetConfigDevice.py
+++ b/NetConfig/NetConfigDevice.py
@@ -229,7 +229,14 @@ class NetConfigDeviceTeam(NetConfigDeviceGeneric):
return True
return False
+ def _ports_down(self):
+ for slave_id in get_slaves(self._netdev):
+ port_netdev = self._config[slave_id]
+ NetConfigDevice(port_netdev, self._config).down()
+
def configure(self):
+ self._ports_down()
+
teamd_config = get_option(self._netdev, "teamd_config")
teamd_config = prepare_json_str(teamd_config)
11 years, 3 months
[lnst] system_config: Multiple values for single option support
by Jiří Pírko
commit a9eb732077a0a2cfa0392e85387f2604e4781ced
Author: Radek Pazdera <rpazdera(a)redhat.com>
Date: Thu Aug 16 14:13:30 2012 +0200
system_config: Multiple values for single option support
This commit fixes bug (trac #3) in system config code, namely the
NetTestCommandSystemConfig class.
In cases when value was assigned to a same option multiple times
within a single system_config command, only the first value was
used. The remaining ones were discarded.
Now the option is set one by one to all the values as they are
specified in the command.
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
NetTest/NetTestCommand.py | 11 +++++++----
NetTest/NetTestParse.py | 5 ++++-
2 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/NetTest/NetTestCommand.py b/NetTest/NetTestCommand.py
index 8c0ef82..ae1297f 100644
--- a/NetTest/NetTestCommand.py
+++ b/NetTest/NetTestCommand.py
@@ -147,8 +147,10 @@ class NetTestCommandSystemConfig(NetTestCommandGeneric):
val = [{"value": self._command["value"]}]
self._command["options"] = {opt: val}
- for option, values in self._command["options"].iteritems():
- new_val = values[0]["value"]
+ for option, opt_data in self._command["options"].iteritems():
+ new_values = []
+ for record in opt_data:
+ new_values.append(record["value"])
option_abspath = os.path.abspath(option)
if option_abspath[0:5] != "/sys/" and \
@@ -159,12 +161,13 @@ class NetTestCommandSystemConfig(NetTestCommandGeneric):
try:
prev_val = self._retrive_option(option)
- self._set_option(option, new_val)
+ for new_val in new_values:
+ self._set_option(option, new_val)
except ExecCmdFail:
self.set_fail("Unable to set %s config option!" % option)
return
- res_data[option] = {"current_val": new_val,
+ res_data[option] = {"current_val": new_values[-1],
"previous_val": prev_val}
res = {"passed": True}
diff --git a/NetTest/NetTestParse.py b/NetTest/NetTestParse.py
index 13141e9..7af2084 100644
--- a/NetTest/NetTestParse.py
+++ b/NetTest/NetTestParse.py
@@ -407,7 +407,10 @@ class CommandParse(RecipeParser):
command["machine_id"] = machine_id
command["type"] = self._get_attribute(node, "type")
- command["value"] = self._get_attribute(node, "value")
+
+ command["value"] = None
+ if self._has_attribute(node, "value"):
+ command["value"] = self._get_attribute(node, "value")
if self._has_attribute(node, "timeout"):
command["timeout"] = self._get_attribute(node, "timeout", int)
11 years, 3 months
[lnst] add support for per-port teamd configs
by Jiří Pírko
commit bc3d532c4e3bf4a5f3053a4f34d5b1075e9a0354
Author: Jiri Pirko <jiri(a)resnulli.us>
Date: Fri Aug 17 17:01:51 2012 +0200
add support for per-port teamd configs
https://fedorahosted.org/lnst/ticket/8
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
NetConfig/NetConfigCommon.py | 5 +++-
NetConfig/NetConfigDevice.py | 23 ++++++++++++++++++-
NetTest/NetTestParse.py | 2 +-
recipes/team/netconfig-test1_002.xml | 38 ++++++++++++++++++++++++++++++++++
recipes/team/netconfig-test2_002.xml | 38 ++++++++++++++++++++++++++++++++++
recipes/team/recipe_002.xml | 13 +++++++++++
6 files changed, 115 insertions(+), 4 deletions(-)
---
diff --git a/NetConfig/NetConfigCommon.py b/NetConfig/NetConfigCommon.py
index f35d358..f3f2f5d 100644
--- a/NetConfig/NetConfigCommon.py
+++ b/NetConfig/NetConfigCommon.py
@@ -17,7 +17,10 @@ def get_slaves(netdev):
return set()
def get_option(netdev, opt_name):
- options = netdev["options"]
+ try:
+ options = netdev["options"]
+ except KeyError:
+ return None
for option, value in options:
if option == opt_name:
return value
diff --git a/NetConfig/NetConfigDevice.py b/NetConfig/NetConfigDevice.py
index 534e914..688077b 100644
--- a/NetConfig/NetConfigDevice.py
+++ b/NetConfig/NetConfigDevice.py
@@ -209,20 +209,35 @@ class NetConfigDeviceVlan(NetConfigDeviceGeneric):
else:
exec_cmd("vconfig rem %s" % dev_name)
+def prepare_json_str(json_str):
+ if not json_str:
+ return ""
+ json_str = json_str.replace('"', '\\"')
+ json_str = re.sub('\s+', ' ', json_str)
+ return json_str
+
class NetConfigDeviceTeam(NetConfigDeviceGeneric):
_pidfile = None
_modulename = "team_mode_roundrobin team_mode_activebackup team_mode_broadcast team_mode_loadbalance team"
_moduleload = False
_cleanupcmd = "killall -q teamd"
+ def _should_enable_dbus(self):
+ for slave_id in get_slaves(self._netdev):
+ port_netdev = self._config[slave_id]
+ if get_option(port_netdev, "teamd_port_config"):
+ return True
+ return False
+
def configure(self):
teamd_config = get_option(self._netdev, "teamd_config")
- teamd_config = teamd_config.replace('"', '\\"')
+ teamd_config = prepare_json_str(teamd_config)
dev_name = self._netdev["name"]
pidfile = "/var/run/teamd_%s.pid" % dev_name
- exec_cmd("teamd -r -d -c \"%s\" -t %s -p %s" % (teamd_config, dev_name, pidfile))
+ dbus_option = " -D" if self._should_enable_dbus() else ""
+ exec_cmd("teamd -r -d -c \"%s\" -t %s -p %s%s" % (teamd_config, dev_name, pidfile, dbus_option))
self._pidfile = pidfile
@@ -242,6 +257,10 @@ class NetConfigDeviceTeam(NetConfigDeviceGeneric):
dev_name = self._netdev["name"]
port_netdev = self._config[slaveid]
port_name = port_netdev["name"]
+ teamd_port_config = get_option(port_netdev, "teamd_port_config")
+ if teamd_port_config:
+ teamd_port_config = prepare_json_str(teamd_port_config)
+ exec_cmd("teamdctl %s PortConfigUpdate %s \"%s\"" % (dev_name, port_name, teamd_port_config))
NetConfigDevice(port_netdev, self._config).down()
exec_cmd("ip link set dev %s master %s" % (port_name, dev_name))
diff --git a/NetTest/NetTestParse.py b/NetTest/NetTestParse.py
index 6439c4d..13141e9 100644
--- a/NetTest/NetTestParse.py
+++ b/NetTest/NetTestParse.py
@@ -226,10 +226,10 @@ class NetConfigParse(RecipeParser):
params = {"dev_id": dev_id}
scheme = {"addresses": self._addresses}
+ scheme["options"] = self._options
if dev["type"] == "eth":
pass
elif dev["type"] in ["bond", "bridge", "vlan", "macvlan", "team"]:
- scheme["options"] = self._options
scheme["slaves"] = self._slaves
else:
logging.warn("unknown type \"%s\"" % dev["type"])
diff --git a/recipes/team/netconfig-test1_002.xml b/recipes/team/netconfig-test1_002.xml
new file mode 100644
index 0000000..3dbf67d
--- /dev/null
+++ b/recipes/team/netconfig-test1_002.xml
@@ -0,0 +1,38 @@
+<netconfig>
+ <interface id="1" phys_id="1" type="eth">
+ <options>
+ <option name="teamd_port_config">
+ {
+ "prio": -10,
+ "sticky": true
+ }
+ </option>
+ </options>
+ </interface>
+ <interface id="2" phys_id="2" type="eth">
+ <options>
+ <option name="teamd_port_config">
+ {
+ "prio": 100
+ }
+ </option>
+ </options>
+ </interface>
+ <interface id="3" type="team">
+ <options>
+ <option name="teamd_config">
+ {
+ "runner": {"name": "activebackup"},
+ "link_watch": {"name": "ethtool"}
+ }
+ </option>
+ </options>
+ <slaves>
+ <slave id="1"/>
+ <slave id="2"/>
+ </slaves>
+ <addresses>
+ <address value="192.168.111.1/24"/>
+ </addresses>
+ </interface>
+</netconfig>
diff --git a/recipes/team/netconfig-test2_002.xml b/recipes/team/netconfig-test2_002.xml
new file mode 100644
index 0000000..06cfcef
--- /dev/null
+++ b/recipes/team/netconfig-test2_002.xml
@@ -0,0 +1,38 @@
+<netconfig>
+ <interface id="1" phys_id="1" type="eth">
+ <options>
+ <option name="teamd_port_config">
+ {
+ "prio": -10,
+ "sticky": true
+ }
+ </option>
+ </options>
+ </interface>
+ <interface id="2" phys_id="2" type="eth">
+ <options>
+ <option name="teamd_port_config">
+ {
+ "prio": 100
+ }
+ </option>
+ </options>
+ </interface>
+ <interface id="3" type="team">
+ <options>
+ <option name="teamd_config">
+ {
+ "runner": {"name": "activebackup"},
+ "link_watch": {"name": "ethtool"}
+ }
+ </option>
+ </options>
+ <slaves>
+ <slave id="1"/>
+ <slave id="2"/>
+ </slaves>
+ <addresses>
+ <address value="192.168.111.2/24"/>
+ </addresses>
+ </interface>
+</netconfig>
diff --git a/recipes/team/recipe_002.xml b/recipes/team/recipe_002.xml
new file mode 100644
index 0000000..ebb250d
--- /dev/null
+++ b/recipes/team/recipe_002.xml
@@ -0,0 +1,13 @@
+<nettestrecipe>
+ <machines>
+ <machine id="1">
+ <netmachineconfig source="netmachineconfig-test1.xml"/>
+ <netconfig source="netconfig-test1_002.xml"/>
+ </machine>
+ <machine id="2">
+ <netmachineconfig source="netmachineconfig-test2.xml"/>
+ <netconfig source="netconfig-test2_002.xml"/>
+ </machine>
+ </machines>
+ <command_sequence source="sequence_ping_simple.xml"/>
+</nettestrecipe>
11 years, 3 months
[lnst trac] #7: change multi-sequence evaluation behavior
by fedora-badges
#7: change multi-sequence evaluation behavior
-------------------------+---------------------
Reporter: jtluka | Owner: jtluka
Type: enhancement | Status: new
Priority: major | Milestone:
Component: component1 | Version:
Keywords: controller | Blocked By:
Blocking: |
-------------------------+---------------------
Currently if any of the command sequence fails the whole recipe is
aborted and the rest of the command sequences won't be executed.
Imagine you have the recipe split into several logical parts and you'd
like to see if any of them pass. Currently you have to rely on all of them
to pass.
The change would be to execute all of the sequences in recipe no matter if
they fail or not by default and if user wants to specify some crucial
sequence, add attribute "quit_on_fail" to command_sequence tag.
--
Ticket URL: <https://fedorahosted.org/lnst/ticket/7>
lnst <http://example.org/>
My example project
11 years, 3 months