Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nk 2701 Kernel upgrade #50

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 12 additions & 14 deletions Dockerfile.build-inaugurator
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
FROM centos:7.8.2003
MAINTAINER guymenahem@neokarm.com
FROM centos:7.9.2009
MAINTAINER ilia.feldgun@zadara.com

# Install other tools
RUN yum update -y && \
RUN yum install -y yum-plugin-fastestmirror \
yum update -y && \
yum -y clean all

RUN yum install -y \
Expand All @@ -25,26 +26,23 @@ RUN yum install -y \
smartmontools && \
yum -y clean all


# Install PIP (obtained from EPEL)
RUN yum install -y epel-release && \
yum install -y python-pip && \
yum -y clean all

# Add the Elrepo repository and install the CCISS driver
RUN rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org && \
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm && \
rpm -Uvh https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm && \
yum install -y kmod-cciss && \
yum -y clean all

RUN pip2 install --upgrade setuptools==41.2.0 && pip2 install pep8 pika==0.11.2 mock==3.0.5 simplejson
RUN curl 'https://bootstrap.pypa.io/pip/2.7/get-pip.py' -o /tmp/get-pip.py && \
python2 /tmp/get-pip.py && \
rm -fr /tmp/get-pip.py

COPY dev-requirements.txt /tmp/dev-requirements.txt
RUN python2 -m pip install -r /tmp/dev-requirements.txt

# Edit sudoers file to avoid error: sudo: sorry, you must have a tty to run sudo
RUN sed -i -e "s/Defaults requiretty.*/ #Defaults requiretty/g" /etc/sudoers

# Install busybox with a Fedora RPM since there's no such package for Centos 7
RUN curl http://yum-repo.dc1.strato/repos/busybox/busybox-1.30.1-2.fc31.x86_64.rpm -o temp && \
rpm -ivh temp && \
rm temp
RUN curl http://yum-repo.dc1.strato/repos/busybox/busybox-1.30.1-2.fc31.x86_64.rpm | rpm -ivh

WORKDIR /root/inaugurator
41 changes: 35 additions & 6 deletions Makefile.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
KERNEL_VERSION = 3.10.0-1127.19.1.el7.x86_64
KERNEL_VERSION = 3.10.0-1160.45.1.el7.x86_64
INAUGURATOR_VERSION=$(shell python setup.py --version)
KERNEL_DIR=build/kernel
PYTHON_DIST_FILENAME=dist/inaugurator-${INAUGURATOR_VERSION}.linux-x86_64.tar.gz
KERNEL_IMAGE_PATH=/boot/vmlinuz-$(KERNEL_VERSION)
KERNEL_IMAGE_PATH=$(KERNEL_DIR)/boot/vmlinuz-$(KERNEL_VERSION)
INAUGURATOR_YUM_REPO = http://yum-repo.dc1.strato/repos/inaugurator/packages/

.PHONY: build
build: build/inaugurator.vmlinuz build/inaugurator.thin.initrd.img build/inaugurator.fat.initrd.img ${PYTHON_DIST_FILENAME}
Expand All @@ -10,6 +12,17 @@ build/inaugurator.vmlinuz: $(KERNEL_IMAGE_PATH)
-@mkdir $(@D)
cp $(KERNEL_IMAGE_PATH) $@

$(KERNEL_IMAGE_PATH): extract_kernel_rpm

.PHONY: extract_kernel_rpm
extract_kernel_rpm: $(KERNEL_DIR)/kernel-$(KERNEL_VERSION).rpm
cd $(KERNEL_DIR) && rpm2cpio kernel-$(KERNEL_VERSION).rpm | cpio -idmv

$(KERNEL_DIR)/kernel-$(KERNEL_VERSION).rpm: /usr/bin/yumdownloader
-@mkdir build
-@mkdir $(KERNEL_DIR)
yumdownloader --downloadonly --resolve kernel-$(KERNEL_VERSION) --destdir $(KERNEL_DIR)

