Commit Graph

672 Commits

Author SHA1 Message Date
Victor Lowther
dbacf3e8df Make pxe_mac accurate in two common cases.
If we are booting pxe booting using syslinux, and it has IPAPPEND 2 in
the boot stanza, then it will append the mac address of the device we
are booting from to the kernel parameters where we can get at it
pretty easily.

If we are booting physical hardware via UEFI over the network, we can
rely on the BootCurrent EFI variable to point at the boot entry for
the NIC we booted from, which will include the MAC address of that
nic.

If neither of those cases are in play, we can just fall back to the
all-physical-devices-with-links code.

This currently uses the Bash 4 support for associative arrays to handle
the netboot-in-UEFI case, if needed I can rewrite it to be Bash 3 compatible.

Change-Id: I5e50e30c60d6d732a09ab61251cbb9be08bb6113
2013-11-17 21:43:59 -06:00
Victor Lowther
43b70ce224 /bin/bash all the things.
Since we are using bash syntax in some of the element fragments,
we should make sure we use bash for all of them, so that things don't
break on systems where /bin/sh != /bin/bash.

Change-Id: If2f043c57aa4e1492b7f9839213ef6123f683612
2013-11-17 16:59:31 -06:00
Chris Jones
c9f432d45b Split network bringup out of base ramdisk init.
We now run the network bringup portion of the ramdisk init from an
init.d script, thus allowing image builders to inject code into the init
script before that point (e.g. configure network hardware).
The environment variables used by the network bringup code are retained
in the base init script so they can be overridden by init.d fragments.

Change-Id: I1ef0bb21e7f26c0ff3f02266f853ce5402bcb94d
Closes-Bug: #1252023
2013-11-17 20:37:26 +00:00
Russell Sim
b9348447b9 Don't block the upstart daemon if it doesn't exist
Check if Upstart exists before blocking the daemon.  Not all dpkg based
OS's have Upstart installed so this should help increase compatibility.

Closes-Bug: #1251949
Change-Id: I2dcb1ff3641778b5653ca5762a728398adb57da1
2013-11-17 14:46:14 +11:00
Chris Jones
5387b01af9 Make sorting of ramdisk init elements explicit.
We assemble the init script of ramdisks with the fragments from included
elements, alphabetically.
We now place leading numbers on all of the fragments we ship, to make it
more obvious to element authors and downstream users, how the process
works.

Closes-Bug: #1251706

Change-Id: I56b0d42971c8c462eddcfe1769f8124405e1233c
2013-11-15 17:18:34 +00:00
Roman Podoliaka
b01c73aadc Provide a way of determining init system used
dib-init-system script is installed into $PATH. Called
without arguments it will print the name of init system
used to stdout.

Additionally, set DIB_INIT_SYSTEM environment variable to
the init system used.

Tested on ubuntu+upstart, centos+upstart, fedora+systemd,
debian+sysv.

Closes-Bug: #1251610

Change-Id: I29668079091f6060dab66d8259890384d3bbd653
2013-11-15 17:10:38 +02:00
Jenkins
35830cc57c Merge "Usage message enhancement" 2013-11-14 09:38:10 +00:00
JUN JIE NAN
6d6634e804 Usage message enhancement
Add --help, add a simple usage and two examples

Change-Id: Iddf07ec1935f337000bd8ffb3d7c1fcc65753e8d
2013-11-14 09:18:45 +08:00
Jenkins
999829e15c Merge "Add mapping for libffi-dev" 2013-11-13 11:13:31 +00:00
Jenkins
c7b75c9b48 Merge "Allow heat-admin to sudo without tty" 2013-11-13 11:13:31 +00:00
Jenkins
a097b6d572 Merge "Python code refactorings." 2013-11-13 01:06:48 +00:00
Derek Higgins
726a816cac Add mapping for libffi-dev
libffi header files are needed to pip install xattr, which is a
requirement of swift.

Change-Id: I69560425f7106c35ec432825eab94ca8424eb89e
2013-11-12 20:32:52 +00:00
Derek Higgins
64f4323ae7 Allow heat-admin to sudo without tty
This is needed to run scripts from devtest, in particular so that
swift ring files can be distributed.

Change-Id: Icbe8c5b24a0d494730357983f230a37a7f078de7
2013-11-12 20:26:11 +00:00
Jenkins
9029d9b455 Merge "Add *.egg to .gitignore" 2013-11-12 16:01:50 +00:00
James Slagle
dee69b1810 Python code refactorings.
This commit refactors the python code in diskimage_builder slightly.  This is
in preparation for a larger review that adds more functionality to the python
code, namely the ability to apply elements to the current system as opposed to
a chroot.  Further, the refactorings can stand on their own for better clarity.
They include:
 - renaming elements.py to element_dependencies.py.  Adds clarity about the
   purpose of this module.
 - updating other code for this rename.
 - move tests into a tests submodule.

