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:
parent
ce67ce87ea
commit
676b1b738d
@ -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
|
||||||
|
2
elements/ironic-agent/README.md
Normal file
2
elements/ironic-agent/README.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Build ramdisk with ironic-python-agent.
|
||||||
|
Works only on Fedora, therefore fedora element is mandatory.
|
20
elements/ironic-agent/cleanup.d/99-ramdisk-create
Executable file
20
elements/ironic-agent/cleanup.d/99-ramdisk-create
Executable 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
|
1
elements/ironic-agent/element-deps
Normal file
1
elements/ironic-agent/element-deps
Normal file
@ -0,0 +1 @@
|
|||||||
|
source-repositories
|
1
elements/ironic-agent/element-provides
Normal file
1
elements/ironic-agent/element-provides
Normal file
@ -0,0 +1 @@
|
|||||||
|
ironic-python-agent
|
18
elements/ironic-agent/install.d/60-ironic-agent-install
Executable file
18
elements/ironic-agent/install.d/60-ironic-agent-install
Executable 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
|
17
elements/ironic-agent/post-install.d/80-ironic-agent
Executable file
17
elements/ironic-agent/post-install.d/80-ironic-agent
Executable 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
|
1
elements/ironic-agent/source-repository-ironic-agent
Normal file
1
elements/ironic-agent/source-repository-ironic-agent
Normal file
@ -0,0 +1 @@
|
|||||||
|
agent git /tmp/ironic-python-agent git://git.openstack.org/openstack/ironic-python-agent
|
Loading…
Reference in New Issue
Block a user