Add element for building ramdisk with ironic-python-agent

This element creates kernel and ramdisk files based on Fedora,
example:
disk-image-create -a i386 -o test fedora ironic-agent disable-selinux

Change-Id: Ifa133d1680b81cb87d32a405aa7d7b40fe91f835
This commit is contained in:
Yuriy Zveryanskyy 2014-06-27 14:54:29 +03:00
parent ce67ce87ea
commit 676b1b738d
8 changed files with 67 additions and 0 deletions

View File

@ -246,5 +246,12 @@ else
# by this point. # by this point.
rm $TMP_IMAGE_PATH rm $TMP_IMAGE_PATH
fi fi
case "$IMAGE_ELEMENT" in
*ironic-agent*)
rm $IMAGE_NAME.$IMAGE_TYPE
;;
esac
# All done! # All done!
trap EXIT trap EXIT

View File

@ -0,0 +1,2 @@
Build ramdisk with ironic-python-agent.
Works only on Fedora, therefore fedora element is mandatory.

View File

@ -0,0 +1,20 @@
#!/bin/bash
set -eu
set -o pipefail
[ -n "$TARGET_ROOT" ]
source $_LIB/img-functions
WORKDIR=$(pwd)
cd $TARGET_ROOT
echo "#disabled" > ./tmp/fstab.new
sudo mv ./tmp/fstab.new ./etc/fstab
sudo ln -s ./sbin/init ./
sudo find . -path ./sys -prune -o -path ./proc -prune -o -print | sudo cpio -o -H newc | gzip > $WORKDIR/$IMAGE_NAME.initramfs
select_boot_kernel_initrd $TARGET_ROOT
sudo cp $BOOTDIR/$KERNEL $WORKDIR/$IMAGE_NAME.vmlinuz

View File

@ -0,0 +1 @@
source-repositories

View File

@ -0,0 +1 @@
ironic-python-agent

View File

@ -0,0 +1,18 @@
#!/bin/bash
set -eu
set -o pipefail
install-packages python-dev python-pip qemu-utils parted hdparm util-linux genisoimage gcc
pip install -r /tmp/ironic-python-agent/requirements.txt
pip install /tmp/ironic-python-agent
sudo echo $'[Unit]
Description=Ironic Python Agent\n
[Service]
ExecStart=/usr/bin/ironic-python-agent
Restart=always
RestartSec=30s\n' > /usr/lib/systemd/system/ironic-python-agent.service
sudo systemctl enable ironic-python-agent.service

View File

@ -0,0 +1,17 @@
#!/bin/bash
set -eu
set -o pipefail
install-packages -e python-dev git cloud-init
rm -rf /tmp/ironic-python-agent
sudo systemctl disable iptables.service
#configs for additional interfaces
SYSCONFIG_PATH=/etc/sysconfig/network-scripts
for IFACE_NUM in 1 2
do
sudo cp $SYSCONFIG_PATH/ifcfg-eth0 $SYSCONFIG_PATH/ifcfg-eth$IFACE_NUM
sudo sed -i "s/eth0/eth$IFACE_NUM/g" $SYSCONFIG_PATH/ifcfg-eth$IFACE_NUM
done

View File

@ -0,0 +1 @@
agent git /tmp/ironic-python-agent git://git.openstack.org/openstack/ironic-python-agent