build/inaugurator.%.initrd.img: build/inaugurator.%.initrd.dir
( cd $< ; find . | cpio -o -H newc ) | gzip -9 > $@.tmp
cp -rf $@.tmp $@
Expand All @@ -19,7 +32,7 @@ $(PYTHON_DIST_FILENAME): inaugurator setup.py
python setup.py bdist
python setup.py bdist_egg

build/inaugurator.thin.initrd.dir: ${PYTHON_DIST_FILENAME} build/osmosis/dist/osmosis-1.1.0b1-py2.7.egg build/osmosis/build/cpp/osmosis.bin
build/inaugurator.thin.initrd.dir: ${PYTHON_DIST_FILENAME} build/osmosis/dist/osmosis-1.1.0b1-py2.7.egg build/osmosis/build/cpp/osmosis.bin /usr/sbin/busybox /usr/bin/ipmitool /usr/sbin/smartctl
-@mkdir build
-rm -fr $@.tmp $@
mkdir $@.tmp
Expand Down Expand Up @@ -85,7 +98,6 @@ build/inaugurator.thin.initrd.dir: ${PYTHON_DIST_FILENAME} build/osmosis/dist/os
DEST=$@.tmp KERNEL_UNAME_R=$(KERNEL_VERSION) sh/relative_copy_driver.sh ahci
DEST=$@.tmp KERNEL_UNAME_R=$(KERNEL_VERSION) sh/relative_copy_driver.sh isofs
DEST=$@.tmp KERNEL_UNAME_R=$(KERNEL_VERSION) sh/relative_copy_driver.sh ata_piix
DEST=$@.tmp KERNEL_UNAME_R=$(KERNEL_VERSION) sh/relative_copy_driver.sh cciss
DEST=$@.tmp KERNEL_UNAME_R=$(KERNEL_VERSION) sh/relative_copy_driver.sh ipmi_msghandler
DEST=$@.tmp KERNEL_UNAME_R=$(KERNEL_VERSION) sh/relative_copy_driver.sh ipmi_si
DEST=$@.tmp KERNEL_UNAME_R=$(KERNEL_VERSION) sh/relative_copy_driver.sh ipmi_devintf
Expand All @@ -112,6 +124,7 @@ build/inaugurator.fat.initrd.dir: build/inaugurator.thin.initrd.dir
cp -a $< $@.tmp
echo "Copying drivers"
set -e; for driver in `sh/list_storage_and_network_driver_names.sh $(KERNEL_VERSION)`; do echo "Copying $$driver"; DEST=$@.tmp KERNEL_UNAME_R=$(KERNEL_VERSION) sh/relative_copy_driver.sh $$driver; done
echo "Done copying drivers"
depmod --basedir=$@.tmp $(KERNEL_VERSION)
cp -a lib $@.tmp/
mv $@.tmp $@
Expand All @@ -120,18 +133,34 @@ build/build-inaugurator.dockerfile: docker/build-inaugurator.dockerfile
@-mkdir build
KERNEL_VERSION=$(KERNEL_VERSION) m4 $< > $@

build/osmosis: ../osmosis
build/osmosis:
@-mkdir build
cp -rf ../osmosis build/
[ -d build/osmosis ] || cd build && git clone https://github.com/Stratoscale/osmosis.git --branch NK-2701
$(MAKE) -C build/osmosis clean

build/osmosis/dist/osmosis-1.1.0b1-py2.7.egg: build/osmosis
$(MAKE) -C build/osmosis egg

build/osmosis/build/cpp/osmosis.bin: build/osmosis
sudo yum install -y boost boost-devel boost-static gcc-c++
$(MAKE) -j 4 -C build/osmosis build

.PHONY: build_container
build_container: build/build-inaugurator.dockerfile setup.py
$(info It seems that a build-inaugurator image for version $(INAUGURATOR_VERSION) of Inaugurator was not built. Trying to build it...)
sudo docker build -f build/build-inaugurator.dockerfile -t build-inaugurator:$(INAUGURATOR_VERSION) build

/usr/bin/yumdownloader:
sudo yum install -y yum-utils

/usr/sbin/busybox: /tmp/busybox.rpm
rpm -ivhF $<

