diskimage-builder/elements/base/README.rst

35 lines
1.2 KiB
ReStructuredText
Raw Normal View History

====
base
====
This is the base element.
Almost all users will want to include this in their disk image build,
as it includes a lot of useful functionality.
Make managing hosts entries optional Diskimage-builder currently writes cloud-init config file which adds a host entry mapping the hostname and FQDN to 127.0.0.1 into every image built. This is probably useful for some use cases but not for all, so we now allow customizing the manage_etc_hosts value via DIB_CLOUD_INIT_ETC_HOSTS variable and also not writing the config at all if that variable is explicitly set to an empty string (currently the default is 'localhost' but in the future the default will be empty string). Particular description of the problem this causes in TripleO follows: We get hosts files like this: ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 127.0.0.1 ov-rl5i5saoc6h-1-hj5tzsbrdv4c-controller-dy6nuyarqy5z.novalocal ov-rl5i5saoc6h-1-hj5tzsbrdv4c-controller-dy6nuyarqy5z # HEAT_HOSTS_START - Do not edit manually within this section! 192.0.2.17 ov-rl5i5saoc6h-0-wfzcsrqo34p6-controller-m3hy26lhxavl ov-rl5i5saoc6h-0-wfzcsrqo34p6-controller-m3hy26lhxavl.novalocal 192.0.2.15 ov-rl5i5saoc6h-1-hj5tzsbrdv4c-controller-dy6nuyarqy5z ov-rl5i5saoc6h-1-hj5tzsbrdv4c-controller-dy6nuyarqy5z.novalocal 192.0.2.16 ov-rl5i5saoc6h-2-a6v7saxnivm5-controller-7jboskte34r7 ov-rl5i5saoc6h-2-a6v7saxnivm5-controller-7jboskte34r7.novalocal # HEAT_HOSTS_END The duplicate hostname/FQDN entry for 127.0.0.1 and 192.0.2.15 confuses Corosync, which then fails to start a cluster when using hostnames in the config file instead of IPs. Change-Id: Ia8582883f737548e2911d3f36a1943e5b236281b Partial-Bug: #1447497
2015-04-24 11:32:36 +00:00
The `DIB_CLOUD_INIT_ETC_HOSTS` environment variable can be used to
customize cloud-init's management of `/etc/hosts`:
* If the variable is set to something, write that value as
cloud-init's manage_etc_hosts.
* If the variable is set to an empty string, don't create
manage_etc_hosts setting (cloud-init will use its default value).
* If the variable is not set, use "localhost" for now. Later, not
setting the variable will mean using cloud-init's default. (To
preserve diskimage-builder's current default behavior in the
future, set the variable to "localhost" explicitly.)
Notes:
* If you are getting warnings during the build about your locale
being missing, consider installing/generating the relevant locale.
This may be as simple as having language-pack-XX installed in the
pre-install stage
Move /tmp/ccache setup to base element Commit c7d80dd (Cleanup mount points automatically) removed the unmount of $TMP_MOUNT_PATH/tmp/ccache in run_d_in_target() and moved the "rm /tmp/ccache" to elements/base/finalise.d/02-remove-ccache. There are two problems with this: 1) Not unmounting at the end of run_d_in_target() results in tmp/ccache being bind mounted muliple times on top of itself (three times, if you just run `disk-image-create base`). It is eventually unmounted, but somehow the auto unmount code is confused, and tries to unmount it one more time than it was mounted, which results in an error like "umount: /tmp/image.THQkZxQa/mnt/tmp/ccache: not mounted". This doesn't actually break anything, but it's a little messy. 2) "rm /tmp/ccache" in elements/base/finalise.d/02-remove-ccache never succeeds in removing /tmp/ccache, because that hook is invoked by run_d_in_target(), *while* /tmp/ccache is mounted. This present commit solves the above by moving the ccache setup glue out of img-functions and into the base element's root.d. This has the following implications: 1) lib/img-functions is a little cleaner. 2) /tmp/ccache is available in the chroot during the root, extra-data, pre-install, install and post-install stages. It is not available during block-device, finalise and cleanup stages as it will have been automatically unmounted by then. 3) /tmp/ccache won't be setup if you're building an image that doesn't include the base element. Change-Id: Ief4c0a6f4ec622db6c6f652776215684178d8943
2013-10-08 12:53:16 +00:00
* This element ensures /tmp/ccache will be available in the chroot
during the root, extra-data, pre-install, install and post-install
stages. /tmp/ccache is unavailable during block-device, finalise
and cleanup stages as it will have been automatically unmounted
by then.