Following patch set allows user to use aliases from a python task. This was
not possible before.
Example:
<lnstrecipe>
<define>
<alias name="virtual_ip" value="192.168.111.10/24"/>
</define>
<network>
<host id="m1">
<interfaces>
<eth id="nic1" label="testnet"/>
</interfaces>
</host>
<host id="m2">
<interfaces>
<eth id="nic1" label="testnet"/>
</interfaces>
</host>
</network>
<task python="my_task.py"/>
</lnstrecipe>
And the content of my_task.py:
from lnst.Controller.Task import ctl
virtual_ip = ctl.get_alias("virtual_ip")
m1 = ctl.get_host("m1")
m1.run("ip a add dev %s %s" % (m1.get_devname("nic1"), virtual_ip))
I've run regression check for the patch series without errors.
Jan Tluka (3):
XmlTemplates: do not drop toplevel aliases so that python task can see
them
NetTestController: adding get_alias method
ControllerAPI: adding get_alias method to ControllerAPI
lnst/Controller/NetTestController.py | 12 ++++++++----
lnst/Controller/Task.py | 12 ++++++++++++
lnst/Controller/XmlTemplates.py | 5 ++++-
3 files changed, 24 insertions(+), 5 deletions(-)
--
1.8.1.4
Show replies by thread