From 55b6101e1be79c5644941ed580d6fcd6d39df78e Mon Sep 17 00:00:00 2001 From: Noam Angel Date: Mon, 31 Oct 2016 11:23:33 +0200 Subject: [PATCH 01/22] add option to configure cloud-init to allow password authentication This patch will configure cloud-init to allow password authentication. This is usefull in case you use "devuser" element and want to ssh guest image. Change-Id: I00e38aa2753f26b4cdd34d0fd85fc8e0de78171f --- elements/cloud-init/README.rst | 9 ++++++++ .../21-cloud-init-allow-password-auth | 22 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100755 elements/cloud-init/post-install.d/21-cloud-init-allow-password-auth diff --git a/elements/cloud-init/README.rst b/elements/cloud-init/README.rst index 3a1c8fef..e76e956b 100644 --- a/elements/cloud-init/README.rst +++ b/elements/cloud-init/README.rst @@ -6,3 +6,12 @@ Install's and enables cloud-init for systems that don't come with it pre-installed Currently only supports Gentoo. + +Environment Variables +--------------------- + +DIB_CLOUD_INIT_ALLOW_PASS_AUTH + :Required: No + :Default: password authentication disabled when cloud-init installed + :Description: customize cloud-init to allow ssh password + authentication. diff --git a/elements/cloud-init/post-install.d/21-cloud-init-allow-password-auth b/elements/cloud-init/post-install.d/21-cloud-init-allow-password-auth new file mode 100755 index 00000000..643653e2 --- /dev/null +++ b/elements/cloud-init/post-install.d/21-cloud-init-allow-password-auth @@ -0,0 +1,22 @@ +#!/bin/bash + +if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then + set -x +fi +set -eu +set -o pipefail + +# Set cloud-init to allow password authentication +if [ -n "${DIB_CLOUD_INIT_ALLOW_SSH_PWAUTH:-}" ]; then + if [ -f "/etc/cloud/cloud.cfg" ]; then + if [ -z "$(cat /etc/cloud/cloud.cfg | grep ssh_pwauth)" ]; then + echo "ssh_pwauth not exist. append to EOF" + sudo sh -c 'echo "ssh_pwauth: 1" >> /etc/cloud/cloud.cfg' + else + echo "ssh_pwauth exist. make sure ssh_pwauth enabled" + sed -i -e 's/ssh_pwauth: *0/ssh_pwauth: 1/g' /etc/cloud/cloud.cfg + sed -i -e 's/ssh_pwauth: *False/ssh_pwauth: True/g' /etc/cloud/cloud.cfg + sed -i -e 's/ssh_pwauth: *false/ssh_pwauth: true/g' /etc/cloud/cloud.cfg + fi + fi +fi From e4868d9ad603f742724fac0e1067bd688d41283d Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Tue, 22 Nov 2016 10:47:43 +0000 Subject: [PATCH 02/22] elements: Drop unneeded DIB_INIT_SYSTEM usage DIB_INIT_SYSTEM is exported by the dib-init-system element and contains the output of the dib-init-system script so there is no need to re-initialize it during various phases. Change-Id: I09d6d10742689efe3d8eb9d64b539d6599b46227 --- elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces | 1 - elements/enable-serial-console/install.d/20-stty | 1 - 2 files changed, 2 deletions(-) diff --git a/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces b/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces index 24c109eb..f8e7a14e 100755 --- a/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces +++ b/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces @@ -13,7 +13,6 @@ if [ "$DISTRO_NAME" != "gentoo" ]; then install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.sh /usr/local/sbin/dhcp-all-interfaces.sh fi -DIB_INIT_SYSTEM=$(dib-init-system) if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then if [ -e "/etc/redhat-release" ] ; then # the init system is upstart but networking is using sysv compatabiliy (i.e. Centos/RHEL 6) diff --git a/elements/enable-serial-console/install.d/20-stty b/elements/enable-serial-console/install.d/20-stty index 8e20b403..6dd695c7 100755 --- a/elements/enable-serial-console/install.d/20-stty +++ b/elements/enable-serial-console/install.d/20-stty @@ -8,7 +8,6 @@ set -o pipefail SCRIPTDIR=$(dirname $0) -DIB_INIT_SYSTEM=$(dib-init-system) if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then install -m 0644 -o root -g root ${SCRIPTDIR}/ttySx.conf /etc/init/ttySx.conf elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; then From 29d50bc69b95f3bcb834cae9dff73fcf170d2654 Mon Sep 17 00:00:00 2001 From: Luong Anh Tuan Date: Tue, 22 Nov 2016 11:46:40 +0700 Subject: [PATCH 03/22] Replace six.iteritems() with .items() We should avoid using six.iteritems/keys achieve iterators. We can use dict.items/keys instead, as it will return iterators in PY3 as well. And dict.items/keys will more readable. In py2, the performance about list should be negligible, see https://wiki.openstack.org/wiki/Python3 and http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html Change-Id: I6353f0a1b423c6dbd0c71343f7919fd0de440e34 --- elements/svc-map/extra-data.d/10-merge-svc-map-files | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/elements/svc-map/extra-data.d/10-merge-svc-map-files b/elements/svc-map/extra-data.d/10-merge-svc-map-files index 3aa1afe2..c8b0e034 100755 --- a/elements/svc-map/extra-data.d/10-merge-svc-map-files +++ b/elements/svc-map/extra-data.d/10-merge-svc-map-files @@ -15,7 +15,6 @@ import os import sys -import six import yaml @@ -39,7 +38,7 @@ def merge_data(source, destination, distro): result = dict() result.update(destination) family = os_family(distro) - for servicename, mapping in six.iteritems(source): + for servicename, mapping in source.items(): if servicename in result: raise Exception("%s already found in services list" % servicename) if distro in mapping: From ff79dc979322be71b5e538b633a2a3604b402551 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Tue, 22 Nov 2016 18:02:42 +1100 Subject: [PATCH 04/22] Catch errors in DIB_INIT_SYSTEM export When you source a file that just does export FOO=$(bar) you miss any invalid return codes from "bar" (even under -e) because bash returns the value of the "export", which is 0 On centos-minimal, we stopped bringing in systemd early and this was causing dib-init-system to not know what init was available. Since it did not fail correctly, it lead to confusing errors much later in the build when service files were not copied correctly. See also I24ce648485c3d6f3c27ab8f87a638516b3727017 A dib-lint check is added. One minor fixup is in 00-set-apt-sources (this one is less likely to cause problems). I have run dib-lint over project-config elements and none use this pattern. Change-Id: I076c08190d40c315ad6a6d96a3823e9fc52630be --- bin/dib-lint | 9 +++++++++ .../test-sources/environment.d/00-set-apt-sources | 3 ++- .../environment.d/10-dib-init-system.bash | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bin/dib-lint b/bin/dib-lint index c58865e5..8301ff2a 100755 --- a/bin/dib-lint +++ b/bin/dib-lint @@ -158,6 +158,15 @@ for i in $(find elements -type f \ fi fi + # check for + # export FOO=$(bar) + # calls. These are dangerous, because the export hides the return + # code of the $(bar) call. Split this into 2 lines and -e will + # fail on the assignment + if grep -q 'export .*\$(' $i; then + error "Split export and assignments in $i" + fi + # check that sudo calls in phases run outside the chroot look # "safe"; meaning that they seem to operate within the chroot # somehow. This is not fool-proof, but catches egregious errors, diff --git a/elements/apt-sources/test-elements/test-sources/environment.d/00-set-apt-sources b/elements/apt-sources/test-elements/test-sources/environment.d/00-set-apt-sources index 8442fc17..8034daf6 100644 --- a/elements/apt-sources/test-elements/test-sources/environment.d/00-set-apt-sources +++ b/elements/apt-sources/test-elements/test-sources/environment.d/00-set-apt-sources @@ -1 +1,2 @@ -export DIB_APT_SOURCES=$(mktemp) +DIB_APT_SOURCES=$(mktemp) +export DIB_APT_SOURCES diff --git a/elements/dib-init-system/environment.d/10-dib-init-system.bash b/elements/dib-init-system/environment.d/10-dib-init-system.bash index db640993..d683ce89 100644 --- a/elements/dib-init-system/environment.d/10-dib-init-system.bash +++ b/elements/dib-init-system/environment.d/10-dib-init-system.bash @@ -1 +1,2 @@ -export DIB_INIT_SYSTEM=$(PATH="$PATH:$(dirname $BASH_SOURCE)/.." dib-init-system) +DIB_INIT_SYSTEM=$(PATH="$PATH:$(dirname $BASH_SOURCE)/.." dib-init-system) +export DIB_INIT_SYSTEM From cdfd757ae996b06dad12fac422f6b73306e693fc Mon Sep 17 00:00:00 2001 From: Cao Xuan Hoang Date: Tue, 29 Nov 2016 11:03:55 +0700 Subject: [PATCH 05/22] Changed author and author-email Changed author to OpenStack and author_email to author-email Change-Id: Id1a398bfd644e8db41a8ab816c8c6ff3c322f7b4 --- setup.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 2345eac7..3b936875 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,8 +3,8 @@ name = diskimage-builder summary = Golden Disk Image builder. description-file = README.rst -author = HP Cloud Services -author_email = openstack-dev@lists.openstack.org +author = OpenStack +author-email = openstack-dev@lists.openstack.org license: Apache License (2.0) home-page = http://docs.openstack.org/developer/diskimage-builder/ classifier = From 34bdc7df903b86e1e3bf6c836642de745274c3ef Mon Sep 17 00:00:00 2001 From: Anshul Jain Date: Thu, 13 Oct 2016 08:52:10 +0000 Subject: [PATCH 06/22] DIB element to support cinder local attach/detach functionality This element adds python-brick-cinderclient-ext to the make customized image to support cinder local attach/detach functionality. Currently it has the dependency on known bug, which would be resolved with next release of python-brick-cinderclient-ext. Change-Id: Idfe83bafa2843c781c18b83f1a3aece3ae852f78 --- elements/python-brickclient/README.rst | 34 +++++++++++++++++++ elements/python-brickclient/element-deps | 2 ++ .../python-brickclient/package-installs.yaml | 3 ++ elements/python-brickclient/pkg-map | 14 ++++++++ .../post-install.d/55-brick-client-install | 33 ++++++++++++++++++ 5 files changed, 86 insertions(+) create mode 100644 elements/python-brickclient/README.rst create mode 100644 elements/python-brickclient/element-deps create mode 100644 elements/python-brickclient/package-installs.yaml create mode 100644 elements/python-brickclient/pkg-map create mode 100755 elements/python-brickclient/post-install.d/55-brick-client-install diff --git a/elements/python-brickclient/README.rst b/elements/python-brickclient/README.rst new file mode 100644 index 00000000..24612815 --- /dev/null +++ b/elements/python-brickclient/README.rst @@ -0,0 +1,34 @@ +python-brickclient +================== + +* This element is aimed for providing cinder local attach/detach functionality. +* Currently the feature has a dependency on a known bug + "https://launchpad.net/bugs/1623549", which has been resolved and will be part + of the upstream with the next release of python-brick-cinderclient-ext. + Note: Current version of python-brick-cinderclient-ext i.e. 0.2.0 requires and update + to be made in Line32 fo below script. + /usr/share/python-brickclient/venv/lib/python2.7/site-packages/brick_cinderclient_ext/__init__.py + update "brick-python-cinderclient-ext" to "python-brick-cinderclient-ext". + +* Usage: + Pass the below shell script to parameter 'user-data' and set 'config-drive=true' + at the time of provisioning the node via nova-boot to make cinder local + attach/detach commands talk to your cloud controller. + [Example of Config Drive Script] + #!/bin/bash + FILE="/etc/bash.bashrc" + [ ! -f "$FILE" ] && touch "$FILE" + echo 'export OS_AUTH_URL="http://:5000/v2.0"' >> "$FILE" + echo 'export OS_PASSWORD="password"' >> "$FILE" + echo 'export OS_USERNAME="demo"' >> "$FILE" + echo 'export OS_TENANT_NAME="demo"' >> "$FILE" + echo 'export OS_PROJECT_NAME="demo"' >> "$FILE" + exec bash + To attach: /usr/share/python-brickclient/venv/bin/cinder local-attach + To detach: /usr/share/python-brickclient/venv/bin/cinder local-detach + +* Alternatively, the same action can be completed manually at the node which does + not require setting up of config drive such as: + /usr/share/python-brickclient/venv/bin/cinder --os-username demo --os-password \ + password --os-tenant-name demo --os-project-name demo \ + --os-auth-url=http://:5000/v2.0 local-attach diff --git a/elements/python-brickclient/element-deps b/elements/python-brickclient/element-deps new file mode 100644 index 00000000..d397eed2 --- /dev/null +++ b/elements/python-brickclient/element-deps @@ -0,0 +1,2 @@ +package-installs +pip-and-virtualenv diff --git a/elements/python-brickclient/package-installs.yaml b/elements/python-brickclient/package-installs.yaml new file mode 100644 index 00000000..7e371d23 --- /dev/null +++ b/elements/python-brickclient/package-installs.yaml @@ -0,0 +1,3 @@ +libssl-dev: +libffi-dev: +python-dev: diff --git a/elements/python-brickclient/pkg-map b/elements/python-brickclient/pkg-map new file mode 100644 index 00000000..9f9058e1 --- /dev/null +++ b/elements/python-brickclient/pkg-map @@ -0,0 +1,14 @@ +{ + "family": { + "redhat": { + "python-dev": "python2-devel", + "libssl-dev": "openssl-devel", + "libffi-dev": "libffi-devel" + } + }, + "default": { + "python-dev": "python-dev", + "libssl-dev": "libssl-dev", + "libffi-dev": "libffi-dev" + } +} diff --git a/elements/python-brickclient/post-install.d/55-brick-client-install b/elements/python-brickclient/post-install.d/55-brick-client-install new file mode 100755 index 00000000..8e8a19fc --- /dev/null +++ b/elements/python-brickclient/post-install.d/55-brick-client-install @@ -0,0 +1,33 @@ +#!/bin/bash +# +# Copyright 2016 Hewlett Packard Enterprise Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi + +set -eu +set -o pipefail + +PBCDIR=/usr/share/python-brickclient +mkdir $PBCDIR + +# create the virtual environment +virtualenv $PBCDIR/venv + +# Install the required packages inside virtual env +$PBCDIR/venv/bin/pip install python-brick-cinderclient-ext + +ln -s $PBCDIR/venv/bin/python-brickclient /usr/local/bin/python-brickclient From e22faa0f77db22df7d7c7e41f6c8af3dd51c6ea7 Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Mon, 17 Oct 2016 14:16:55 +0100 Subject: [PATCH 07/22] elements: Drop executable bits from environment files Files in $element/environment.d are meant to be sourced, so drop the executable bit. Moreover, drop the executable bit from a couple of other scripts that are either meant to be sourced or simply because they are configuration files. Change-Id: I7f724dd9d409f4a835a136f12f48a84aa9acc41e --- bin/dib-lint | 6 +++++- elements/centos/environment.d/00-bootloader.bash | 0 .../stable-build-succeeds/environment.d/10-set-distro.bash | 0 .../testing-build-succeeds/environment.d/10-set-distro.bash | 0 .../build-succeeds/environment.d/09-debian-stable | 0 elements/devuser/environment.d/50-devuser | 0 .../dynamic-login/init-scripts/upstart/dynamic-login.conf | 0 elements/gentoo/environment.d/00-gentoo-envars.bash | 0 elements/manifests/environment.d/14-manifests | 0 elements/pip-cache/environment.d/10-pip-cache | 0 elements/ramdisk-base/extra-data.d/scripts/d/init-func | 0 elements/redhat-common/environment.d/50-redhat-common | 0 12 files changed, 5 insertions(+), 1 deletion(-) mode change 100755 => 100644 elements/centos/environment.d/00-bootloader.bash mode change 100755 => 100644 elements/debian-minimal/test-elements/stable-build-succeeds/environment.d/10-set-distro.bash mode change 100755 => 100644 elements/debian-minimal/test-elements/testing-build-succeeds/environment.d/10-set-distro.bash mode change 100755 => 100644 elements/debian/test-elements/build-succeeds/environment.d/09-debian-stable mode change 100755 => 100644 elements/devuser/environment.d/50-devuser mode change 100755 => 100644 elements/dynamic-login/init-scripts/upstart/dynamic-login.conf mode change 100755 => 100644 elements/gentoo/environment.d/00-gentoo-envars.bash mode change 100755 => 100644 elements/manifests/environment.d/14-manifests mode change 100755 => 100644 elements/pip-cache/environment.d/10-pip-cache mode change 100755 => 100644 elements/ramdisk-base/extra-data.d/scripts/d/init-func mode change 100755 => 100644 elements/redhat-common/environment.d/50-redhat-common diff --git a/bin/dib-lint b/bin/dib-lint index a8c10d4d..a34b8330 100755 --- a/bin/dib-lint +++ b/bin/dib-lint @@ -156,11 +156,15 @@ for i in $(find elements -type f \ fi fi - # check that environment files don't "set -x" + # check that environment files don't "set -x" and they have no executable + # bits set if [[ "$i" =~ (environment.d) ]]; then if grep -q "set -x" $i; then error "Environment file $i should not set tracing" fi + if [[ -x $i ]]; then + error "Environment file $i should not be marked as executable" + fi fi # check that sudo calls in phases run outside the chroot look diff --git a/elements/centos/environment.d/00-bootloader.bash b/elements/centos/environment.d/00-bootloader.bash old mode 100755 new mode 100644 diff --git a/elements/debian-minimal/test-elements/stable-build-succeeds/environment.d/10-set-distro.bash b/elements/debian-minimal/test-elements/stable-build-succeeds/environment.d/10-set-distro.bash old mode 100755 new mode 100644 diff --git a/elements/debian-minimal/test-elements/testing-build-succeeds/environment.d/10-set-distro.bash b/elements/debian-minimal/test-elements/testing-build-succeeds/environment.d/10-set-distro.bash old mode 100755 new mode 100644 diff --git a/elements/debian/test-elements/build-succeeds/environment.d/09-debian-stable b/elements/debian/test-elements/build-succeeds/environment.d/09-debian-stable old mode 100755 new mode 100644 diff --git a/elements/devuser/environment.d/50-devuser b/elements/devuser/environment.d/50-devuser old mode 100755 new mode 100644 diff --git a/elements/dynamic-login/init-scripts/upstart/dynamic-login.conf b/elements/dynamic-login/init-scripts/upstart/dynamic-login.conf old mode 100755 new mode 100644 diff --git a/elements/gentoo/environment.d/00-gentoo-envars.bash b/elements/gentoo/environment.d/00-gentoo-envars.bash old mode 100755 new mode 100644 diff --git a/elements/manifests/environment.d/14-manifests b/elements/manifests/environment.d/14-manifests old mode 100755 new mode 100644 diff --git a/elements/pip-cache/environment.d/10-pip-cache b/elements/pip-cache/environment.d/10-pip-cache old mode 100755 new mode 100644 diff --git a/elements/ramdisk-base/extra-data.d/scripts/d/init-func b/elements/ramdisk-base/extra-data.d/scripts/d/init-func old mode 100755 new mode 100644 diff --git a/elements/redhat-common/environment.d/50-redhat-common b/elements/redhat-common/environment.d/50-redhat-common old mode 100755 new mode 100644 From b2c3a3afdd89f0288934b328133c9d6bd20e75b1 Mon Sep 17 00:00:00 2001 From: gengchc2 Date: Sun, 4 Dec 2016 13:04:50 +0800 Subject: [PATCH 08/22] Delete deprecated Hacking in tox.ini Some hacking have been removed,so we can delete them. More details: https://github.com/openstack-dev/hacking/blob/master/setup.cfg Change-Id: I2ba6b00aa2a968ffb53d1061f895a593ea57a063 --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 03e35fff..605eeb39 100644 --- a/tox.ini +++ b/tox.ini @@ -35,5 +35,5 @@ commands = python setup.py build_sphinx commands = sphinx-build -a -W -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html [flake8] -ignore = E125,H202,H302,H803 +ignore = E125,H202,H803 exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,conf.py From 2e82d7f2141aa048c29ad3d9302280efd2a9d62c Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Sat, 3 Dec 2016 00:24:43 +0000 Subject: [PATCH 09/22] Update sysctl-write-value to do conflict checking Adds conflict checking to the sysctl-write-value script to detect settings from multiple elements conflicting. Change-Id: If312d199388036d6f4103e94dca99249cb3bcbaf --- elements/sysctl/bin/sysctl-write-value | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/elements/sysctl/bin/sysctl-write-value b/elements/sysctl/bin/sysctl-write-value index e60f5535..b12297f7 100755 --- a/elements/sysctl/bin/sysctl-write-value +++ b/elements/sysctl/bin/sysctl-write-value @@ -26,7 +26,18 @@ fi FILENAME="/etc/sysctl.d/${NAME}.conf" +if [ -f $FILENAME ]; then + # check to make sure the settings match... otherwise fail + if ! grep -q "^$NAME = $VALUE" $FILENAME; then + echo "Conflicting sysctl.conf setting for $NAME == $VALUE. Found:" + grep "^$NAME" $FILENAME + exit 1 + fi +else + cat > $FILENAME < Date: Thu, 8 Dec 2016 15:59:15 +1100 Subject: [PATCH 10/22] Put MKFS_OPTS after filesystem type mkfs's arguments are mkfs [options] [-t type] [fs-options] device [size] So it seems our MKFS_OPTS are really supposed to be fs-options, rather than options to mkfs itself. Why didn't we notice? It's quite a trap -- mkfs.ext2 has a "-t" option, so when we're calling $ mkfs -i 4096 ... -t ext4 ... We actually just fall-back to the default from the mkfs wrapper which is mkfs.ext2 which works! But when you make that, say, xfs, we're not calling the right wrapper at all. Also update documentation Closes-Bug: #1648287 Change-Id: I3ea5807088ab361bd9c235c07fb1553fbaf9178b --- bin/disk-image-create | 2 +- doc/source/user_guide/building_an_image.rst | 25 +++++++++++++-------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/bin/disk-image-create b/bin/disk-image-create index 415cbaf9..943cf6c6 100755 --- a/bin/disk-image-create +++ b/bin/disk-image-create @@ -417,7 +417,7 @@ LOOPDEV=$(sudo losetup --show -f $TMP_IMAGE_PATH) export EXTRA_UNMOUNT="detach_loopback $LOOPDEV" export IMAGE_BLOCK_DEVICE=$LOOPDEV eval_run_d block-device "IMAGE_BLOCK_DEVICE=" -sudo mkfs $MKFS_OPTS -t $FS_TYPE -L ${DIB_ROOT_LABEL} ${IMAGE_BLOCK_DEVICE} +sudo mkfs -t $FS_TYPE $MKFS_OPTS -L ${DIB_ROOT_LABEL} ${IMAGE_BLOCK_DEVICE} # Tuning the rootfs uuid works only for ext filesystems. if echo "$FS_TYPE" | grep -q "^ext"; then sudo tune2fs -U ${DIB_IMAGE_ROOT_FS_UUID} ${IMAGE_BLOCK_DEVICE} diff --git a/doc/source/user_guide/building_an_image.rst b/doc/source/user_guide/building_an_image.rst index 8137fd00..16dccc11 100644 --- a/doc/source/user_guide/building_an_image.rst +++ b/doc/source/user_guide/building_an_image.rst @@ -58,18 +58,25 @@ formats are: Filesystem Caveat ----------------- -By default, disk-image-create uses a 4k byte-to-inode ratio when creating the -filesystem in the image. This allows large 'whole-system' images to utilize -several TB disks without exhausting inodes. In contrast, when creating images -intended for tenant instances, this ratio consumes more disk space than an -end-user would expect (e.g. a 50GB root disk has 47GB avail.). If the image is -intended to run within a tens to hundrededs of gigabyte disk, setting the -byte-to-inode ratio to the ext4 default of 16k will allow for more usable space -on the instance. The default can be overridden by passing --mkfs-options like -this:: +By default, disk-image-create uses a 4k byte-to-inode ratio when +creating the filesystem in the image. This allows large 'whole-system' +images to utilize several TB disks without exhausting inodes. In +contrast, when creating images intended for tenant instances, this +ratio consumes more disk space than an end-user would expect (e.g. a +50GB root disk has 47GB avail.). If the image is intended to run +within a tens to hundrededs of gigabyte disk, setting the +byte-to-inode ratio to the ext4 default of 16k will allow for more +usable space on the instance. The default can be overridden by passing +``--mkfs-options`` like this:: disk-image-create --mkfs-options '-i 16384' vm +You can also select a different filesystem by setting the ``FS_TYPE`` +environment variable. + +Note ``--mkfs-options`` are options passed to the mfks *driver*, +rather than ``mkfs`` itself (i.e. after the initial `-t` argument). + Speedups -------- If you have 4GB of available physical RAM (as reported by /proc/meminfo From 6278371eaa13352249e385ab62aff99544e03659 Mon Sep 17 00:00:00 2001 From: Gregory Haynes Date: Wed, 7 Dec 2016 12:26:43 -0800 Subject: [PATCH 11/22] Make dib-python use the default python for distro Right now dib-python works by trying to find any python on a system in an order of precedence. A much better way is if we are explicit about the python we intend to be there which will allow us to make better decisions in other elements (such as allowing for package-installs to take into account DIB_PYTHON_VERSION) as well as allow for users to specify a preferred python version. Co-Authored-By: Adam Harwell Change-Id: Ie609de51cc5fcde701296c9474e315981d9778a2 --- elements/debian-minimal/element-deps | 1 + .../root.d/75-debian-minimal-baseinstall | 11 ++++++++- elements/dib-python/README.rst | 3 +++ .../environment.d/50-dib-python-version | 24 +++++++++++++++++++ .../dib-python/pre-install.d/01-dib-python | 4 ++-- .../root.d/75-ubuntu-minimal-baseinstall | 11 ++++++++- 6 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 elements/dib-python/environment.d/50-dib-python-version diff --git a/elements/debian-minimal/element-deps b/elements/debian-minimal/element-deps index 4867362b..158afb10 100644 --- a/elements/debian-minimal/element-deps +++ b/elements/debian-minimal/element-deps @@ -1,2 +1,3 @@ debootstrap +dib-python pkg-map diff --git a/elements/debian-minimal/root.d/75-debian-minimal-baseinstall b/elements/debian-minimal/root.d/75-debian-minimal-baseinstall index f12774d1..7c967e69 100755 --- a/elements/debian-minimal/root.d/75-debian-minimal-baseinstall +++ b/elements/debian-minimal/root.d/75-debian-minimal-baseinstall @@ -54,4 +54,13 @@ $apt_get update $apt_get clean $apt_get dist-upgrade -y -$apt_get install -y busybox python sudo +$apt_get install -y busybox sudo + +if [ "$DIB_PYTHON_VERSION" == "2" ]; then + $apt_get install -y python +elif [ "$DIB_PYTHON_VERSION" == "3" ]; then + $apt_get install -y python3 +else + echo "ERROR: DIB_PYTHON_VERSION is '$DIB_PYTHON_VERSION' but needs to be 2 or 3" + exit 1 +fi diff --git a/elements/dib-python/README.rst b/elements/dib-python/README.rst index 980f146d..974a8559 100644 --- a/elements/dib-python/README.rst +++ b/elements/dib-python/README.rst @@ -7,3 +7,6 @@ or python3 executable. This is useful for creating #! lines for scripts that are compatible with both python2 and python3. This does not install a python if one does not exist, and instead fails. + +This also exports a variable DIB_PYTHON_VERSION which will either be '2' or +'3' depending on the python version which dib-python points to. diff --git a/elements/dib-python/environment.d/50-dib-python-version b/elements/dib-python/environment.d/50-dib-python-version new file mode 100644 index 00000000..82196b37 --- /dev/null +++ b/elements/dib-python/environment.d/50-dib-python-version @@ -0,0 +1,24 @@ +# Pick which distros we need to force python2 +if [ -z "${DIB_PYTHON_VERSION:-}" ]; then + if [ "$DISTRO_NAME" == "ubuntu" ]; then + if [ "$DIB_RELEASE" == "trusty" ]; then + DIB_PYTHON_VERSION=2 + fi + elif [ "$DISTRO_NAME" == "debian" ]; then + DIB_PYTHON_VERSION=2 + elif [ "$DISTRO_NAME" == "fedora" ]; then + if [ "$DIB_RELEASE" -le 22 ]; then + DIB_PYTHON_VERSION=2 + fi + elif [ "$DISTRO_NAME" == "centos" ]; then + DIB_PYTHON_VERSION=2 + elif [ "$DISTRO_NAME" == "centos7" ]; then + DIB_PYTHON_VERSION=2 + fi +fi + +if [ -z "${DIB_PYTHON_VERSION:-}" ]; then + DIB_PYTHON_VERSION=3 +fi + +export DIB_PYTHON_VERSION diff --git a/elements/dib-python/pre-install.d/01-dib-python b/elements/dib-python/pre-install.d/01-dib-python index 2b3f7638..bf4d1c81 100755 --- a/elements/dib-python/pre-install.d/01-dib-python +++ b/elements/dib-python/pre-install.d/01-dib-python @@ -6,9 +6,9 @@ fi set -eu set -o pipefail -python_path=$(command -v python2 || command -v python3) +python_path=$(command -v python${DIB_PYTHON_VERSION}) if [ -z "$python_path" ]; then - echo "Could not find python2 or python3 executable." + echo "Could not find python${DIB_PYTHON_VERSION} executable." exit 1 fi diff --git a/elements/ubuntu-minimal/root.d/75-ubuntu-minimal-baseinstall b/elements/ubuntu-minimal/root.d/75-ubuntu-minimal-baseinstall index 6e6de8a0..35938995 100755 --- a/elements/ubuntu-minimal/root.d/75-ubuntu-minimal-baseinstall +++ b/elements/ubuntu-minimal/root.d/75-ubuntu-minimal-baseinstall @@ -43,4 +43,13 @@ $apt_get update $apt_get clean $apt_get dist-upgrade -y -$apt_get install -y busybox python sudo +$apt_get install -y busybox sudo + +if [ "$DIB_PYTHON_VERSION" == "2" ]; then + $apt_get install -y python +elif [ "$DIB_PYTHON_VERSION" == "3" ]; then + $apt_get install -y python3 +else + echo "ERROR: DIB_PYTHON_VERSION is '$DIB_PYTHON_VERSION' but needs to be 2 or 3" + exit 1 +fi From bf5af6155c43c3c764dd74e5ad6d387a0a1a0a62 Mon Sep 17 00:00:00 2001 From: Ben Nemec Date: Mon, 12 Dec 2016 10:55:03 -0600 Subject: [PATCH 12/22] Don't set the executable bit on dhcp-interface@.service systemd doesn't like it when service files have the executable bit so this causes it to spam the journal with messages like: Configuration file /usr/lib/systemd/system/dhcp-interface@.service is marked executable. Please remove executable permission bits. Proceeding anyway. Removing the executable bit from the install permissions should eliminate those messages. Change-Id: Ie1bc39465b3fcb55dcda5cee9e46a128a6ccffcb --- elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces b/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces index f8e7a14e..972645a7 100755 --- a/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces +++ b/elements/dhcp-all-interfaces/install.d/50-dhcp-all-interfaces @@ -22,7 +22,7 @@ if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.conf /etc/init/dhcp-all-interfaces.conf fi elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; then - install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-interface@.service /usr/lib/systemd/system/dhcp-interface@.service + install -D -g root -o root -m 0644 ${SCRIPTDIR}/dhcp-interface@.service /usr/lib/systemd/system/dhcp-interface@.service install -D -g root -o root -m 0644 ${SCRIPTDIR}/dhcp-all-interfaces-udev.rules /etc/udev/rules.d/99-dhcp-all-interfaces.rules elif [ "$DIB_INIT_SYSTEM" == "sysv" ]; then install -D -g root -o root -m 0755 ${SCRIPTDIR}/dhcp-all-interfaces.init /etc/init.d/dhcp-all-interfaces From 6ddbb457d642fc8bee3cfb441b1f2376ccae0d38 Mon Sep 17 00:00:00 2001 From: Gregory Haynes Date: Wed, 7 Dec 2016 11:58:05 -0800 Subject: [PATCH 13/22] Move pip-and-virtualenv source install to 10- We currently have this as a 01- script which causes it to race with package-installs (the deps are installed after the script runs). Change-Id: I7b04b4c186eaae783b8e2bda1aa724c0d7823eab --- .../{01-install-pip => 10-install-pip} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/{01-install-pip => 10-install-pip} (100%) diff --git a/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/01-install-pip b/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/10-install-pip similarity index 100% rename from elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/01-install-pip rename to elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/10-install-pip From c3293b3f7e1792ffec9c508b24e4ee45ecf1c7e1 Mon Sep 17 00:00:00 2001 From: Gregory Haynes Date: Thu, 8 Dec 2016 19:40:08 -0800 Subject: [PATCH 14/22] Disable centos6 testing Centos6 is no longer reasonable to expect to function with openstack, and infra does not host a mirror for it. Change-Id: I95ccf5840807fee73d6e78d596c82709e476bb3a --- tests/run_functests.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/run_functests.sh b/tests/run_functests.sh index 84b6d38e..2e9ea444 100755 --- a/tests/run_functests.sh +++ b/tests/run_functests.sh @@ -23,6 +23,8 @@ DEFAULT_SKIP_TESTS=( debian-minimal/testing-build-succeeds # Currently failing due to bug in locale generation centos-minimal/build-succeeds + # No longer reasonable to test upstream (lacks a mirror in infra) + centos/build-succeeds ) function log_with_prefix { From a1dfe505eaa7ef19f9a4aebac3b453a2e3b01226 Mon Sep 17 00:00:00 2001 From: Gregory Haynes Date: Wed, 7 Dec 2016 10:04:24 -0800 Subject: [PATCH 15/22] Add install-types as pip-and-virtualenv dep This element supports install-types so we need to depend on it. Change-Id: Ib1193673ca1c1a1cafe0006eabef981a01c87781 --- elements/pip-and-virtualenv/element-deps | 1 + 1 file changed, 1 insertion(+) diff --git a/elements/pip-and-virtualenv/element-deps b/elements/pip-and-virtualenv/element-deps index 73d637d4..ff8ad3ed 100644 --- a/elements/pip-and-virtualenv/element-deps +++ b/elements/pip-and-virtualenv/element-deps @@ -1,2 +1,3 @@ +install-types package-installs source-repositories From ecae8dcbd5f7308a1381e03fe83251a7b92af3a4 Mon Sep 17 00:00:00 2001 From: Gregory Haynes Date: Wed, 7 Dec 2016 12:34:11 -0800 Subject: [PATCH 16/22] Allow package-installs to parse DIB_PYTHON_VERSION Now that we are explicit about what python version we intend to use for dib we can have package installs optionally install packages depending on this. Add a new dib_python_version that matches on the DIB_PYTHON_VERSION string set by dib-python. Co-Authored-By: Adam Harwell Change-Id: I70659aab7d12924bdb9bc0489a7f02d5fd0dbb39 --- elements/package-installs/README.rst | 5 +++++ elements/package-installs/bin/package-installs-squash | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/elements/package-installs/README.rst b/elements/package-installs/README.rst index 8d102736..9b453c7c 100644 --- a/elements/package-installs/README.rst +++ b/elements/package-installs/README.rst @@ -26,6 +26,10 @@ example ``package-installs.yaml`` not-arch: ppc64, ppc64le lshw: arch: ppc64, ppc64le + python-dev: + dib_python_version: 2 + python3-dev: + dib_python_version: 3 example package-installs.json @@ -46,6 +50,7 @@ the following default values:: uninstall: False installtype: * (Install package for all installtypes) arch: * (Install package for all architectures) + dib_python_version: (2 or 3 depending on DIB_PYTHON_VERSION, see dib-python) Setting the installtype property causes the package only to be installed if the specified installtype would be used for the element. See the diff --git a/elements/package-installs/bin/package-installs-squash b/elements/package-installs/bin/package-installs-squash index 49cc7648..eafdd9f4 100755 --- a/elements/package-installs/bin/package-installs-squash +++ b/elements/package-installs/bin/package-installs-squash @@ -75,8 +75,12 @@ def collect_data(data, filename, element_name): installtype == elem_installtype) valid_arch = _valid_for_arch(pkg_name, params.get('arch', None), params.get('not-arch', None)) + dib_py_version = str(params.get('dib_python_version', '')) + dib_py_version_env = os.environ.get('DIB_PYTHON_VERSION', '') + valid_dib_python_version = (dib_py_version == '' or + dib_py_version == dib_py_version_env) - if valid_installtype and valid_arch: + if valid_installtype and valid_arch and valid_dib_python_version: data[phase][install].append((pkg_name, element_name)) return data From 3e777cd8f4e7237151f71637a0ef8230692b96ae Mon Sep 17 00:00:00 2001 From: Gregory Haynes Date: Tue, 6 Dec 2016 13:51:13 -0800 Subject: [PATCH 17/22] Fix pip-and-virtualenv to work with python3 We are explicitly calling python in this element which does not work on systems which only have python3. Change-Id: Ia730850a48e2478fd5461710a9d2619408725cd8 --- elements/pip-and-virtualenv/element-deps | 1 + .../10-install-pip | 4 ++-- elements/pip-and-virtualenv/package-installs.yaml | 15 +++++++++++++++ elements/pip-and-virtualenv/pkg-map | 13 ++++++++++--- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/elements/pip-and-virtualenv/element-deps b/elements/pip-and-virtualenv/element-deps index ff8ad3ed..cb38be3c 100644 --- a/elements/pip-and-virtualenv/element-deps +++ b/elements/pip-and-virtualenv/element-deps @@ -1,3 +1,4 @@ +dib-python install-types package-installs source-repositories diff --git a/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/10-install-pip b/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/10-install-pip index 4efd1a21..704fa338 100755 --- a/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/10-install-pip +++ b/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/10-install-pip @@ -19,7 +19,7 @@ if [[ $DISTRO_NAME =~ (centos|fedora) ]]; then ${YUM:-yum} install -y python-virtualenv python-pip python-setuptools # install pip; this overwrites packaged pip - python /tmp/get-pip.py + /usr/local/bin/dib-python /tmp/get-pip.py # pip and setuptools are closely related; we want to ensure the # latest for sanity. Because distro packages don't include enough @@ -50,6 +50,6 @@ if [[ $DISTRO_NAME =~ (centos|fedora) ]]; then fi echo "exclude=python-virtualenv,python-pip,python-setuptools" >> ${conf} else - python /tmp/get-pip.py + /usr/local/bin/dib-python /tmp/get-pip.py pip install virtualenv fi diff --git a/elements/pip-and-virtualenv/package-installs.yaml b/elements/pip-and-virtualenv/package-installs.yaml index 6d38d160..6b62929c 100644 --- a/elements/pip-and-virtualenv/package-installs.yaml +++ b/elements/pip-and-virtualenv/package-installs.yaml @@ -2,7 +2,22 @@ # early enough because pip depends on it. python-xml: phase: pre-install.d + dib_python_version: 2 python-pip: installtype: package + dib_python_version: 2 +python3-pip: + installtype: package + dib_python_version: 3 python-virtualenv: installtype: package + dib_python_version: 2 +python3-virtualenv: + installtype: package + dib_python_version: 3 +python-dev: + installtype: source + dib_python_version: 2 +python3-dev: + installtype: source + dib_python_version: 3 diff --git a/elements/pip-and-virtualenv/pkg-map b/elements/pip-and-virtualenv/pkg-map index 508fd004..09e1529f 100644 --- a/elements/pip-and-virtualenv/pkg-map +++ b/elements/pip-and-virtualenv/pkg-map @@ -2,10 +2,17 @@ "family": { "gentoo": { "python-pip": "dev-python/pip", - "python-virtualenv": "dev-python/virtualenv" + "python-virtualenv": "dev-python/virtualenv", + "python3-dev": "dev-lang/python" }, - "suse" : { - "python-xml": "python-xml" + "suse": { + "python-xml": "python-xml", + "python2-dev": "python2-devel", + "python3-dev": "python3-devel" + }, + "redhat": { + "python2-dev": "python2-devel", + "python3-dev": "python3-devel" } }, "default": { From 339ecee2b20e88f348b8e9fffc26cadc204f82a5 Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Wed, 14 Dec 2016 09:38:22 +0000 Subject: [PATCH 18/22] elements: dib-python: Add python2 as the default version for openSUSE Commit 6278371eaa13("Make dib-python use the default python for distro") added default python version for various distros but it missed openSUSE which leads to build failures since the openSUSE elements are pulling python2 packages. Add openSUSE to the list of python2 distributions until python3 support for the openSUSE elements is in place. Change-Id: I95f1fa849a22607c430387a2a915f9d19c9c209f --- elements/dib-python/environment.d/50-dib-python-version | 2 ++ 1 file changed, 2 insertions(+) diff --git a/elements/dib-python/environment.d/50-dib-python-version b/elements/dib-python/environment.d/50-dib-python-version index 82196b37..14fed853 100644 --- a/elements/dib-python/environment.d/50-dib-python-version +++ b/elements/dib-python/environment.d/50-dib-python-version @@ -14,6 +14,8 @@ if [ -z "${DIB_PYTHON_VERSION:-}" ]; then DIB_PYTHON_VERSION=2 elif [ "$DISTRO_NAME" == "centos7" ]; then DIB_PYTHON_VERSION=2 + elif [ "$DISTRO_NAME" == "opensuse" ]; then + DIB_PYTHON_VERSION=2 fi fi From 280896759a8978900f6b7d95dad9aff92548f146 Mon Sep 17 00:00:00 2001 From: Peter Stachowski Date: Wed, 14 Dec 2016 20:27:44 +0000 Subject: [PATCH 19/22] Pip install as 10- incompatible with 05-heat-cfntools Tripleo-image-elements have an install.d file '05-heat-cfntools' that runs the following command: virtualenv --setuptools $VENV With the recent change to diskimage-builder (moving the install of pip and virtualenv to the 10- range) virtualenv is no longer available for this elementr; as a side-effect, the trove kick-start command is now broken and gate jobs are failing. The solutions is to move the (now) 10-install-pip to 04-install-pip. This should still alleviate the race condition that https://review.openstack.org/#/c/408277/ attempted to fix, as all *-package-installs files are 00-, 01- or 02-. Change-Id: Ia4e01f00c4c5e9a2087df1e2a91d9154480a0422 Closes-Bug: #1650008 --- elements/pip-and-virtualenv/README.rst | 3 +++ .../{10-install-pip => 04-install-pip} | 0 2 files changed, 3 insertions(+) rename elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/{10-install-pip => 04-install-pip} (100%) diff --git a/elements/pip-and-virtualenv/README.rst b/elements/pip-and-virtualenv/README.rst index 5516ed0d..db8f4acb 100644 --- a/elements/pip-and-virtualenv/README.rst +++ b/elements/pip-and-virtualenv/README.rst @@ -10,3 +10,6 @@ from get-pip.py and pip (respectively). To install pip and virtualenv from package: export DIB_INSTALLTYPE_pip_and_virtualenv=package + +Any element that uses these commands must be designated as +05-* or higher to ensure that they are first installed. diff --git a/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/10-install-pip b/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip similarity index 100% rename from elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/10-install-pip rename to elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip From a72645f43110ce820c4b047bd8315ca180d1d336 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Thu, 15 Dec 2016 17:07:04 +1100 Subject: [PATCH 20/22] Recreate initramfs within loopback image dracut has a loop [1] where it probes top-level directories, tries to find what block device they are on, then determines the file-system of that block device. It then puts those file-system modules into the initramfs for boot. Since we install the kernel package during the chroot phase, / there is not a block device and thus this loop matches nothing and we end up with no file-system modules in the initramfs. This results in a very annoying silent boot hang. By moving re-generation of dracut into finalise.d phase, we run inside the final image where / is the loop-device; the root file-system gets detected correctly and the ext4 module is included correctly. [1] http://git.kernel.org/cgit/boot/dracut/dracut.git/tree/dracut.sh?h=RHEL-7#n1041 Change-Id: Iaf2a1e8470f642bfaaaad3f9b7f26cfc8cc445c9 Signed-off-by: Paul Belanger --- elements/yum-minimal/finalise.d/55-dracut-recreate | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 elements/yum-minimal/finalise.d/55-dracut-recreate diff --git a/elements/yum-minimal/finalise.d/55-dracut-recreate b/elements/yum-minimal/finalise.d/55-dracut-recreate new file mode 100755 index 00000000..477e93ec --- /dev/null +++ b/elements/yum-minimal/finalise.d/55-dracut-recreate @@ -0,0 +1,12 @@ +#!/bin/bash + +# Recreate the initramfs within the loop device so everything gets +# picked up correctly. + +if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then + set -x +fi +set -eu +set -o pipefail + +dracut --regenerate-all --force --verbose From 6d8254368211c66e8f2b9d125a9ae59b0de18405 Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Fri, 16 Dec 2016 11:27:10 -0500 Subject: [PATCH 21/22] Add ubuntu-precise support to dib-python Change-Id: I2796da88d839ed49ec28ae7b139ede04af51f068 Signed-off-by: Paul Belanger --- elements/dib-python/environment.d/50-dib-python-version | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/elements/dib-python/environment.d/50-dib-python-version b/elements/dib-python/environment.d/50-dib-python-version index 14fed853..27331dbd 100644 --- a/elements/dib-python/environment.d/50-dib-python-version +++ b/elements/dib-python/environment.d/50-dib-python-version @@ -1,7 +1,9 @@ # Pick which distros we need to force python2 if [ -z "${DIB_PYTHON_VERSION:-}" ]; then if [ "$DISTRO_NAME" == "ubuntu" ]; then - if [ "$DIB_RELEASE" == "trusty" ]; then + if [ "$DIB_RELEASE" == "precise" ]; then + DIB_PYTHON_VERSION=2 + elif [ "$DIB_RELEASE" == "trusty" ]; then DIB_PYTHON_VERSION=2 fi elif [ "$DISTRO_NAME" == "debian" ]; then From f6a02fbdb961aa19460bd7f351c21279f71034d2 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Fri, 16 Dec 2016 11:10:23 +1100 Subject: [PATCH 22/22] Install dracut-generic-config package dracut has a "hostonly" mode where it builds an initramfs that is suitable for booting the system it is building on. This is on by default, but obviously in our nested multi-platform chroot situation this is fraught with danger. As highlighted by [1] our builds were inadvertently turning off "hostonly" mode when the mountpoints in the chroot were not found. The CentOS 7.3 behaviour change broke this and we ended up with an initramfs with no file-system modules. Iaf2a1e8470f642bfaaaad3f9b7f26cfc8cc445c9 introduced a regeneration of the initramfs, which I think does work as described because it runs in the loopback device. However, dracut includes a package that installs configuration overrides to build a generic initramfs. This is really what we want, and should solve the problem no matter where the initramfs is created. Add this package into yum-minimal and remove the extra re-create call which should not be necessary. [1] https://bugzilla.redhat.com/show_bug.cgi?id=1405238 Change-Id: I5d203f2abe743cb23a44d449850e692a948e7871 --- elements/yum-minimal/finalise.d/55-dracut-recreate | 12 ------------ elements/yum-minimal/package-installs.yaml | 1 + 2 files changed, 1 insertion(+), 12 deletions(-) delete mode 100755 elements/yum-minimal/finalise.d/55-dracut-recreate diff --git a/elements/yum-minimal/finalise.d/55-dracut-recreate b/elements/yum-minimal/finalise.d/55-dracut-recreate deleted file mode 100755 index 477e93ec..00000000 --- a/elements/yum-minimal/finalise.d/55-dracut-recreate +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Recreate the initramfs within the loop device so everything gets -# picked up correctly. - -if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then - set -x -fi -set -eu -set -o pipefail - -dracut --regenerate-all --force --verbose diff --git a/elements/yum-minimal/package-installs.yaml b/elements/yum-minimal/package-installs.yaml index b7cf1e36..8bafc7cd 100644 --- a/elements/yum-minimal/package-installs.yaml +++ b/elements/yum-minimal/package-installs.yaml @@ -1,5 +1,6 @@ audit: dracut: +dracut-config-generic: grubby: kernel: initscripts: