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
)
This commit is contained in:
parent
a61f37aeed
commit
08dd63ec00
|
@ -311,6 +311,10 @@ class NetConfig(object):
|
|||
def ifdown(self, interface, iftype='interface'):
|
||||
msg = 'running ifdown on %s: %s' % (iftype, interface)
|
||||
self.execute(msg, '/sbin/ifdown', interface, check_exit_code=False)
|
||||
if utils.is_active_nic(interface):
|
||||
msg = '%s %s is up, trying with ip command' % (iftype, interface)
|
||||
self.execute(msg, '/sbin/ip',
|
||||
'link', 'set', 'dev', interface, 'down')
|
||||
|
||||
def ifup(self, interface, iftype='interface'):
|
||||
"""Run 'ifup' on the specified interface
|
||||
|
|
Loading…
Reference in New Issue