Commit Graph

689 Commits

Author SHA1 Message Date
Robert Collins
c7d80ddeed Cleanup mount points automatically.
Manually listing the mount points that need cleanup is not
maintainable and makes it hard to write elements that use bind
mounting to inject resources into the build environment.

Change-Id: I7c9ade444f4ebe42552f8e321f257a7ec0a674ef
2013-08-09 22:53:32 +12:00
Derek Higgins
a5806cd482 Change the rootfs label in F18 and F19
The images produced by the diskimage-builder have their filesystem with
a label of "cloudimg-rootfs", The regex changing fstab on fedora didn't
match the F19 case.

This regex matches both
F18 :
LABEL=_/   /         ext4    defaults        1 1
F19 :
UUID=f2da0fc8-2e12-4a6e-8e95-a31a474aa1a8 / ext4 defaults,noatime 0 0

Change-Id: Iafcf5e069199f1df76874309b2d5064f343fb5e5
2013-08-07 09:57:21 +01:00
Jenkins
39d4d9b941 Merge "Remove explicit sudoers requirement." 2013-08-06 20:57:33 +00:00
Jenkins
585a155d17 Merge "Document the dangers of co-existing elements." 2013-08-06 20:55:50 +00:00
Chris Jones
357c2de681 Remove explicit sudoers requirement.
Most of our build process runs as root and the overhead of explicitly
tracking sudo commands in the shipped sudoers.d file, plus the
operational overhead of keeping the sudoers.d file updated on build
hosts over time, is now considered to be unnecessary.
Instead, we now document that the build process will expect sudo
commands to work and the operator must make this happen (either by
running as root, via sudo -E, or allowing passwordless sudo for the
build user).

Change-Id: If2628e7d0c7efde0fb99c84a217523ba29b1b38d
2013-08-06 16:08:35 +12:00
Chris Jones
3708e40051 Document the dangers of co-existing elements.
Add a potent example (and simply remedy) of how element authors can
unwittingly conflict with each other in ways that it is almost
impossible for us to guard against with low level policy/mechanism in
di-b. Fixes bug 1181309.

Change-Id: I51e845065702911371e448521327143495c3b405
2013-08-06 16:07:09 +12:00
Robert Collins
bcad3737e8 Blacklist H803
H803 isn't supported by community consensus. Blacklist it to avoid
breaking folk's muscle memory.

Change-Id: I8eea9eb2562e12136018e762c8a5e23527fcf48f
2013-08-06 13:59:13 +12:00
Robert Collins
c7c4ec19a3 Capture the repositories from source-repositories.
We try to expose metadata to users about what dib included in the
image and source-repositories was not doing that, so this fixes it. It
also permits easy introspection from other elements (such as an
upcoming PyPI cache layer).

Change-Id: I1e48e65f69ebe1f4556cc3bf35ccf195e99bcc76
2013-08-05 09:52:28 +12:00
Robert Collins
950fa15d64 Improve caching documentation.
It was a little weak, and folk need enough detail to reason about
performance.

Change-Id: I67f81ab5a206b3d42dd1e4e1eb52af88ac1a3adc
2013-08-02 22:48:51 +12:00
Steve Baker
7795c7b108 Package with pbr.
Uses pbr-0.5.20 glob support to install elements, lib and scripts.

Change-Id: Ie466e753f6e75a943ced1a2939c9bb27aec4a6b0
2013-08-02 12:32:25 +12:00
Derek Higgins
4651913e55 Add a new break on error
A user running di-b several times while developing an element may not
want to drop to a shell in all cases but may only want to do so if one
of their in target hooks failed.

This patch gives them the ability to do so, If break=after-error is set
then a user will be provided a in target shell taking over from where the
last failed command left off.

Change-Id: Ia2f7ac4c21b64b971f87f4ae9cb867981b13eb5e
2013-08-01 17:08:54 +01:00
Jenkins
4284936084 Merge "Ensure $TMP_BUILD_DIR is actually created." 2013-08-01 00:41:52 +00:00
Jenkins
9233ca4056 Merge "Enable running disk-image-create on SUSE Linux" 2013-08-01 00:36:36 +00:00
James Slagle
de6efe2b2c Ensure $TMP_BUILD_DIR is actually created.
Previously if mktemp failed in function mk_build_dir, die was not
called.  The check for the exit code was actually checking that the
previous export statement completed successfully, not the call to
mktemp.

