From 9a56d250975481d26ea564e29c77ecc003d14025 Mon Sep 17 00:00:00 2001 From: Jeff Peeler Date: Sep 16 2013 19:02:06 +0000 Subject: Add patch to allow proper Fedora image creation when using vm element --- diff --git a/0001-Set-raw-image-size-to-be-multiple-of-64k.patch b/0001-Set-raw-image-size-to-be-multiple-of-64k.patch index 46aaa2f..cd4e4b7 100644 --- a/0001-Set-raw-image-size-to-be-multiple-of-64k.patch +++ b/0001-Set-raw-image-size-to-be-multiple-of-64k.patch @@ -1,7 +1,7 @@ From e8c73cde4944492dfaab07e0bf1848486bba4f31 Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Sun, 8 Sep 2013 01:03:19 +0100 -Subject: [PATCH 1/4] Set raw image size to be multiple of 64k +Subject: [PATCH 1/5] Set raw image size to be multiple of 64k This works around a bug in qemu-img causing it to sometimes error if compressing a raw image that isn't a multiple of 64k (the qcow2 diff --git a/0002-Add-package-mapping-for-default-jre.patch b/0002-Add-package-mapping-for-default-jre.patch index 2d4bbcc..0dc4b16 100644 --- a/0002-Add-package-mapping-for-default-jre.patch +++ b/0002-Add-package-mapping-for-default-jre.patch @@ -1,7 +1,7 @@ From 43b96d91c2561312c09b6278d12b62d4f2ce887c Mon Sep 17 00:00:00 2001 From: Matthew Farrellee Date: Tue, 10 Sep 2013 20:01:21 -0400 -Subject: [PATCH 2/4] Add package mapping for default-jre +Subject: [PATCH 2/5] Add package mapping for default-jre Change-Id: Idffbc84ea2afaf2584c1bb79729c3e0cf52b851e --- diff --git a/0003-Fixes-files-ordering-when-choosing-newest-image.patch b/0003-Fixes-files-ordering-when-choosing-newest-image.patch index 4d2bad5..df45289 100644 --- a/0003-Fixes-files-ordering-when-choosing-newest-image.patch +++ b/0003-Fixes-files-ordering-when-choosing-newest-image.patch @@ -1,7 +1,7 @@ From 0eaddbd214fa03f2a4a4041686c7ca62a21e4941 Mon Sep 17 00:00:00 2001 From: Jan Provaznik Date: Thu, 12 Sep 2013 11:26:57 +0200 -Subject: [PATCH 3/4] Fixes files ordering when choosing newest image +Subject: [PATCH 3/5] Fixes files ordering when choosing newest image For example if there are following kernels in undercloud/overcloud image: diff --git a/0004-Remove-r-option-from-kpartx-for-successful-build.patch b/0004-Remove-r-option-from-kpartx-for-successful-build.patch index d48d056..ea843fe 100644 --- a/0004-Remove-r-option-from-kpartx-for-successful-build.patch +++ b/0004-Remove-r-option-from-kpartx-for-successful-build.patch @@ -1,7 +1,7 @@ From ccd7b86b606e678bf7281baff05c420b089c5d8f Mon Sep 17 00:00:00 2001 From: Jeff Peeler Date: Thu, 12 Sep 2013 17:56:30 -0400 -Subject: [PATCH 4/4] Remove -r option from kpartx for successful build +Subject: [PATCH 4/5] Remove -r option from kpartx for successful build This option does not exist on RHEL hosts and matches what is currently present in elements/rhel/root.d/10-rhel-cloud-image. diff --git a/0005-Install-fedora-grub-from-cached-rpm-during-finalise.patch b/0005-Install-fedora-grub-from-cached-rpm-during-finalise.patch new file mode 100644 index 0000000..815bc87 --- /dev/null +++ b/0005-Install-fedora-grub-from-cached-rpm-during-finalise.patch @@ -0,0 +1,70 @@ +From 9ba761ef27a3ac53588394d2ebbee59e6d7e5ed7 Mon Sep 17 00:00:00 2001 +From: Steve Baker +Date: Sun, 15 Sep 2013 06:06:08 +1200 +Subject: [PATCH 5/5] Install fedora grub from cached rpm during finalise + +When uninstalling grub2, leave all its dependencies +including grub2-tools installed to minimise the number of packages +which need to be installed in the finalise stage. + +Since the yum cache is unmounted during finalise, installing +grub2 in finalise is slowed by re-populating the yum cache. + +This change copies the grub2 rpm out of the yum cache so it can be installed +from file during finalise. + +This should prevent disk becoming full during finalise on Fedora. + +Closes-Bug: #1217185 + +Change-Id: If095adc4abb52a19a3aa0b1caebfb3e4d8f605ef +--- + elements/fedora/pre-install.d/15-fedora-remove-grub | 13 ++++++++++++- + elements/vm/finalise.d/51-bootloader | 7 ++++++- + 2 files changed, 18 insertions(+), 2 deletions(-) + +diff --git a/elements/fedora/pre-install.d/15-fedora-remove-grub b/elements/fedora/pre-install.d/15-fedora-remove-grub +index 8c83ab8..5541e76 100755 +--- a/elements/fedora/pre-install.d/15-fedora-remove-grub ++++ b/elements/fedora/pre-install.d/15-fedora-remove-grub +@@ -2,7 +2,18 @@ + + set -e + +-yum remove -y grub2-tools ++yum remove -y grub2 ++# Install grub2 dependencies to minimise packages installed during finalise. ++install-packages grub2-tools gettext os-prober system-logos ++ ++# Ensure grub2 rpm is in the yum cache ++install-packages -d grub2 ++ ++# Copy grub2 rpm out of mounted yum cache for install during finalise ++mkdir /tmp/grub ++basearch=$(cat /etc/yum/vars/basearch) ++cp $(find /tmp/yum/$basearch -regex ".*/grub2-[0-9].*\.rpm") /tmp/grub ++echo "rpm -i /tmp/grub/*.rpm" > /tmp/grub/install + + #GRUB_CFG=/boot/grub2/grub.cfg + +diff --git a/elements/vm/finalise.d/51-bootloader b/elements/vm/finalise.d/51-bootloader +index 412ecd1..891dc39 100755 +--- a/elements/vm/finalise.d/51-bootloader ++++ b/elements/vm/finalise.d/51-bootloader +@@ -53,7 +53,12 @@ _EOF_ + + function install_grub2 { + +- install-packages grub-pc ++ # Check for offline installation of grub ++ if [ -f "/tmp/grub/install" ] ; then ++ source /tmp/grub/install ++ else ++ install-packages grub-pc ++ fi + + # XXX: grub-probe on the nbd0/loop0 device returns nothing - workaround, manually + # specify modules. https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1073731 +-- +1.8.1.4 + diff --git a/diskimage-builder.spec b/diskimage-builder.spec index 9906265..f2ded01 100644 --- a/diskimage-builder.spec +++ b/diskimage-builder.spec @@ -1,7 +1,7 @@ Name: diskimage-builder Summary: Image building tools for OpenStack Version: 0.0.1 -Release: 6%{?dist} +Release: 7%{?dist} License: ASL 2.0 Group: System Environment/Base URL: https://launchpad.net/diskimage-builder @@ -11,6 +11,7 @@ Patch1: 0001-Set-raw-image-size-to-be-multiple-of-64k.patch Patch2: 0002-Add-package-mapping-for-default-jre.patch Patch3: 0003-Fixes-files-ordering-when-choosing-newest-image.patch Patch4: 0004-Remove-r-option-from-kpartx-for-successful-build.patch +Patch5: 0005-Install-fedora-grub-from-cached-rpm-during-finalise.patch BuildArch: noarch BuildRequires: python2-devel @@ -29,6 +30,7 @@ Requires: curl %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 %build %{__python} setup.py build @@ -57,6 +59,9 @@ Components of TripleO that are responsible for building disk images. %{_datadir}/%{name}/elements %changelog +* Mon Sep 16 2013 Jeff Peeler 0.0.1-7 +- add patch to allow proper Fedora image creation when using vm element + * Fri Sep 13 2013 Jeff Peeler 0.0.1-6 - add patches to ccd7b86b606e678bf7281baff05c420b089c5d8f (fixes kpartx issue)