diskimage-builder/diskimage_builder/elements/simple-init
Paul Belanger 87236af75c Have simple-init enable network.service
When a glean is running on centos with multiple NICs, it will try to
systemctl enable network.service multiple times for each interface.
Because of systemd magic, it is possible for the systemctl command to
fail in a race condition.

glean shouldn't be enabling network.service during boot in
pre-networking phases (Ib2b618dd975ca44e9c6b0a2c9027642ffc46b9b0).  I
have proposed I8319f1ed6498a9d447950c2b4b34bca59e7b97e4 to remove this
and document the behaviour.

This also bring across suse's version
(I20bffabd333ea290d8712ec2a467f2b2d5678f3a)

Change-Id: I89d9443cb61e287bd0d9da3f48315272218ee335
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2017-03-28 19:28:51 +11:00
..
environment.d Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
install.d Merge remote-tracking branch 'origin/master' into merge-branch 2016-11-18 13:53:56 +11:00
post-install.d Have simple-init enable network.service 2017-03-28 19:28:51 +11:00
element-deps Have simple-init enable network.service 2017-03-28 19:28:51 +11:00
package-installs.yaml Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
pkg-map Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
README.rst Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00
source-repository-simple-init Move elements & lib relative to diskimage_builder package 2016-11-01 17:27:41 -07:00

===========
simple-init
===========
Basic network and system configuration that can't be done until boot

Unfortunately, as much as we'd like to bake it in to an image, we can't
know in advance how many network devices will be present, nor if DHCP is
present in the host cloud. Additionally, in environments where cloud-init
is not used, there are a couple of small things, like mounting config-drive
and pulling ssh keys from it, that need to be done at boot time.

Autodetect network interfaces during boot and configure them
------------------------------------------------------------

The rationale for this is that we are likely to require multiple
network interfaces for use cases such as baremetal and there is no way
to know ahead of time which one is which, so we will simply run a
DHCP client on all interfaces with real MAC addresses (except lo) that
are visible on the first boot.

The script `/usr/local/sbin/simple-init.sh` will be called
early in each boot and will scan available network interfaces and
ensure they are configured properly before networking services are started.

Processing startup information from config-drive
------------------------------------------------

On most systems, the DHCP approach desribed above is fine. But in some clouds,
such as Rackspace Public cloud, there is no DHCP.  Instead, there is static
network config via `config-drive`. `simple-init` will happily call
`glean` which will do nothing if static network information is
not there.

Finally, glean will handle ssh-keypair-injection from config
drive if cloud-init is not installed.

Chosing glean installation source
---------------------------------

By default glean is installed using pip using the latest release on pypi.
It is also possible to install glean from a specified git repository
location. This is useful for debugging and testing new glean changes
for example. To do this you need to set these variables::

  DIB_INSTALLTYPE_simple_init=repo
  DIB_REPOLOCATION_glean=/path/to/glean/repo
  DIB_REPOREF_glean=name_of_git_ref

For example to test glean change 364516 do::

  git clone https://git.openstack.org/openstack-infra/glean /tmp/glean
  cd /tmp/glean
  git review -d 364516
  git checkout -b my-test-ref

Then set your DIB env vars like this before running DIB::

  DIB_INSTALLTYPE_simple_init=repo
  DIB_REPOLOCATION_glean=/tmp/glean
  DIB_REPOREF_glean=my-test-ref