Change-Id: I477a2ce75c87c8167883ce7aa342e93c40770e29
2013-07-31 14:26:05 -04:00
Jenkins
5b37036c88 Merge "Modify relative paths of lib, elements for packaging" 2013-07-31 11:04:03 +00:00
Jeff Peeler
87fb533979 Modify relative paths of lib, elements for packaging
(Based on review https://review.openstack.org/#/c/36009)

Scripts test for existence of ../share/diskimage-builder and
fall-back to ../ if not found. This allows scripts to run unmodified
from a packaged installation or a local archive/repository.

Change-Id: I0cf4c1fdb8e42ec284c56860cb15818632b93b9e
2013-07-31 13:15:33 +12:00
Jeff Peeler
6ac894cae6 Add binaries for setuptools
Binaries disk-image-create, disk-image-get-kernel, and
ramdisk-image-create were missing.

Change-Id: I1d9e25fe49d23e9e66fd2dcbde44e17505a3d7d7
2013-07-30 14:25:45 -04:00
Clint Byrum
5a69fa879e Make Ubuntu 13.04 (raring) the default release
Ubuntu 13.04 has been released now for 3 months. The updated libvirt,
openvswitch and kernel are all beneficial to various OpenStack components,
and many other software is updated beyond the versions in Ubuntu 12.10.

Change-Id: I358aed8bf906c3ff5103f19b1f9e6ac689b5d5ee
2013-07-29 17:02:23 -07:00
Jenkins
fb81fe8742 Merge "Provide hint for what package contains qemu-img" 2013-07-29 13:39:42 +00:00
Jenkins
45f32b4b82 Merge "Ignore emacs autosave files in source-repositories" 2013-07-29 05:04:12 +00:00
Jenkins
1146fe63fc Merge "Add needed symlink for Fedora deployment ramdisk." 2013-07-28 19:58:59 +00:00
Monty Taylor
4535c5323a Ignore emacs autosave files in source-repositories
source-repositories uses find to discover things it should import. If
someone happens to use emacs, and happens to have had an autosave file
in a directory with a wildly broken version of a source-repositories-
file, then dib will attempt to execute the contents of the autosave file
and the user will be sad. Adding a filter to the find command for files
ending in ~ will prevent pain and suffering.

Change-Id: I27c8a4b53d3c9b913ca926db16b4271941f6fb5d
2013-07-27 14:53:29 -04:00
Clint Byrum
f57e8c66c2 Provide hint for what package contains qemu-img
While following install instructions in README.md it should be more
clear how to install qemu-img on your system.

Change-Id: Ibb8828806bf46716b91b83a4eea696f4fe478206
2013-07-27 17:05:20 +00:00
Monty Taylor
6b74b65449 Fix hacking errors
As another step in aligning further with OpenStack practices, stop
ignoring the hacking style checks.

Change-Id: I16c9f0ca3be5790176467377303817249e7643ea
2013-07-27 12:17:02 -04:00
Monty Taylor
c179d9b04d Add downloadonly flag to fedora
devstack-gate needs to be able to make an image that has pre-downloaded
but not installed a sequence of packages. To support that, add a -d flag
to install-packages to allow downloading but not installing. -d passes
through on a dpkg install, and with this patch should be transformed
to --downloadonly which is the yum version.

Change-Id: Ia4e61fa4304df86afbee7dfc8067ea1bdf528f3e
2013-07-27 12:17:02 -04:00
Monty Taylor
36a46649ed Fixed up test-requirements
As a first step to OpenStack alignment, get test-requirements.txt in
line with current OpenStack standard practices.

Fixes: Bug #1205546
Change-Id: I899c3dc167df191b84008250671c58520c436a30
2013-07-27 12:16:52 -04:00
James Slagle
92fa96b2f6 Add needed symlink for Fedora deployment ramdisk.
Symlink /usr/lib -> ../lib for Fedora deployment ramdisk.  This
symlink is needed for systemd-udevd.  Otherwise, the network device is
not loaded and initialized when the deployment image is booted.  This
logic was previously contained in
elements/deploy/root.d/50-redhat-prepare-fs, but now that ramdisk
images are built in a chroot, the change needs to be moved so that it
is applied to the ramdisk build.

Change-Id: Icea43230126956ccf5fb8a6a96ca706b75d5c32f
2013-07-26 11:09:29 -04:00
Jenkins
b4a9fceea7 Merge "Install which on Fedora" 2013-07-26 13:51:13 +00:00
Derek Higgins
d8ba46f8e3 Install which on Fedora
Create an install hook where core utilities can be installed
on Fedora. In this case we are installing which.
Which is being used by
  ramdisk/post-install.d/01-ensure-binaries
  vm/finalise.d/51-grub
The absence to which caused the ramdisk build to fail on F19.

On Ubuntu which is installed with the package debianutils, this pretty
much has to exist on Ubuntu images, so a corresponding package install for
ubuntu isn't needed.

Fixes Bug 1202612

Change-Id: I847c1619cdab021c9348caed3fa32db64e663e8e
2013-07-26 11:04:58 +01:00
Derek Higgins
e79968f682 Only remove $TMP_BUILD_DIR on cleanup
During ramdisk cleanup if for some reason the filesystems mounted
in $TMP_BUILD_DIR were not removed this recursive delete ended up
deleting parts of the host filesystem that were mounted (in particular
most of the contents of /dev got removed.

This commit doesn't deal with the reason the filesystem didn't unmounted
but ensures the consequences are not as severe.

Fixes Bug 1202612

Change-Id: Id8eba0753c2fe76c79ae1d952ce690d26e33e3ed
2013-07-26 11:03:42 +01:00
Tim Serong
ee5ae03d58 Enable running disk-image-create on SUSE Linux
- Ensures /sbin and friends are in $PATH when invoked (without this,
  various sudo invocations fail in exciting ways).
- Use dib-run-parts in lib/common-functions instead of run-parts
  (neither SLES nor openSUSE ship run-parts).
- Ensure dib-run-parts doesn't descend into subdirectories (same
  behaviour as run-parts).
- Move dib-run-parts from root.d to bin (cleaner, consistent with
  other elements with separate bin scripts).
- Tested by building Ubuntu image on openSUSE 12.3.
- Note: this doesn't add support for creating SUSE images, it just
  lets you run disk-image-create on SUSE-based distros.

Change-Id: I906c6bc3cf51cdf2c4415adeae1ca250faac25e1
2013-07-24 20:16:31 +10:00
Robert Collins
f33c4ebdde Update TripleO incubator URL reference.
The old location has been deleted and 404's.

Change-Id: I29f3b534e28e8c0efe94736dcdc7f4c453738676
2013-07-23 15:18:05 +12:00
Jenkins
5f52562570 Merge "Support repo names with multiple '-'s" 2013-07-19 19:45:42 +00:00
Derek Higgins
a4a0523f2b Support repo names with multiple '-'s
The search and replace that converted dashes in REPONAME only converted
the first dash. They should all be converted.

Change-Id: I76a48cf5bdfa8664f0a65d0238fa4da7d80305db
2013-07-19 17:45:01 +01:00
Derek Higgins
51216dbd2d Set work-dir to cached repository
source-repositories does a git reset on the .git directory of cached
repositories. But doesn't specify the directory to reset. A working
directory needs to be specified so that the $PWD isn't used.

Without this change $PWD is polluted with the contents of repositories
being cached.

Change-Id: Ic37b702ac579bf766bb2204a988fa9468d308abf
2013-07-19 17:40:16 +01:00
Jenkins
7e408271a7 Merge "Allow 'sudo kpartx -d' used in EACTION for Fedora" 2013-07-18 20:27:58 +00:00
Robert Collins
e187a402ae Move the getsources hook earlier.
Caching PyPI objects will require inspecting the content downloaded by
the source repositories, so needs to run after it.

Change-Id: I551c075e0bb6853b2ef79268b7f6455a4f06743d
2013-07-18 23:06:30 +12:00
Robert Collins
79ca4d901c Cache repository-sources data.
Cloning large repositories over the internet can take considerable
time.  Caching them locally makes repeated image builds significantly
faster, so lets do that.

When users override the element source they will often be using a
local repository, so in those cases I don't cache - but we could
easily change our minds on that in the future.

Change-Id: I9822362cf722b904d9806dbbb4bb07cfe2b33437
2013-07-18 22:40:23 +12:00
Robert Collins
b8d08006db Update the Fedora element to honour --offline.
Similar to the Ubuntu element the Fedora element had not been updated
to honour --offline. Also similarly we only check for the existence of
the final cached file rather than the image we directly download,
because they are generated separately.

The -u change is just hygiene to detect future buggy changes.

Change-Id: Ib92a9d419bb485c8861da041066827e8d6aac0b7
2013-07-18 13:19:35 +12:00
Robert Collins
d7379df8b8 Enable --offline support for Ubuntu root images.
When --offline is set elements should not revalidate cached data. The
ubuntu element had not been updated to match this. SHA checking is
also skipped as we only move a new cached file into place when the
hash matches, and we might download a new hash before updating the
image cache, which would cause persistent --offline failures.

Change-Id: If1a0366b51951a73b7a3ffe23a29a3d910b08938
2013-07-18 13:19:35 +12:00
Robert Collins
f7f6cb45ee Fix the DIB_OFFLINE setting to actually work.
I missed the getopt parameter and forgot defaults are imported after
option processing. Untested code is broken code!

Change-Id: I133a691909d38e834c204950276a57f4884fc4ed
2013-07-18 13:19:25 +12:00
Robert Collins
b2f1d4e2af Document an interface for offline operation.
Complex image builds can download hundreds of MB of data from the
internet with many separate lookups. It would be nice to allow users
to ask for a fast build where those lookups are entirely avoided,
using locally cached resources (where possible). This new interface
allows users to signal to elements that they wish to operate without
updating cached resources, which will in turn allow us to avoid
checking for stale data at all.

As part of this I've also documented where we cache data, so that
things like the ccache cache dir and image cache files are not a
surprise to users.

Change-Id: I27f5de6ceaa4e9c6390721b7c434fe0908df84f5
2013-07-18 09:17:01 +12:00
Matthew Farrellee
1651cfb53a Allow 'sudo kpartx -d' used in EACTION for Fedora
Change-Id: I0c651091d9623d7607bb59bd05ffec20fd78633c
2013-07-17 17:12:07 -04:00
Robert Collins
d1a24cab16 Move end user docs higher up in README.md.
Most folk probably don't need the massive design details, so they
should come later.

Change-Id: I94067196e664b37c05fbd8882d259ffc3d95c50f
2013-07-18 00:36:54 +12:00
Robert Collins
1a172683a5 Remove excess whitespace in README.md.
Change-Id: I664cfe4aa8d05c4cc53eeb2ee5f5a200f0d41110
2013-07-18 00:00:01 +12:00
Lucas Alvares Gomes
64d7b8d4cb Fedora 19 GRUB
In the 52-force-text-mode-console hook, gracefully exit when the
/boot/grub2 directory does not exist on the Fedora 19 cloud image
filesystem. By default the Fedora 19 cloud image is using extlinux to boot
the image instead of GRUB. The decision was taken because GRUB is quite
big (would pull in ~30MB of dependencies) and there's very little benefit
in using it because cloud images don't need to cover all the corner cases.

Change-Id: I52723d4d14c21b1787b4c7e0dd21a09cdbdae0d1
2013-07-16 18:05:04 +01:00
Ivan Berezovskiy
894134fd30 Fix for mounted readonly filesystem for Fedora 19
Change-Id: Ie168618924116f88ef4ec46f59e79818239b4c70
Fixes: bug #1201774
2013-07-16 15:49:36 +04:00
Jenkins
5d84c9ea46 Merge "Update Fedora cloud image to its latest version" 2013-07-15 15:37:53 +00:00
Jenkins
e75ada24e1 Merge "EFI hosts" 2013-07-15 15:31:52 +00:00
Lucas Alvares Gomes
a1beca7b44 EFI hosts
If you have an EFI host but the image doesn't have the EFI modules
installed the grub-install command will fail in case the --target
argument is not set. The problem is that the grub-install script will
check whether the /sys/firmware/efi file exists or not to determine if
it's an EFI installation, but this value comes from the host, so this
patch will look for the /sys/firmware/efi file and will also check if
the EFI modules are installed in the image, if not set the --target to
a non-efi platform.

Change-Id: I4481b43e4a8fe4144be9c7eb9d9c618bbb2df21e
2013-07-15 10:22:51 +01:00