Browse Source

ifdown does not work if no ifcfg file exist

ifdown happen before writing_config and if interface is up by
dhcp/dhclient it will not be down, ifdown relaying on ifcfg exist.

causing issue when pxe boot interface is also used as part of bond
interface.
interface is required to be down before adding to bond,
this patch validate that any physical interface will be in down state.

Change-Id: Ie096bf1296062744193bdcb9713ee42405e206d8
Closes-Bug: #1836024
(cherry picked from commit 9aaaeb21ee)
tags/8.5.1
Noam Angel 2 months ago
parent
commit
08dd63ec00
1 changed files with 4 additions and 0 deletions
  1. 4
    0
      os_net_config/__init__.py

+ 4
- 0
os_net_config/__init__.py View File

@@ -311,6 +311,10 @@ class NetConfig(object):
311 311
     def ifdown(self, interface, iftype='interface'):
312 312
         msg = 'running ifdown on %s: %s' % (iftype, interface)
313 313
         self.execute(msg, '/sbin/ifdown', interface, check_exit_code=False)
314
+        if utils.is_active_nic(interface):
315
+            msg = '%s %s is up, trying with ip command' % (iftype, interface)
316
+            self.execute(msg, '/sbin/ip',
317
+                         'link', 'set', 'dev', interface, 'down')
314 318
 
315 319
     def ifup(self, interface, iftype='interface'):
316 320
         """Run 'ifup' on the specified interface

Loading…
Cancel
Save