Change-Id: I5519cc52398e442b24e33802bae42070d64b0c1d
2013-11-12 10:47:57 -05:00
James Slagle
080012a3ca Add *.egg to .gitignore
Change-Id: I398d07cf2c1e07554566711b4904ccbb46df2bcb
2013-11-12 10:47:05 -05:00
Jan Provaznik
f6f4e808d1 Remove BUSYBOX variable from ramdisk-defaults
ramdisk-defaults file is sourced before chroot to an image being created
is executed. Busybox path should be set inside chroot instead.

Change-Id: Ic0e1d3093ca9d489dd96b14157e93b336cf0baee
2013-11-11 14:36:15 +01:00
OpenStack Jenkins
a59797ff24 Merge "Updated from global requirements" 2013-11-07 00:18:26 +00:00
Ghe Rivero
5265f4cb02 Replace assertEquals with assertEqual
To comply with the new hacking>=0.8.0,<0.9 requirements,
assertEqual is used instead of assertEquals which has been deprecated,
giving the error H234.

Change-Id: I3cbef1353260aec1502114010e12d0e507376389
2013-11-06 09:56:10 +01:00
OpenStack Jenkins
f122ac2486 Updated from global requirements
Change-Id: I895788a6249f179873ddab1d815c69005ffbd47a
2013-11-05 09:52:25 +00:00
iberezovskiy
f23babe971 Check existence of directory 'lost+found'
The command `sudo rmdir $TARGET_ROOT/lost+found` will fail
if `$TARGET_ROOT/lost+found` directory doesn't exist,
e.g. when you use non-default image.

Fixes bug #1245856

Change-Id: I48c8f2f201b29912a726249023ca7d20893cc958
2013-10-29 18:51:49 +04:00
Derek Higgins
d91ececa06 Remove mapping of atftpd to tftpd-server
These are different tftp implementations, tftpd-hpa and tftpd-server are
equivalent, this mapping was added in a previous commit.

Change-Id: Idd1f554d4ee8e1d3c515d5f2f191e90abe0ff396
2013-10-25 12:27:39 +01:00
Jenkins
0e4ddaa586 Merge "Add redhat mapping from tftpd-hpa to tftp-server" 2013-10-25 11:24:20 +00:00
Derek Higgins
4508a685de Remove dependency on dracut-network
Now that we have moved onto neutron-dhcp-agent. dracut-network is no
longer needed, infact it was getting in the way. Dracut wasn't
requesting the classless-static-routes dhcp parameter but was
configuring networking. Removing this causes the network service to
redo dhcp and set the appropriate static route (specifically so
overcloud nodes are routed to the correct metadata server). This element
is still required for undercloud nodes so needs to be included there.

Change-Id: Ic23560164aff7791dd87ed2c3ad008efd248ae93
2013-10-25 09:15:40 +01:00
Derek Higgins
66b293af1c Add redhat mapping from tftpd-hpa to tftp-server
This will be needed by a patch I'll be submitting to t-e-i to
change the tftp implementation used by ubuntu, so that both
Ubuntu and Fedora can use the same implementation.

Change-Id: Ie9581265dfa2c37342e01162fe580b1948dd3e03
2013-10-24 14:55:22 +01:00
Jenkins
3144cc63be Merge "Allow for bad Fedora image mirrors" 2013-10-23 23:10:29 +00:00
Tomas Sedovic
1c132f6aa5 Add apache and mod_wsgi to Fedora's package map
We need this for the Horizon element (which should work both on debian and
fedora-based distros).

Change-Id: I3a1dacbd1823abe051ba977b92b67ed27423f405
Signed-off-by: Tomas Sedovic <tsedovic@redhat.com>
2013-10-23 15:23:42 +02:00
Derek Higgins
9947cdebd9 Allow for bad Fedora image mirrors
I am getting a lot of http 404's from Fedora mirrors, in particular in
the US. Alternatively we could get cache-url to use previously existing
files if they exist and there is an error but this may not be the
correct thing todo in all cases.

So for now we do a retry if HTTP 404 is returned to the request for a
Fedora image.

Change-Id: I7634aeac3bdfe6930fafe6d276186c09fc8587b5
2013-10-23 10:49:29 +01:00
Derek Higgins
1adb4072b8 exit 44 if http 404 is returned
This will allow the fedora element to know that there was a http 404 so
it can retry.

Change-Id: I42100a175e42af1c53909508245695ac82204fc0
2013-10-23 10:44:47 +01:00
Jenkins
a6e55b8507 Merge "Ignore basename failures" 2013-10-18 13:02:46 +00:00
Ben Nemec
237fd64b47 Ignore basename failures
Commit 0210be22ae introduced the
possibility of basename being called on an empty string.  Because
that can happen in normal operation (such as an x86_64 kernel,
in which case the PAE check will find nothing), don't allow the
basename error to kill the script.  Also ignore failures in the
second basename call so the proper error message is echoed.

