On Tue, Aug 21, 2018 at 03:00:01PM +0200, Jan Tluka wrote:
Tue, Aug 21, 2018 at 02:11:06PM CEST, csfakian@redhat.com wrote:
m1.bond0 = BondDevice(mode="active-backup", name="my_bond0")m1.eth0.down()m1.eth1.down()m1.bond0.slave_add(m1.eth0)m1.bond0.slave_add(m1.eth1)Could we enhance the abstraction here? Probably we could completely remove: m1.eth0.down() m1.eth1.down()
and move it into BondDevice class when calling m1.bond0.slave_add(m1.eth0)
This is more of a generic "next" branch question... it's an interesting idea, but I'm not 100% convinced... the slave_{add, del} methods are shared by all devices inheriting from MasterDevice class. At the same time the rules to adding slaves can be slightly different based on the type of device, some types don't require first setting the slaves down, some do, some require the master to be down.
Hiding this inside the slave_{add, del} methods could become confusing and give testers false assumptions - e.g. adding a slave while some test is running will end up setting all other slaves and the master down, then add the slave and then set everything back up, whereas in the code it would just look like a slave was added.
So I think for now I prefer this to be explicit even if it leads to a couple more lines. But we can discuss this on an upstream meeting, see what others think...
-Ondrej