Revert "Enable network.service with systemd"

This reverts commit 7a0f9fbddb.

I believe this change was incorrect.  It does not really make sense
for the pre-networking phases to be enabling network.service.  We have
recently been hitting race conditions which I think are our bug from
doing this multiple times.

I89d9443cb61e287bd0d9da3f48315272218ee335 ensures simple-init element
enables the service.  A note is added warning about this behaviour.

Change-Id: I8319f1ed6498a9d447950c2b4b34bca59e7b97e4
This commit is contained in:
Ian Wienand 2017-03-28 19:14:26 +11:00
parent 5c74d50c4b
commit 3bc6216828
2 changed files with 8 additions and 22 deletions

View File

@ -57,6 +57,14 @@ configuration drive is probed to see if network configuration for the
interface is available. If so, it will be added, otherwise the interface is available. If so, it will be added, otherwise the
interface will configured for DHCP. interface will configured for DHCP.
.. note ::
glean uses the network init scripts service ``network.service`` on
RedHat platforms (or the equivalent on other platforms). You should
ensure this service is enabled and other tools such as
NetworkManager are disabled for correct operation.
How do I use glean? How do I use glean?
------------------- -------------------

View File

@ -73,17 +73,12 @@ def _is_suse(distro):
def _network_files(distro): def _network_files(distro):
network_files = {} network_files = {}
if _is_suse(distro): if _is_suse(distro):
# network.service is an alias to wicked.service on SUSE
# and openSUSE images so use that instead of network.service
# since systemd refuses to treat aliases as normal services
network_files = { network_files = {
"systemd": "wicked.service",
"ifcfg": "/etc/sysconfig/network/ifcfg", "ifcfg": "/etc/sysconfig/network/ifcfg",
"route": "/etc/sysconfig/network/ifroute", "route": "/etc/sysconfig/network/ifroute",
} }
else: else:
network_files = { network_files = {
"systemd": "network.service",
"ifcfg": "/etc/sysconfig/network-scripts/ifcfg", "ifcfg": "/etc/sysconfig/network-scripts/ifcfg",
"route": "/etc/sysconfig/network-scripts/route", "route": "/etc/sysconfig/network-scripts/route",
} }
@ -482,18 +477,6 @@ def write_gentoo_interfaces(interfaces, sys_interfaces):
return files_to_write return files_to_write
def systemd_enable(service, args):
log.debug("Enabling %s via systemctl" % service)
if args.noop:
return
rc = os.system('systemctl enable %s' % service)
if rc != 0:
log.error("Error enabling %s" % service)
sys.exit(rc)
def _exists_debian_interface(name): def _exists_debian_interface(name):
file_to_check = '/etc/network/interfaces.d/{name}.cfg'.format(name=name) file_to_check = '/etc/network/interfaces.d/{name}.cfg'.format(name=name)
return os.path.exists(file_to_check) return os.path.exists(file_to_check)
@ -786,11 +769,6 @@ def write_static_network_info(
elif args.distro in ('redhat', 'centos', 'fedora', 'suse', 'opensuse'): elif args.distro in ('redhat', 'centos', 'fedora', 'suse', 'opensuse'):
files_to_write.update( files_to_write.update(
write_redhat_interfaces(interfaces, sys_interfaces, args.distro)) write_redhat_interfaces(interfaces, sys_interfaces, args.distro))
# glean configures interfaces via
# /etc/sysconfig/network-scripts, so we have to ensure that
# the LSB init script /etc/init.d/network gets started!
systemd_enable(_network_files(args.distro)["systemd"], args)
elif args.distro in 'gentoo': elif args.distro in 'gentoo':
files_to_write.update( files_to_write.update(
write_gentoo_interfaces(interfaces, sys_interfaces) write_gentoo_interfaces(interfaces, sys_interfaces)