Change-Id: I38a18af09ab24fda9c98cbf3ace8fd7acc6faef5
2013-10-17 22:36:53 +00:00
Jenkins
194df26096 Merge "Remove old-kernels for fedora" 2013-10-17 21:01:34 +00:00
Jenkins
8599e52ea8 Merge "Remove framebuffer video drivers from ramdisks." 2013-10-17 21:01:10 +00:00
Jenkins
53cc353717 Merge "Dracut regenerate initrd w/ the right kernel" 2013-10-17 16:19:15 +00:00
Lucas Alvares Gomes
f707a6bd82 Dracut regenerate initrd w/ the right kernel
When picking the latest version of the kernel on i386 we should prioritize
PAE kernels. Debug kernels will be ignored.

Change-Id: Ic0fc5907074ee2a5ddfbbb1db2f1c8a6060cae9f
Related-Bug: #1240873
2013-10-17 13:50:54 +01:00
Lucas Alvares Gomes
0210be22ae Fix disk-image-get-kernel for redhat
disk-image-get-kernel picks the wrong version of kernel and initramfs
if there's a PAE and non-PAE version present. Only affects i386 images.

Change-Id: I06e08fdf038988759b620f549261499cb0a69b34
Closes-Bug: #1240873
2013-10-17 12:20:04 +01:00
Chris Jones
0ff3b94c86 Remove framebuffer video drivers from ramdisks.
We now forcibly remove all framebuffer video drivers from ramdisks, as
part of our ongoing effort to keep every kernel we boot, in text mode,
so it can be more easily intercepted by LOM hardware, nova console
logging, etc.

Fixes-Bug: #1178409

Change-Id: Ia72211c97c03c3f60eb9a1483297fe587de51f0b
2013-10-17 12:14:01 +01:00
Lucas Alvares Gomes
0181b177c2 Remove old-kernels for fedora
Remove the old kernels on fedora to save some space in the image.

Change-Id: Ia7ace63c286052713ac1ef3092373cc2712db11a
2013-10-17 11:51:44 +01:00
Derek Higgins
d23ba2a8a8 Conditionally add dhcp-all-interfaces
If the /etc/init drectory gets created on Fedora, it causes
os-svc-daemon to add upstart init scripts instead of systemd.
As a result none of the openstack services can start.

Partial-Bug: #1239880

Change-Id: Iec317baa3eb9ff651fa66c582d2f614993cde45e
2013-10-15 13:43:50 +13:00
Jenkins
a019fcf470 Merge "Specify distro release in fedora image name" 2013-10-14 11:51:22 +00:00
Jenkins
52956a2c3a Merge "Allow for redirects to ftp servers" 2013-10-12 15:38:39 +00:00
Clint Byrum
f96f705559 Remove \r chars from dhcp-all-interfaces
For some reason we are adding CR's to/etc/network/interfaces, but it
does not require them. They are a bit annoying to see in an editor and
serve no known purpose there.

Change-Id: I9aeeff5533f418f09fcf33edd42e5d85cd486d23
2013-10-11 11:06:16 -07:00
Clint Byrum
28190d5954 Make dhcp-all-interfaces block all interfaces
Previously dhcp-all-interfaces was only blocking the first network
interface to come up. We add an instance stanza to make it run one
instance of generate-interfaces-file per interface. We then use flock to
serialize runs of generate-interfaces-file.

Fixes bug #1233577

Change-Id: Ib16bed6b37ce0789e315ef57e05ac561470a6f2a
2013-10-11 11:06:16 -07:00
Clint Byrum
2129d78124 Fix ifquery call in dhcp-all-interfaces
Ifquery does not print anything for interfaces which only have a single
iface line. It does, however, return non-zero if the interface is not
configured at all, so we can use that to indicate whether or not there
is a configuration.

Fixes bug #1233579

Change-Id: Ia2fdafbea57e806eba99ae8ddaf395ebdcc306e1
2013-10-11 11:06:16 -07:00
Derek Higgins
b67b850a7e Allow for redirects to ftp servers
The Fedora image can redirect to a ftp server, in which case outputs a
213 if not modified.

Change-Id: I714fc3562bf188994357e1918af309d8edeecde5
2013-10-11 10:16:51 +01:00
Jenkins
5907b2fa43 Merge "Move /tmp/ccache setup to base element" 2013-10-11 08:57:06 +00:00
OpenStack Jenkins
caff705c7e Updated from global requirements
Change-Id: I4f26d3a8790c799e5c1f7f81031406e0c57545f9
2013-10-10 20:24:41 +00:00
Derek Higgins
11b116977c Specify distro release in fedora image name
The fedora element downloads the latest available image so presumably
will jump to F20 once available. Probably causing several days (weeks?)
of busted stuff. Of course it will be impossible to know when all users
of the elements are ready to switch but the least we can do is allow a
little time as a buffer.

This commit ties it down to a specific version which can then be updated
when the consumers of this element are ready. This allso follows the
same pattern as the ubuntu element.

Change-Id: I15c8e15a66e8af1bd152c27144acbc55af9da88e
2013-10-10 08:21:52 +01:00
Tim Serong
43c0082aa7 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-10 16:27:09 +11:00
Jenkins
126099cd6d Merge "Use --numeric-owner when extracting base image" 2013-10-08 22:54:08 +00:00