From: Ondrej Lichtner <olichtne(a)redhat.com>
The following set of patches introduces network namespace support to LNST. This
required some changes to the way the slave server works. Currently there will
be a single "master" process that acts as the main server and manages the root
network namespace (or the namespace that lnst-slave was launched in). This is
the process that the controller connects to and communicates with.
When the controller requests the creation of a new network namespace the server
forks itself and using the unshare syscall creates a new namespace. This new
process will now act as the lnst-slave server that manages a different
namespace (configuration, running commands and cleanup). The new process only
communicates with it's parent through a pipe object, and as far as network
communication is concerned this parent is it's connected controller. At this
point the parent process starts acting like a router resending messages from
the network namespaces to the controller and vice versa.
The configuration itself works in this order:
1. namespace creation
2. move interfaces to their target namespaces
3. configure interfaces (create soft interfaces in their target namespace)
When it comes to recipe XML format, the only thing that changed is that you can
now use the attribute "netns" for devices, and for some commands (where it
makes sense).
Next it will probably be a good idea to add support for veth type devices,
signal commands probably shouldn't require to use the netns attribute, netns
support for python taks.
To finish off I'll add an example recipe:
<lnstrecipe>
<network>
<host id="1">
<interfaces>
<eth id="t1" netns="xyz"
label="ttnet"/>
<eth id="t2" netns="xyz"
label="ttnet"/>
<bond id="t3" netns="xyz">
<addresses>
<address value="192.168.100.240/24"/>
</addresses>
<slaves>
<slave id="t1"/>
<slave id="t2"/>
</slaves>
</bond>
</interfaces>
</host>
<host id="2">
<interfaces>
<eth id="t1" label="ttnet">
<addresses>
<address value="192.168.100.215/24"/>
</addresses>
</eth>
</interfaces>
</host>
</network>
<task>
<run host="1" command="ip a"/>
<run host="1" command="ip a" netns="xyz"/>
<run host="1" module="IcmpPing" netns="xyz">
<options>
<option name="addr" value="{ip(2,t1)}"/>
<option name="count" value="40"/>
<option name="interval" value="1"/>
</options>
</run>
</task>
</lnstrecipe>
Ondrej Lichtner (8):
ConnectioHandler: set select timeout to 0
NetTestSlave: enable/disable NM on demand
InterfaceManager: change id to device mapping
slave: network namespace support
NetConfigDevice: bonding use iproute2 when possible
XmlProcessing: don't transform None to string
recipe: network namespace support
controller: network namespace support
lnst/Common/ConnectionHandler.py | 2 +-
lnst/Controller/Machine.py | 127 ++++++++++++++++++++++---
lnst/Controller/NetTestController.py | 19 +++-
lnst/Controller/RecipeParser.py | 12 +++
lnst/Controller/XmlProcessing.py | 3 +-
lnst/Slave/InterfaceManager.py | 60 +++++++++---
lnst/Slave/NetConfigDevice.py | 31 +++++--
lnst/Slave/NetTestSlave.py | 175 ++++++++++++++++++++++++++++++++++-
lnst/Slave/NmConfigDevice.py | 10 +-
schema-recipe.rng | 21 +++++
10 files changed, 420 insertions(+), 40 deletions(-)
--
1.9.3
Show replies by date