/tmp/busybox.rpm:
curl -o $@ $(INAUGURATOR_YUM_REPO)/busybox-1.30.1-2.fc31.x86_64.rpm

/usr/bin/ipmitool:
sudo yum install -y ipmitool

/usr/sbin/smartctl:
sudo yum install -y smartmontools
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
write me
# Inaugurator - The product installion codebase

## Build
```bash
make
```
5 changes: 5 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
setuptools==41.2.0
pep8
pika==0.11.2
mock==3.0.5
simplejson
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()

setup(
setup_kwargs = dict(
name="inaugurator",
version="1.6.0",
version="1.6.1",
author="Guy Menahem",
author_email="guymenahem@neokarm.com",
description=(
Expand All @@ -23,3 +23,5 @@ def read(fname):
],
requires=['pyudev','mock'],
)

setup(**setup_kwargs)
2 changes: 1 addition & 1 deletion sh/list_storage_and_network_driver_names.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
BLACKLIST='-e bfa -e csiostor -e cxgb4 -e bna -e aic94xx -e r8169'
KERNEL_VERSION=$1
set -e
find /lib/modules/$KERNEL_VERSION/kernel/drivers/net/ethernet /lib/modules/$KERNEL_VERSION/kernel/drivers/scsi /lib/modules/$KERNEL_VERSION/kernel/drivers/nvme /lib/modules/$KERNEL_VERSION/kernel/drivers/message /lib/modules/$KERNEL_VERSION/kernel/weak-updates/cciss -type f -printf '%f\n' | sed 's/\.ko$//' | sed 's/\.ko.xz$//' | grep -v $BLACKLIST
find /lib/modules/$KERNEL_VERSION/kernel/drivers/net/ethernet /lib/modules/$KERNEL_VERSION/kernel/drivers/scsi /lib/modules/$KERNEL_VERSION/kernel/drivers/nvme /lib/modules/$KERNEL_VERSION/kernel/drivers/message -type f -printf '%f\n' | sed 's/\.ko$//' | sed 's/\.ko.xz$//' | grep -v $BLACKLIST
2 changes: 1 addition & 1 deletion sh/relative_copy_driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
FIRMWARE_BLACKLIST="-e ql2600_fw.bin -e ql2700_fw.bin -e ql8300_fw.bin"

set -e
for ko in `modprobe --show-depends $1 --set-version=$KERNEL_UNAME_R | sed 's/insmod //'`; do
for ko in `modprobe --show-depends $1 --set-version=$KERNEL_UNAME_R | sed 's/insmod //' | sed 's/install .*$//'` ; do
sh/relative_copy_glob.sh $ko
done
modinfo --field firmware $1 --set-version=$KERNEL_UNAME_R >& /dev/null
Expand Down
2 changes: 1 addition & 1 deletion skipper.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
registry: rackattack-nas.dc1:5000
build-container-image: build-inaugurator
build-container-tag: "1.6.0"
# build-container-tag: "1.6.0"
3 changes: 0 additions & 3 deletions upseto.manifest

This file was deleted.

14 changes: 14 additions & 0 deletions yum_repos/centos.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[CentOS]
name=CentOS-7.9 - CentOS
baseurl=http://yum-repo.dc1.strato/repos/centos-7.9
gpgcheck=0

[CentOSUpdates]
name=CentOS-7.9 - CentOSUpdates
baseurl=http://yum-repo.dc1.strato/repos/updates-7.9
gpgcheck=0

[CentOSExtras]
name=CentOS-7.9 - CentOSExtras
baseurl=http://yum-repo.dc1.strato/repos/extras-7.9
gpgcheck=0
11 changes: 11 additions & 0 deletions yum_repos/centos_patches.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[22.02.0-patches]
name=v22.02.0-patches
baseurl=http://yum-repo.dc1.strato/repos/v22.02.0-patches
gpgcheck=0
enabled=1

[22.09.0-patches]
name=v22.09.0-patches
baseurl=http://yum-repo.dc1.strato/repos/v22.09.0-patches
gpgcheck=0
enabled=1