Gateway=192.168.250.1
''')
subprocess.call(['systemctl', 'reset-failed', 'systemd-networkd', 'systemd-resolved'])
- subprocess.check_call(['systemctl', 'start', 'systemd-networkd'])
+ subprocess.check_call(['systemctl', 'restart', 'systemd-networkd'])
self.wait_online()
def tearDown(self):
def start_unit(self, unit):
try:
- subprocess.check_call(['systemctl', 'start', unit])
+ # The service may be already started. Hence, restart it.
+ subprocess.check_call(['systemctl', 'restart', unit])
except subprocess.CalledProcessError:
self.show_journal(unit)
raise
extra_opts='IPv6AcceptRA=no')
except subprocess.CalledProcessError as e:
# networkd often fails to start in LXC: https://github.com/systemd/systemd/issues/11848
- if IS_CONTAINER and e.cmd == ['systemctl', 'start', 'systemd-networkd']:
+ if IS_CONTAINER and e.cmd == ['systemctl', 'restart', 'systemd-networkd']:
raise unittest.SkipTest('https://github.com/systemd/systemd/issues/11848')
else:
raise
extra_opts='IPv6AcceptRA=no')
except subprocess.CalledProcessError as e:
# networkd often fails to start in LXC: https://github.com/systemd/systemd/issues/11848
- if IS_CONTAINER and e.cmd == ['systemctl', 'start', 'systemd-networkd']:
+ if IS_CONTAINER and e.cmd == ['systemctl', 'restart', 'systemd-networkd']:
raise unittest.SkipTest('https://github.com/systemd/systemd/issues/11848')
else:
raise
[Network]
IPv6AcceptRA=no
''')
- subprocess.check_call(['systemctl', 'start', 'systemd-networkd'])
+ subprocess.check_call(['systemctl', 'restart', 'systemd-networkd'])
self.assert_link_states(test_if1='managed', fake_if2='unmanaged')
def test_inverted_matching(self):
[Network]
IPv6AcceptRA=no
'''.format(mac))
- subprocess.check_call(['systemctl', 'start', 'systemd-networkd'])
+ subprocess.check_call(['systemctl', 'restart', 'systemd-networkd'])
self.assert_link_states(test_veth='managed', test_peer='unmanaged')
def test_unmanaged_setting(self):
"""Verify link states with Unmanaged= settings, hot-plug."""
- subprocess.check_call(['systemctl', 'start', 'systemd-networkd'])
+ subprocess.check_call(['systemctl', 'restart', 'systemd-networkd'])
self.create_iface()
self.assert_link_states(m1def='managed',
m1man='managed',
def test_unmanaged_setting_coldplug(self):
"""Verify link states with Unmanaged= settings, cold-plug."""
self.create_iface()
- subprocess.check_call(['systemctl', 'start', 'systemd-networkd'])
+ subprocess.check_call(['systemctl', 'restart', 'systemd-networkd'])
self.assert_link_states(m1def='managed',
m1man='managed',
m1unm='unmanaged',
"""Verify link states with a catch-all config, hot-plug."""
# Don't actually catch ALL interfaces. It messes up the host.
self.write_network('50-all.network', "[Match]\nName=m[01]???\n")
- subprocess.check_call(['systemctl', 'start', 'systemd-networkd'])
+ subprocess.check_call(['systemctl', 'restart', 'systemd-networkd'])
self.create_iface()
self.assert_link_states(m1def='managed',
m1man='managed',
# Don't actually catch ALL interfaces. It messes up the host.
self.write_network('50-all.network', "[Match]\nName=m[01]???\n")
self.create_iface()
- subprocess.check_call(['systemctl', 'start', 'systemd-networkd'])
+ subprocess.check_call(['systemctl', 'restart', 'systemd-networkd'])
self.assert_link_states(m1def='managed',
m1man='managed',
m1unm='unmanaged',