From: Ondrej Lichtner olichtne@redhat.com
This makes sure that the _is_name_used sees the Device object while it is being created. This is so that if the Device creation actually creates more than one interface at once it doesn't reuse the same name for them. An example of such a case is creation of an OvS bridge with internal interfaces.
Signed-off-by: Ondrej Lichtner olichtne@redhat.com --- lnst/Slave/InterfaceManager.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py index dbaedd3..8a82bfe 100644 --- a/lnst/Slave/InterfaceManager.py +++ b/lnst/Slave/InterfaceManager.py @@ -225,10 +225,11 @@ class InterfaceManager(object): config["name"] = self.assign_name(config)
device = Device(self) + self._tmp_mapping[if_id] = device + device.set_configuration(config) device.create()
- self._tmp_mapping[if_id] = device return config["name"]
def create_device_pair(self, if_id1, config1, if_id2, config2): @@ -240,6 +241,8 @@ class InterfaceManager(object):
device1 = Device(self) device2 = Device(self) + self._tmp_mapping[if_id1] = device1 + self._tmp_mapping[if_id2] = device2
device1.set_configuration(config1) device2.set_configuration(config2) @@ -247,9 +250,6 @@ class InterfaceManager(object):
device1.set_peer(device2) device2.set_peer(device1) - - self._tmp_mapping[if_id1] = device1 - self._tmp_mapping[if_id2] = device2 return name1, name2
def wait_interface_init(self):