commit d7c1b6177cf764a12bf6abf8d8eefbfec341658f Author: Jan Tluka jtluka@redhat.com Date: Fri Feb 27 17:26:28 2015 +0100
NetConfigDevice: fix macvlan hwaddr option configuration
When a user wants to configure hwaddr on macvlan device the slave will encounter an exception on malformed ip command.
This is because the slave expected different data structure (dict entry) than actually provided (list of options).
Fixes #104.
Tested on following setup:
<eth id="phy1" label="testnet"/> <macvlan> <options> <option name="hwaddr" value="0A:00:00:00:00:01"/> </options> <slaves> <slave id="phy1"/> </slaves> <addresses> <address>192.168.100.1/24</address> </addresses> </macvlan>
Signed-off-by: Jan Tluka jtluka@redhat.com Signed-off-by: Jiri Pirko jiri@resnulli.us
lnst/Slave/NetConfigDevice.py | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) --- diff --git a/lnst/Slave/NetConfigDevice.py b/lnst/Slave/NetConfigDevice.py index 77074a6..4ac2899 100644 --- a/lnst/Slave/NetConfigDevice.py +++ b/lnst/Slave/NetConfigDevice.py @@ -192,10 +192,10 @@ class NetConfigDeviceMacvlan(NetConfigDeviceGeneric): realdev_name = self._if_manager.get_mapped_device(realdev_id).get_name() dev_name = config["name"]
- if "hwaddr" in config: - hwaddr = " address %s" % config["hwaddr"] - else: - hwaddr = "" + hwaddr = "" + for opt, value in config["options"]: + if opt == "hwaddr": + hwaddr = " address %s" % value
exec_cmd("ip link add link %s %s%s type macvlan" % (realdev_name, dev_name, hwaddr))
lnst-developers@lists.fedorahosted.org