[PATCH] NetConfigDevice: ignore address deletion fail
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
The slave would crash on trying to remove an ip address that doesn't
exist on the device. This can happen for a variety of reasons, for
example the user removes the address in one of the tasks. This patch
fixes the crash.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Slave/NetConfigDevice.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lnst/Slave/NetConfigDevice.py b/lnst/Slave/NetConfigDevice.py
index 39267a6..4fa1b50 100644
--- a/lnst/Slave/NetConfigDevice.py
+++ b/lnst/Slave/NetConfigDevice.py
@@ -61,7 +61,8 @@ class NetConfigDeviceGeneric(object):
config = self._dev_config
if "addresses" in config:
for address in config["addresses"]:
- exec_cmd("ip addr del %s dev %s" % (address, config["name"]))
+ exec_cmd("ip addr del %s dev %s" % (address, config["name"]),
+ die_on_err=False)
exec_cmd("ip link set %s down" % config["name"])
@classmethod
--
1.9.0
10 years
[PATCH] InterfaceManager: update dev name in configuration dict
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
This commit solves the problem of updated device names not being visible
in the {Net, Nm}ConfigDevice objects. This caused crashes on slave
deconfiguration if the device changed it's name during test execution.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Slave/InterfaceManager.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py
index 107601c..c21dc16 100644
--- a/lnst/Slave/InterfaceManager.py
+++ b/lnst/Slave/InterfaceManager.py
@@ -204,6 +204,9 @@ class Device(object):
self._ip = None #TODO
self._master = nl_msg.get_attr("IFLA_MASTER")
+ if self._conf_dict:
+ self._conf_dict["name"] = self._name
+
#return an update message that will be sent to the controller
return {"type": "if_update",
"devname": self._name,
--
1.9.0
10 years
[PATCH] add ovs_vlan.xml recipe
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
This commit adds a new example recipe for Open vSwitch. The test follows
the example from the official Open vSwitch Configuration Cookbook on
VLANs
http://openvswitch.org/support/config-cookbooks/vlan-configuration-cookbook/
The only difference is that the recipe uses 6 machines (in my case all
virtual) instead of 2 physical hosts with 2 virtual machines each, but
the end result should be the same.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
recipes/examples/ovs/ovs_vlan.xml | 145 ++++++++++++++++++++++++++++++++++++++
1 file changed, 145 insertions(+)
create mode 100644 recipes/examples/ovs/ovs_vlan.xml
diff --git a/recipes/examples/ovs/ovs_vlan.xml b/recipes/examples/ovs/ovs_vlan.xml
new file mode 100644
index 0000000..4ba5496
--- /dev/null
+++ b/recipes/examples/ovs/ovs_vlan.xml
@@ -0,0 +1,145 @@
+<lnstrecipe>
+ <network>
+ <host id="vm1">
+ <interfaces>
+ <eth id="if1" label="n1">
+ <addresses>
+ <address value="192.168.200.1/24"/>
+ </addresses>
+ </eth>
+ </interfaces>
+ </host>
+ <host id="vm2">
+ <interfaces>
+ <eth id="if2" label="n2">
+ <addresses>
+ <address value="192.168.200.2/24"/>
+ </addresses>
+ </eth>
+ </interfaces>
+ </host>
+ <host id="vm3">
+ <interfaces>
+ <eth id="if3" label="n3">
+ <addresses>
+ <address value="192.168.200.3/24"/>
+ </addresses>
+ </eth>
+ </interfaces>
+ </host>
+ <host id="vm4">
+ <interfaces>
+ <eth id="if4" label="n4">
+ <addresses>
+ <address value="192.168.200.4/24"/>
+ </addresses>
+ </eth>
+ </interfaces>
+ </host>
+ <host id="h1">
+ <params>
+ <param name="ovs_support" value="true"/>
+ </params>
+ <interfaces>
+ <eth id="if1" label="n1"/>
+ <eth id="if2" label="n2"/>
+ <eth id="if3" label="data_net"/>
+ <ovs_bridge id="ovs1">
+ <slaves>
+ <slave id="if1"/>
+ <slave id="if2"/>
+ <slave id="if3"/>
+ </slaves>
+ <vlan tag="1">
+ <slaves>
+ <slave id="if1"/>
+ </slaves>
+ </vlan>
+ <vlan tag="2">
+ <slaves>
+ <slave id="if2"/>
+ </slaves>
+ </vlan>
+ </ovs_bridge>
+ </interfaces>
+ </host>
+ <host id="h2">
+ <params>
+ <param name="ovs_support" value="true"/>
+ </params>
+ <interfaces>
+ <eth id="if1" label="n3"/>
+ <eth id="if2" label="n4"/>
+ <eth id="if3" label="data_net"/>
+ <ovs_bridge id="ovs2">
+ <slaves>
+ <slave id="if1"/>
+ <slave id="if2"/>
+ <slave id="if3"/>
+ </slaves>
+ <vlan tag="1">
+ <slaves>
+ <slave id="if1"/>
+ </slaves>
+ </vlan>
+ <vlan tag="2">
+ <slaves>
+ <slave id="if2"/>
+ </slaves>
+ </vlan>
+ </ovs_bridge>
+ </interfaces>
+ </host>
+ </network>
+
+ <task>
+ <run host="vm1" module="IcmpPing" timeout="30" expect="fail">
+ <options>
+ <option name="addr" value="{ip(vm2,if2)}"/>
+ <option name="count" value="40"/>
+ <option name="interval" value="0"/>
+ <option name="limit_rate" value="95"/>
+ </options>
+ </run>
+ <run host="vm1" module="IcmpPing" timeout="30" expect="pass">
+ <options>
+ <option name="addr" value="{ip(vm3,if3)}"/>
+ <option name="count" value="40"/>
+ <option name="interval" value="0"/>
+ <option name="limit_rate" value="95"/>
+ </options>
+ </run>
+ <run host="vm1" module="IcmpPing" timeout="30" expect="fail">
+ <options>
+ <option name="addr" value="{ip(vm4,if4)}"/>
+ <option name="count" value="40"/>
+ <option name="interval" value="0"/>
+ <option name="limit_rate" value="95"/>
+ </options>
+ </run>
+ <run host="vm2" module="IcmpPing" timeout="30" expect="fail">
+ <options>
+ <option name="addr" value="{ip(vm1,if1)}"/>
+ <option name="count" value="40"/>
+ <option name="interval" value="0"/>
+ <option name="limit_rate" value="95"/>
+ </options>
+ </run>
+ <run host="vm2" module="IcmpPing" timeout="30" expect="fail">
+ <options>
+ <option name="addr" value="{ip(vm3,if3)}"/>
+ <option name="count" value="40"/>
+ <option name="interval" value="0"/>
+ <option name="limit_rate" value="95"/>
+ </options>
+ </run>
+ <run host="vm2" module="IcmpPing" timeout="30" expect="pass">
+ <options>
+ <option name="addr" value="{ip(vm4,if4)}"/>
+ <option name="count" value="40"/>
+ <option name="interval" value="0"/>
+ <option name="limit_rate" value="95"/>
+ </options>
+ </run>
+ </task>
+</lnstrecipe>
--
1.8.5.3
10 years
[PATCH] RecipeParser: always initialize ovs_conf
by Ondrej Lichtner
From: Ondrej Lichtner <olichtne(a)redhat.com>
When the recipe doesn't contain any vlans or bonds, the corresponding
ovs_conf fields wouldn't be created. That causes the slave to crash.
This commit fixes that.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Controller/RecipeParser.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/lnst/Controller/RecipeParser.py b/lnst/Controller/RecipeParser.py
index c4fe61f..2b554d7 100644
--- a/lnst/Controller/RecipeParser.py
+++ b/lnst/Controller/RecipeParser.py
@@ -141,8 +141,7 @@ class RecipeParser(XmlParser):
iface["slaves"].append(slave)
vlan_elems = iface_tag.findall("vlan")
- if len(vlan_elems) > 0:
- vlans = iface["ovs_conf"]["vlans"] = XmlData(slaves_tag)
+ vlans = iface["ovs_conf"]["vlans"] = XmlData(slaves_tag)
for vlan in vlan_elems:
vlan_tag = str(self._get_attribute(vlan, "tag"))
if vlan_tag in vlans:
@@ -171,8 +170,7 @@ class RecipeParser(XmlParser):
bonded_slaves = {}
bond_elems = iface_tag.findall("bond")
- if len(bond_elems) > 0:
- bonds = iface["ovs_conf"]["bonds"] = XmlData(slaves_tag)
+ bonds = iface["ovs_conf"]["bonds"] = XmlData(slaves_tag)
for bond_tag in bond_elems:
bond_id = str(self._get_attribute(bond_tag, "id"))
if bond_id in bonds:
--
1.8.5.3
10 years