summaryrefslogtreecommitdiff
path: root/imagebuild
diff options
context:
space:
mode:
authorAnnie Lezil <annie.lezil@gmail.com>2016-11-10 21:29:40 +0000
committerRamamani Yeleswarapu <ramamani.yeleswarapu@intel.com>2017-05-18 14:44:11 -0700
commitfdcb0922a5c4a4ecbb8cb1b307c6c750990699ff (patch)
tree20eaddc9e897b27d840e492acd9b999c6abd2e42 /imagebuild
parent15878b7b181098db7abb6601ada0e245b6722d46 (diff)
downloadironic-python-agent-fdcb0922a5c4a4ecbb8cb1b307c6c750990699ff.tar.gz
Collect NIC name given by BIOS
Adds an extra field ``biosdevname`` to network interface inventory collected by ``default`` inspection collector (which collects the whole inventory returned by hardware manager) of ironic-python-agent. This feature requires biosdevname utility to collect the bios given NIC names. The tooling module for tinyIPA is created for the same purpose. For CoreOS IPA pxe images, biosdevname tooling module is limited, because Docker repository is created and embedded into CoreOS pxe images. The Docker repository uses debian to download the packages. Debian does not have biosdevname package. Adds an export variable TINYIPA_REQUIRE_BIOSDEVNAME. Set this variable to ``true`` in your shell before building tinyIPA. Closes-Bug: #1635351 Change-Id: Ia96af59e2a74868cac59e5a88cfbb3be60d85687
Diffstat (limited to 'imagebuild')
-rw-r--r--imagebuild/tinyipa/README.rst10
-rwxr-xr-ximagebuild/tinyipa/build-tinyipa.sh14
-rw-r--r--imagebuild/tinyipa/build_files/buildreqs.lst2
-rw-r--r--imagebuild/tinyipa/build_files/finalreqs.lst1
-rwxr-xr-ximagebuild/tinyipa/finalise-tinyipa.sh7
5 files changed, 33 insertions, 1 deletions
diff --git a/imagebuild/tinyipa/README.rst b/imagebuild/tinyipa/README.rst
index c8476bdd..96ca49b9 100644
--- a/imagebuild/tinyipa/README.rst
+++ b/imagebuild/tinyipa/README.rst
@@ -105,3 +105,13 @@ To provide other public SSH key, export path to it in your shell before
building tinyipa as follows::
export SSH_PUBLIC_KEY=<full-path-to-public-key>
+
+
+Enabling biosdevname in the ramdisk
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If you want to collect BIOS given names of NICs in the inventory, set
+``TINYIPA_REQUIRE_BIOSDEVNAME`` variable in your shell before building the
+tinyipa::
+
+ export TINYIPA_REQUIRE_BIOSDEVNAME=true
diff --git a/imagebuild/tinyipa/build-tinyipa.sh b/imagebuild/tinyipa/build-tinyipa.sh
index fac6ebef..099aa746 100755
--- a/imagebuild/tinyipa/build-tinyipa.sh
+++ b/imagebuild/tinyipa/build-tinyipa.sh
@@ -6,6 +6,7 @@ source ${WORKDIR}/tc-mirror.sh
BUILDDIR="$WORKDIR/tinyipabuild"
BUILD_AND_INSTALL_TINYIPA=${BUILD_AND_INSTALL_TINYIPA:-false}
TINYCORE_MIRROR_URL=${TINYCORE_MIRROR_URL:-}
+TINYIPA_REQUIRE_BIOSDEVNAME=${TINYIPA_REQUIRE_BIOSDEVNAME:-false}
CHROOT_PATH="/tmp/overides:/usr/local/sbin:/usr/local/bin:/apps/bin:/usr/sbin:/usr/bin:/sbin:/bin"
CHROOT_CMD="sudo chroot $BUILDDIR /usr/bin/env -i PATH=$CHROOT_PATH http_proxy=$http_proxy https_proxy=$https_proxy no_proxy=$no_proxy"
@@ -57,9 +58,12 @@ sudo sh -c "echo $TINYCORE_MIRROR_URL > $BUILDDIR/opt/tcemirror"
# Download get-pip into ramdisk
( cd "$BUILDDIR/tmp" && wget https://bootstrap.pypa.io/get-pip.py )
-# Download TGT and Qemu-utils source
+# Download TGT, Qemu-utils, and Biosdevname source
clone_and_checkout "https://github.com/fujita/tgt.git" "${BUILDDIR}/tmp/tgt" "v1.0.62"
clone_and_checkout "https://github.com/qemu/qemu.git" "${BUILDDIR}/tmp/qemu" "v2.5.0"
+if $TINYIPA_REQUIRE_BIOSDEVNAME; then
+ wget -N -O - https://linux.dell.com/biosdevname/biosdevname-0.7.2/biosdevname-0.7.2.tar.gz | tar -xz -C "${BUILDDIR}/tmp" -f -
+fi
# Create directory for python local mirror
mkdir -p "$BUILDDIR/tmp/localpip"
@@ -114,3 +118,11 @@ cd $WORKDIR/build_files && mksquashfs $BUILDDIR/tmp/qemu-utils qemu-utils.tcz &&
# Create qemu-utils.tcz.dep
echo "glib2.tcz" > qemu-utils.tcz.dep
+
+# Build biosdevname
+if $TINYIPA_REQUIRE_BIOSDEVNAME; then
+ rm -rf $WORKDIR/build_files/biosdevname.tcz
+ $CHROOT_CMD /bin/sh -c "cd /tmp/biosdevname-* && ./configure && make && make install DESTDIR=/tmp/biosdevname-installed"
+ find $BUILDDIR/tmp/biosdevname-installed/ -type f -executable | xargs file | awk -F ':' '/ELF/ {print $1}' | sudo xargs strip
+ cd $WORKDIR/build_files && mksquashfs $BUILDDIR/tmp/biosdevname-installed biosdevname.tcz && md5sum biosdevname.tcz > biosdevname.tcz.md5.txt
+fi
diff --git a/imagebuild/tinyipa/build_files/buildreqs.lst b/imagebuild/tinyipa/build_files/buildreqs.lst
index 2b5c216d..7d863afc 100644
--- a/imagebuild/tinyipa/build_files/buildreqs.lst
+++ b/imagebuild/tinyipa/build_files/buildreqs.lst
@@ -7,6 +7,8 @@ hdparm.tcz
parted.tcz
python.tcz
python-dev.tcz
+pciutils.tcz
+libpci-dev.tcz
raid-dm-4.2.9-tinycore64.tcz
scsi-4.2.9-tinycore64.tcz
udev-lib.tcz
diff --git a/imagebuild/tinyipa/build_files/finalreqs.lst b/imagebuild/tinyipa/build_files/finalreqs.lst
index 70da07c8..e1400d2c 100644
--- a/imagebuild/tinyipa/build_files/finalreqs.lst
+++ b/imagebuild/tinyipa/build_files/finalreqs.lst
@@ -7,6 +7,7 @@ iproute2.tcz
parted.tcz
popt.tcz
python.tcz
+pciutils.tcz
raid-dm-4.2.9-tinycore64.tcz
scsi-4.2.9-tinycore64.tcz
udev-lib.tcz
diff --git a/imagebuild/tinyipa/finalise-tinyipa.sh b/imagebuild/tinyipa/finalise-tinyipa.sh
index 9152d8b8..5971cf92 100755
--- a/imagebuild/tinyipa/finalise-tinyipa.sh
+++ b/imagebuild/tinyipa/finalise-tinyipa.sh
@@ -10,6 +10,7 @@ TINYCORE_MIRROR_URL=${TINYCORE_MIRROR_URL:-}
ENABLE_SSH=${ENABLE_SSH:-false}
SSH_PUBLIC_KEY=${SSH_PUBLIC_KEY:-}
PYOPTIMIZE_TINYIPA=${PYOPTIMIZE_TINYIPA:-true}
+TINYIPA_REQUIRE_BIOSDEVNAME=${TINYIPA_REQUIRE_BIOSDEVNAME:-false}
TC=1001
STAFF=50
@@ -86,6 +87,9 @@ echo "tc" | $CHROOT_CMD tee -a /etc/sysconfig/tcuser
cp $WORKDIR/build_files/tgt.* $FINALDIR/tmp/builtin/optional
cp $WORKDIR/build_files/qemu-utils.* $FINALDIR/tmp/builtin/optional
+if $TINYIPA_REQUIRE_BIOSDEVNAME; then
+ cp $WORKDIR/build_files/biosdevname.* $FINALDIR/tmp/builtin/optional
+fi
# Mount /proc for chroot commands
sudo mount --bind /proc $FINALDIR/proc
@@ -123,6 +127,9 @@ fi
$TC_CHROOT_CMD tce-load -ic /tmp/builtin/optional/tgt.tcz
$TC_CHROOT_CMD tce-load -ic /tmp/builtin/optional/qemu-utils.tcz
+if $TINYIPA_REQUIRE_BIOSDEVNAME; then
+ $TC_CHROOT_CMD tce-load -ic /tmp/builtin/optional/biosdevname.tcz
+fi
# Ensure tinyipa picks up installed kernel modules
$CHROOT_CMD depmod -a `$WORKDIR/build_files/fakeuname -r`