Replace empty image & nova patch with ipxe-boot image
This commit is contained in:
parent
65d3a98cbd
commit
915269adc7
|
@ -81,7 +81,7 @@ Configuring the Host Cloud
|
|||
|
||||
in nova.conf as well. This causes Nova to wait less time when shutting
|
||||
down an instance gracefully, and since graceful shutdown will never
|
||||
happen with the baremetal instances booted from an empty image it speeds
|
||||
happen with the baremetal instances booted from a ipxe-boot image it speeds
|
||||
things up a bit.
|
||||
|
||||
#. Restart ``nova-compute`` and ``neutron-openvswitch-agent`` to apply the
|
||||
|
@ -92,10 +92,9 @@ Preparing the Host Cloud Environment
|
|||
|
||||
#. Source an rc file that will provide admin credentials for the host cloud.
|
||||
|
||||
#. Create an empty base image for the baremetal instances::
|
||||
#. Upload an ipxe-boot image for the baremetal instances::
|
||||
|
||||
qemu-img create -f qcow2 empty.qcow2 40G
|
||||
glance image-create --name empty --disk-format qcow2 --container-format bare < empty.qcow2
|
||||
glance image-create --name ipxe-boot --disk-format qcow2 --container-format bare < ipxe/ipxe-boot.qcow2
|
||||
|
||||
#. Upload a CentOS 7 image for use as the base BMC instance::
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
ipxe-boot.d
|
|
@ -0,0 +1,8 @@
|
|||
# git ref to checkout from the iPXE git repository
|
||||
IPXE_GIT_REF=6366fa7a
|
||||
|
||||
ipxe-boot.qcow2:
|
||||
ELEMENTS_PATH=./elements IPXE_GIT_REF=$(IPXE_GIT_REF) disk-image-create -x -o ipxe-boot ipxe-boot-image
|
||||
|
||||
clean:
|
||||
rm -f ipxe-boot.qcow2
|
|
@ -0,0 +1,13 @@
|
|||
===============
|
||||
ipxe-boot-image
|
||||
===============
|
||||
Builds an image which contains *only* a grub2 based boot configured to run a
|
||||
custom built ipxe.lkrn image.
|
||||
|
||||
While this element depends on centos7, all remnants of the OS are removed apart
|
||||
from the /boot grub configuration and modules.
|
||||
|
||||
Optional parameters:
|
||||
|
||||
* IPXE_GIT_REF a git reference to checkout from the iPXE git repository before
|
||||
building the iPXE image. If not specified then current master will be built.
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2014 Hewlett-Packard Development Company, L.P.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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
|
||||
|
||||
ROOT_RM_PATHS="bin lib64 media opt sbin usr root etc lib mnt run srv var"
|
||||
|
||||
for _DIR in $ROOT_RM_PATHS ; do
|
||||
sudo rm -rf $TARGET_ROOT/$_DIR
|
||||
done
|
||||
# keep 99-tidy-logs happy
|
||||
sudo mkdir -p $TARGET_ROOT/var/log
|
||||
sudo mkdir $TARGET_ROOT/root
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
centos7
|
||||
vm
|
|
@ -0,0 +1,52 @@
|
|||
#!/bin/bash
|
||||
# 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
|
||||
|
||||
SCRIPTDIR=$(dirname $0)
|
||||
|
||||
cd /root
|
||||
git clone git://git.ipxe.org/ipxe.git
|
||||
cd ipxe/src
|
||||
if [ -n "${IPXE_GIT_REF:-}" ]; then
|
||||
git checkout ${IPXE_GIT_REF}
|
||||
fi
|
||||
IPXE_GIT_REF_CURRENT=$(git rev-parse --short HEAD)
|
||||
|
||||
make bin/ipxe.lkrn
|
||||
cp bin/ipxe.lkrn /boot/
|
||||
|
||||
cat << EOF >>/etc/grub.d/40_custom
|
||||
menuentry "iPXE boot ${IPXE_GIT_REF_CURRENT}" {
|
||||
linux16 /boot/ipxe.lkrn
|
||||
}
|
||||
EOF
|
||||
if [ -s /etc/default/grub ]; then
|
||||
sed -i -e 's/^GRUB_TIMEOUT.*/GRUB_TIMEOUT=5/' /etc/default/grub
|
||||
sed -i -e 's/^GRUB_DEFAULT.*/GRUB_DEFAULT="iPXE boot"/' /etc/default/grub
|
||||
fi
|
||||
|
||||
# remove all unneeded /boot files
|
||||
rm -f /boot/vmlinuz*
|
||||
rm -f /boot/initramfs*
|
||||
rm -f /boot/initrd.*
|
||||
rm -f /boot/System.map*
|
||||
rm -f /boot/config-*
|
||||
rm -f /boot/symvers-*
|
||||
rm -rf /boot/grub2/locale
|
|
@ -0,0 +1,3 @@
|
|||
xz-devel:
|
||||
git:
|
||||
gcc:
|
Binary file not shown.
|
@ -6,7 +6,7 @@ parameters:
|
|||
bmc_flavor: bmc
|
||||
bmc_image: CentOS-7-x86_64-GenericCloud
|
||||
baremetal_flavor: baremetal
|
||||
baremetal_image: empty
|
||||
baremetal_image: ipxe-boot
|
||||
key_name: default
|
||||
private_net: private
|
||||
bmc_prefix: bmc
|
||||
|
|
Loading…
Reference in New Issue