Remove CentOS bootstrap image

Related-bug: #1536658
Implements: blueprint remove-centos-bootstrap-from-fuel

Change-Id: If9becaa06d0fd382d191dd5cbb3bb19697d8c544
This commit is contained in:
Sergey Kulanov 2016-01-21 16:42:42 +02:00
parent 51770f4a7b
commit 773bedcdd1
29 changed files with 15 additions and 849 deletions

View File

@ -16,7 +16,6 @@ help:
@echo
@echo 'Available targets:'
@echo ' all - build product'
@echo ' bootstrap - build bootstrap'
@echo ' iso - build iso image'
@echo ' clean - remove build directory and resetting .done flags'
@echo ' deep_clean - clean + removing $(LOCAL_MIRROR) directory'
@ -71,6 +70,5 @@ include $(SOURCE_DIR)/repos.mk
include $(SOURCE_DIR)/mirror/module.mk
include $(SOURCE_DIR)/packages/module.mk
include $(SOURCE_DIR)/docker/module.mk
include $(SOURCE_DIR)/bootstrap/module.mk
include $(SOURCE_DIR)/iso/module.mk
include $(SOURCE_DIR)/virtualbox.mk

View File

@ -4,10 +4,6 @@ FUEL
This git repository contains Fuel ISO build scripts.
Directory structure:
- ```bootstrap```
Scripts for building CentOS based bootstrap ramdisk. The Fuel discovery
agent (nailgun-agent) and Fuel operating system provisioning agent (fuel-agent)
are installed into this ramdisk.
- ```docker```
Scripts for building Docker containers are located. The Fuel
master node is deployed using Docker. Every Fuel major component like Nailgun, Astute,

View File

@ -1,234 +0,0 @@
.PHONY: bootstrap clean clean-bootstrap
bootstrap: $(BUILD_DIR)/bootstrap/build.done
$(BUILD_DIR)/bootstrap/build.done: \
$(BUILD_DIR)/bootstrap/linux \
$(BUILD_DIR)/bootstrap/initramfs.img
$(ACTION.TOUCH)
INITRAMROOT:=$(BUILD_DIR)/bootstrap/initram-root
BOOTSTRAP_RPMS:=\
bash \
bfa-firmware \
ql2100-firmware \
ql2200-firmware \
ql23xx-firmware \
crontabs \
dhclient \
dmidecode \
iputils \
logrotate \
mcollective \
mingetty \
nc \
net-tools \
ntp \
ntpdate \
openssh-clients \
openssh-server \
pciutils \
plymouth \
rsyslog \
scapy \
tcpdump \
vconfig \
vim-minimal \
wget
BOOTSTRAP_RPMS_CUSTOM:=\
nailgun-agent \
nailgun-mcagents \
network-checker \
fuel-agent \
rubygem-mime-types \
rubygem-ffi \
rubygem-ffi-yajl \
rubygem-mixlib-shellout \
rubygem-wmi-lite
define yum_local_repo
[mirror]
name=Upstream mirror
baseurl=file://$(LOCAL_MIRROR_CENTOS_OS_BASEURL)
gpgcheck=0
enabled=1
[mos-mirror]
name=MOS mirror
baseurl=file://$(LOCAL_MIRROR_MOS_CENTOS_OS_BASEURL)
gpgcheck=0
enabled=1
endef
# add extra repo to bootstrap
define yum_local_extra_repo
[$(call get_repo_name,$1)]
name = Extra repo "$(call get_repo_name,$1)"
baseurl = file://$(LOCAL_MIRROR)/extra-repos/$(call get_repo_name,$1)
gpgcheck = 0
enabled = 1
priority = $(call get_repo_priority,$1)
exclude=*debuginfo*
endef
define bootstrap_yum_conf
[main]
cachedir=$(BUILD_DIR)/bootstrap/cache
keepcache=0
debuglevel=6
logfile=$(BUILD_DIR)/bootstrap/yum.log
exclude=*.i686.rpm
exactarch=1
obsoletes=1
gpgcheck=0
plugins=1
pluginpath=$(BUILD_DIR)/bootstrap/etc/yum-plugins
pluginconfpath=$(BUILD_DIR)/bootstrap/etc/yum/pluginconf.d
reposdir=$(BUILD_DIR)/bootstrap/etc/yum.repos.d
endef
#FIXME Partial-Bug: #1403088
YUM:=sudo yum -c $(BUILD_DIR)/bootstrap/etc/yum.conf --exclude=ruby-2.1.1 --exclude=ruby21 --installroot=$(INITRAMROOT) -y --nogpgcheck
KERNEL_PATTERN:=kernel-3.10.0*
KERNEL_FIRMWARE_PATTERN:=linux-firmware*
clean: clean-bootstrap
clean-bootstrap:
sudo rm -rf $(INITRAMROOT)
$(BUILD_DIR)/bootstrap/initramfs.img: \
$(BUILD_DIR)/bootstrap/customize-initram-root.done
sudo sh -c "cd $(INITRAMROOT) && find . -xdev | cpio --create \
--format='newc' | gzip -9 > $(BUILD_DIR)/bootstrap/initramfs.img"
$(BUILD_DIR)/bootstrap/linux: $(BUILD_DIR)/mirror/centos/build.done
mkdir -p $(BUILD_DIR)/bootstrap
find $(LOCAL_MIRROR_CENTOS_OS_BASEURL) -name '$(KERNEL_PATTERN)' | xargs rpm2cpio | \
(cd $(BUILD_DIR)/bootstrap/; cpio -imd './boot/vmlinuz*')
mv $(BUILD_DIR)/bootstrap/boot/vmlinuz* $(BUILD_DIR)/bootstrap/linux
rm -r $(BUILD_DIR)/bootstrap/boot
touch $(BUILD_DIR)/bootstrap/linux
$(BUILD_DIR)/bootstrap/etc/yum.repos.d/extra.repo: $(call depv,EXTRA_RPM_REPOS)
$(BUILD_DIR)/bootstrap/etc/yum.repos.d/extra.repo: \
export contents:=$(foreach repo,$(EXTRA_RPM_REPOS),\n$(call yum_local_extra_repo,$(repo))\n)
$(BUILD_DIR)/bootstrap/etc/yum.repos.d/extra.repo:
@mkdir -p $(@D)
/bin/echo -e "$${contents}" > $@
$(BUILD_DIR)/bootstrap/etc/yum.conf: export contents:=$(bootstrap_yum_conf)
$(BUILD_DIR)/bootstrap/etc/yum.repos.d/base.repo: export contents:=$(yum_local_repo)
$(BUILD_DIR)/bootstrap/etc/yum.conf $(BUILD_DIR)/bootstrap/etc/yum.repos.d/base.repo: $(BUILD_DIR)/bootstrap/etc/yum.repos.d/extra.repo
mkdir -p $(@D)
/bin/echo -e "$${contents}" > $@
$(BUILD_DIR)/bootstrap/customize-initram-root.done: $(call depv,BOOTSTRAP_RPMS_CUSTOM)
$(BUILD_DIR)/bootstrap/customize-initram-root.done: \
$(BUILD_DIR)/packages/rpm/build.done \
$(BUILD_DIR)/bootstrap/prepare-initram-root.done \
$(call find-files,$(SOURCE_DIR)/bootstrap/sync) \
$(BUILD_DIR)/repos/fuel-nailgun.done \
$(call find-files,$(BUILD_DIR)/repos/fuel-nailgun/bin/send2syslog.py) \
$(SOURCE_DIR)/bootstrap/ssh/id_rsa.pub \
$(BUILD_DIR)/bootstrap/etc/yum.conf \
$(BUILD_DIR)/bootstrap/etc/yum.repos.d/base.repo
# Rebuilding rpmdb
sudo rpm --root=$(INITRAMROOT) --rebuilddb
# Installing custom rpms
$(YUM) install $(BOOTSTRAP_RPMS_CUSTOM)
# Copying custom files
sudo rsync -rlptDK $(SOURCE_DIR)/bootstrap/sync/ $(INITRAMROOT)
sudo cp -r $(BUILD_DIR)/repos/fuel-nailgun/bin/send2syslog.py $(INITRAMROOT)/usr/bin
# Enable ntpd service
sudo ln -snf /etc/systemd/system/ntpd.service $(INITRAMROOT)/etc/systemd/system/default.target.wants/ntpd.service
sudo ln -snf /usr/lib/systemd/system/ntpdate.service $(INITRAMROOT)/etc/systemd/system/default.target.wants/ntpdate.service
# Enabling pre-init boot interface discovery
#sudo chroot $(INITRAMROOT) chkconfig setup-bootdev on
# Make the network script dependent on the setup-bootdev for correst network starting
sudo sed -i -e 's|\(^# Should-Start:.*\)|\1 setup-bootdev|' $(INITRAMROOT)/etc/init.d/network
# Setting root password into r00tme
sudo sed -i -e '/^root/c\root:$$6$$oC7haQNQ$$LtVf6AI.QKn9Jb89r83PtQN9fBqpHT9bAFLzy.YVxTLiFgsoqlPY3awKvbuSgtxYHx4RUcpUqMotp.WZ0Hwoj.:15441:0:99999:7:::' $(INITRAMROOT)/etc/shadow
# Copying rsa key.
sudo mkdir -p $(INITRAMROOT)/root/.ssh
sudo cp $(SOURCE_DIR)/bootstrap/ssh/id_rsa.pub $(INITRAMROOT)/root/.ssh/authorized_keys
sudo chmod 700 $(INITRAMROOT)/root/.ssh
sudo chmod 600 $(INITRAMROOT)/root/.ssh/authorized_keys
# Copying bash init files
sudo cp -f $(INITRAMROOT)/etc/skel/.bash* $(INITRAMROOT)/root/
# Removing garbage
sudo rm -rf $(INITRAMROOT)/home/*
sudo rm -rf \
$(INITRAMROOT)/var/cache/yum \
$(INITRAMROOT)/var/lib/yum \
$(INITRAMROOT)/usr/share/doc \
$(INITRAMROOT)/usr/share/locale \
sudo rm -rf $(INITRAMROOT)/tmp/*
$(ACTION.TOUCH)
$(BUILD_DIR)/bootstrap/prepare-initram-root.done: $(call depv,BOOTSTRAP_RPMS)
$(BUILD_DIR)/bootstrap/prepare-initram-root.done: \
$(BUILD_DIR)/mirror/centos/build.done \
$(BUILD_DIR)/packages/rpm/build.done \
$(BUILD_DIR)/bootstrap/etc/yum.conf \
$(BUILD_DIR)/bootstrap/etc/yum.repos.d/base.repo
# Installing centos-release package
sudo rpm -i --root=$(INITRAMROOT) \
`find $(LOCAL_MIRROR_CENTOS_OS_BASEURL) -name "centos-release*rpm" | head -1` || \
echo "centos-release already installed"
# Removing default repositories (centos-release package provides them)
sudo rm -f $(INITRAMROOT)/etc/yum.repos.d/Cent*
# Rebuilding rpmdb
sudo rpm --root=$(INITRAMROOT) --rebuilddb
# Creating some necessary directories
sudo mkdir -p $(INITRAMROOT)/proc
sudo mkdir -p $(INITRAMROOT)/dev
sudo mkdir -p $(INITRAMROOT)/var/lib/rpm
# Installing rpms
$(YUM) install $(BOOTSTRAP_RPMS)
# Disabling mail server (it have been installed as a dependency)
-sudo chroot $(INITRAMROOT) chkconfig exim off
-sudo chroot $(INITRAMROOT) chkconfig postfix off
-sudo chroot $(INITRAMROOT) chown smmsp:smmsp /var/spool/clientmqueue
# FIXME (vparakhin): there's no single RPM repo anymore, therefore
# source mirrors for kernel, modules and libs are specified explicitly.
# Perhaps this stuff should be moved to global config.mk
# Installing kernel modules
find $(LOCAL_MIRROR_CENTOS_OS_BASEURL) -name '$(KERNEL_PATTERN)' | xargs rpm2cpio | \
( cd $(INITRAMROOT); sudo cpio -idm './lib/modules/*' './boot/vmlinuz*' )
find $(LOCAL_MIRROR_CENTOS_OS_BASEURL) -name '$(KERNEL_FIRMWARE_PATTERN)' | xargs rpm2cpio | \
( cd $(INITRAMROOT); sudo cpio -idm './lib/firmware/*' )
find $(LOCAL_MIRROR_CENTOS_OS_BASEURL) -name 'libmlx4*' | xargs rpm2cpio | \
( cd $(INITRAMROOT); sudo cpio -idm './etc/*' './usr/lib64/*' )
for version in `ls -1 $(INITRAMROOT)/lib/modules`; do \
sudo depmod -b $(INITRAMROOT) $$version; \
done
# Some extra actions
sudo touch $(INITRAMROOT)/etc/fstab
sudo cp $(INITRAMROOT)/sbin/init $(INITRAMROOT)/init
$(ACTION.TOUCH)

View File

@ -1 +0,0 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDtrVTSM8tGd4E8khJn2gfN/2fymnX/0YKAGSVZTWDNIcYL5zXTlSwrccn/8EgmnNsJNxucJRT+oWqrDGaFaehuwlY/IBqm50KJVaUr5QYzOUpqVpFIpoX3UwETCxcSB1LiQYbCvrJcqOPQ4Zu9fMhMGKaAX1ohzOumn4czuLDYIvCnPnoU5RDWt7g1GaFFlzGU3JFooj7/aWFJMqJLinvay3vr2vFpBvO1y29nKu+zgpZkzzJCc0ndoVqvB+W9DY6QtgTSWfd3ZE/8vg4h8QV8H+xxqL/uWCxDkv2Y3rviAHivR/V+1YCSQH0NBJrNSkRjd+1roLhcEGT7/YEnbgVV nailgun@bootstrap

View File

@ -1,16 +0,0 @@
[options]
broken_system_clock = true
[problems]
# Superblock last mount time is in the future (PR_0_FUTURE_SB_LAST_MOUNT).
0x000031 = {
preen_ok = true
preen_nomessage = true
}
# Superblock last write time is in the future (PR_0_FUTURE_SB_LAST_WRITE).
0x000032 = {
preen_ok = true
preen_nomessage = true
}

View File

@ -1,152 +0,0 @@
#! /bin/bash
#
# setup-bootdev Setup necessary network interface to DHCP
#
# chkconfig: 2345 05 90
# description: Setup necessary network interface to DHCP.
#
### BEGIN INIT INFO
# Provides: $(setup-bootdev)
# Short-Description: Setup necessary network interface to DHCP
# Description: Setup necessary network interface to DHCP
### END INIT INFO
# Source function library.
. /etc/init.d/functions
cd /etc/sysconfig/network-scripts
. ./network-functions
get_bootdev() {
local ethdevice_timeout=$(sed -rne 's/^.*\s*\<ethdevice_timeout=([0-9]+)\s*.*$/\1/p' /proc/cmdline)
ethdevice_timeout="${ethdevice_timeout:-120}"
local wait4dev_interval=5
local max_attempts=$((ethdevice_timeout/wait4dev_interval))
local attempt=0
if [ $max_attempts -lt 2 ]; then
max_attempts=2
fi
bootaddr=$(ruby -e \
'File.open("/proc/cmdline") { |fo|
l = fo.read
m = l.match( /BOOTIF=([0-9A-Fa-f]{2}(-[0-9A-Fa-f]{2})+)/ )
print m[1].split("-")[-6..-1].join(":")
}' 2> /dev/null)
if [ -z "$bootaddr" ]; then
return 1
fi
while [ $attempt -lt $max_attempts ]; do
dev=$(get_device_by_hwaddr $bootaddr)
if [ -n "$dev" ]; then
break
else
attempt=$((attempt+1))
echo "Failed to find boot NIC (mac $bootaddr), retrying in $wait4dev_interval sec." >&2
sleep $wait4dev_interval
continue
fi
done
if [ -z "$dev" ]; then
return 2
fi
echo $dev
}
get_alldevs() {
# Take all not virtual network devices given by links (to omit files)
# Choose ethernet, but exclude wireless, bond, vlan, loopback, tunnels ...
for DEV in /sys/class/net/* ; do
# Take only links into account, skip files
if test ! -L $DEV ; then
continue
fi
DEVPATH=$(readlink -f $DEV)
# Drop virtual devices like loopback, tunnels, bonding, vlans ...
case $DEVPATH in
*/virtual/*)
continue
;;
esac
IF=${DEVPATH##*/}
# Check ethernet only
case "`cat $DEV/type`" in
1)
# TYPE=1 is ethernet, may also be wireless
# Virtual (lo, bound, vlan, tunnel ...) have been skipped before
if test -d $DEV/wireless -o -L $DEV/phy80211 ;
then
continue
else
# Catch ethernet non-virtual device
echo $IF
fi
;;
*) continue
;;
esac
done
}
set_interfaces_up_when_booted() {
devs=$(get_alldevs)
for name in $devs; do
content="DEVICE=$name\nBOOTPROTO=none\nONBOOT=yes\nLINKDELAY=30"
echo -e "$content" > "./ifcfg-$name"
done
}
# See how we were called.
case "$1" in
start)
echo -n "Waiting for network hardware to initialize..."
udevadm trigger --subsystem-match=net
udevadm settle
echo -n "Configure all interfaces as active..."
set_interfaces_up_when_booted
echo "ok."
echo -n "Obtain boot interface name..."
dev=$(get_bootdev)
rc=$?
if [ $rc -ne 0 ]; then
echo "failed."
echo -en "Obtain all eth interfaces..."
dev=$(get_alldevs)
if [ -z "$dev" ]; then
rc=1
echo "failed."
else
rc=0
dev_str=$(echo "$dev"|tr "\n" " "|sed 's/ *$//')
echo "ok ($dev_str)."
fi
else
echo "ok ($dev)."
fi
if [ $rc -eq 0 ]; then
for name in $dev; do
# sometimes shell is very picky about tabs and spaces
# tabs used here to make here-document work
cat > "./ifcfg-${name}" <<-EOF
DEVICE=$name
BOOTPROTO=dhcp
ONBOOT=yes
LINKDELAY=30
PERSISTENT_DHCLIENT=yes
EOF
done
fi
action $"Update network interfaces settings: " [ $rc -eq 0 ]
;;
*)
rc=0
;;
esac
exit $rc

View File

@ -1,9 +0,0 @@
# tty - getty
#
# This service maintains a getty on the specified device.
stop on runlevel [S016]
respawn
instance $TTY
exec /sbin/mingetty --noclear $TTY

Binary file not shown.

View File

@ -1,28 +0,0 @@
/var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
/var/log/mcollective.log
/var/log/nailgun-agent.log
{
# This file is used for daily log rotations, do not use size options here
sharedscripts
daily
# rotate only if 30M size or bigger
minsize 30M
maxsize 50M
# truncate file, do not delete & recreate
copytruncate
# keep logs for XXX rotations
rotate 3
# compression will be postponed to the next rotation, if uncommented
compress
# ignore missing files
missingok
# do not rotate empty files
notifempty
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}

View File

@ -1,27 +0,0 @@
main_collective = mcollective
collectives = mcollective
libdir = /usr/libexec/mcollective
logfile = /var/log/mcollective.log
loglevel = debug
direct_addressing = 1
daemonize = 1
# Set TTL to 1.5 hours
ttl = 5400
# Plugins
securityprovider = psk
plugin.psk = unset
connector = rabbitmq
plugin.rabbitmq.vhost = mcollective
plugin.rabbitmq.pool.size = 1
plugin.rabbitmq.pool.1.host =
plugin.rabbitmq.pool.1.port = 61613
plugin.rabbitmq.pool.1.user = mcollective
plugin.rabbitmq.pool.1.password = marionette
plugin.rabbitmq.heartbeat_interval = 30
# Facts
factsource = yaml
plugin.yaml = /etc/mcollective/facts.yaml

View File

@ -1 +0,0 @@
blacklist i2c_piix4

View File

@ -1 +0,0 @@
options mlx4_core port_type_array=2,2

View File

@ -1 +0,0 @@
bootstrap

View File

@ -1,8 +0,0 @@
#!/bin/sh -e
mountpoint -q /dev/pts || mount -t devpts devpts /dev/pts
# FIXME(dteselkin) workaround for broken yajl package
ln -nfs /usr/lib64/libyajl.so.2 /usr/lib64/libyajl.so
touch /var/lock/subsys/local

View File

@ -1,6 +0,0 @@
# Log all messages with this template
$template CustomLog, "%$NOW%T%TIMESTAMP:8:$%Z %syslogseverity-text% %syslogtag% %msg%\n"
$ActionFileDefaultTemplate CustomLog
user.debug /var/log/messages

View File

@ -1,20 +0,0 @@
Protocol 2
SyslogFacility AUTHPRIV
PasswordAuthentication no
PubkeyAuthentication yes
ChallengeResponseAuthentication no
GSSAPIAuthentication no
UsePAM no
UseDNS no
# Accept locale-related environment variables
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS
Subsystem sftp /usr/libexec/openssh/sftp-server
# Secure Ciphers and MACs
Ciphers aes256-ctr,aes192-ctr,aes128-ctr,arcfour256,arcfour128
MACs hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,hmac-sha1

View File

@ -1 +0,0 @@
ZONE="UTC"

View File

@ -1,3 +0,0 @@
HOSTNAME=bootstrap
NETWORKING=yes
VLAN=yes

View File

@ -1,11 +0,0 @@
[Unit]
Name=Send to syslog
ConditionFileExecutable=/usr/bin/send2syslog.py
ConditionPathExists=/etc/send2syslog.conf
After=rc-local.service
[Service]
ExecStart=/usr/bin/send2syslog.py -c /etc/send2syslog.conf -n
[Install]
WantedBy=multi-user.target

View File

@ -1,15 +0,0 @@
[Unit]
Name=Setup boot device
ConditionFileExecutable=/usr/bin/setup-bootdev
ConditionPathExists=/etc/sysconfig/network-scripts/network-functions
Before=network.service mcollective.service ntpdate.service ntpd.service
After=sysinit.target
[Service]
Type=oneshot
ExecStart=/usr/bin/setup-bootdev
ExecStartPost=-/usr/bin/fix-configs-on-startup
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@ -1,11 +0,0 @@
[Unit]
Description=Network Time Service
After=syslog.target ntpdate.service sntp.service
[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/ntpd
ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS
[Install]
WantedBy=multi-user.target

View File

@ -1,60 +0,0 @@
#!/bin/sh
set -e
masternode_ip=$(sed -rn 's/^.*url=http:\/\/(([0-9]{1,3}\.){3}[0-9]{1,3}).*$/\1/ p' /proc/cmdline)
mco_user=$(sed 's/\ /\n/g' /proc/cmdline | grep mco_user | awk -F\= '{print $2}')
mco_pass=$(sed 's/\ /\n/g' /proc/cmdline | grep mco_pass | awk -F\= '{print $2}')
[ -z "$mco_user" ] && mco_user="mcollective"
[ -z "$mco_pass" ] && mco_pass="marionette"
# Send logs to master node.
cat > /etc/send2syslog.conf <<EOF
{
"watchlist": [
{"servers": [ {"host": "$masternode_ip"} ],
"watchfiles": [
{"tag": "bootstrap/dmesg", "files": ["/var/log/dmesg"]},
{"tag": "bootstrap/secure", "files": ["/var/log/secure"]},
{"tag": "bootstrap/messages", "files": ["/var/log/messages"]},
{"tag": "bootstrap/fuel-agent", "files": ["/var/log/fuel-agent.log"]},
{"tag": "bootstrap/mcollective", "log_type": "ruby",
"files": ["/var/log/mcollective.log"]},
{"tag": "bootstrap/agent", "log_type": "ruby",
"files": ["/var/log/nailgun-agent.log"]},
{"tag": "bootstrap/netprobe_sender", "log_type": "netprobe",
"files": ["/var/log/netprobe_sender.log"]},
{"tag": "bootstrap/netprobe_listener", "log_type": "netprobe",
"files": ["/var/log/netprobe_listener.log"]}
]
}
]
}
EOF
/usr/bin/send2syslog.py -i < /etc/send2syslog.conf
#
# Set up NTP
#
# Disable panic about huge clock offset
#
sed -i '/^\s*tinker panic/ d' /etc/ntp.conf
sed -i '1 i tinker panic 0' /etc/ntp.conf
# Create default drift file
#
mkdir -p /var/lib/ntp
chown ntp: /var/lib/ntp
echo 0 > /var/lib/ntp/drift
chown ntp: /var/lib/ntp/drift
# Sync clock with master node
#
sed -i "/^\s*server\b/ d" /etc/ntp.conf
echo "server $masternode_ip burst iburst" >> /etc/ntp.conf
test -f /etc/ntp/step-tickers && echo $masternode_ip > /etc/ntp/step-tickers
#
# Update mcollective config
#
sed -i "s/^plugin.rabbitmq.pool.1.host\b.*$/plugin.rabbitmq.pool.1.host = $masternode_ip/" /etc/mcollective/server.cfg
sed -i "s/^plugin.rabbitmq.pool.1.user\b.*$/plugin.rabbitmq.pool.1.user = $mco_user/" /etc/mcollective/server.cfg
sed -i "s/^plugin.rabbitmq.pool.1.password\b.*$/plugin.rabbitmq.pool.1.password= $mco_pass/" /etc/mcollective/server.cfg

View File

@ -1,155 +0,0 @@
#!/bin/bash
set -e
service_try_count=15
service_sleep_time=1
while [ 0 -lt ${service_try_count} ]; do
_stat=$(systemctl show systemd-udev-trigger -p SubState)
if [[ "${_stat##*=}" != "exited" ]]; then
echo "Waiting for udev exited (${service_try_count})"
sleep ${service_sleep_time}
service_try_count=$(expr ${service_try_count} - 1)
else
echo "Udev is exited, continue to setup boot device"
break
fi
done
source /etc/sysconfig/network-scripts/network-functions
get_bootdev() {
local bootaddr
local ethdevice_timeout
local wait4dev_interval=5
local max_attempts
local attempt=0
ethdevice_timeout=$(sed -rne 's/^.*\s*\<ethdevice_timeout=([0-9]+)\s*.*$/\1/p' /proc/cmdline)
ethdevice_timeout="${ethdevice_timeout:-120}"
max_attempts=$((ethdevice_timeout/wait4dev_interval))
if [ $max_attempts -lt 2 ]; then
max_attempts=2
fi
bootaddr=$(ruby -e \
'File.open("/proc/cmdline") { |fo|
l = fo.read
m = l.match( /BOOTIF=([0-9A-Fa-f]{2}(-[0-9A-Fa-f]{2})+)/ )
print m[1].split("-")[-6..-1].join(":")
}' 2> /dev/null)
if [ -z "$bootaddr" ]; then
return 1
fi
while [ $attempt -lt $max_attempts ]; do
dev=$(get_device_by_hwaddr $bootaddr)
if [ -n "$dev" ]; then
break
else
attempt=$((attempt+1))
echo "Failed to find boot NIC (mac $bootaddr), retrying in $wait4dev_interval sec." >&2
sleep $wait4dev_interval
continue
fi
done
if [ -z "$dev" ]; then
return 2
fi
echo $dev
}
get_all_devices() {
# Take all not virtual network devices given by links (to omit files)
# Choose ethernet, but exclude wireless, bond, vlan, loopback, tunnels ...
for DEV in /sys/class/net/* ; do
# Take only links into account, skip files
if [ ! -L $DEV ]; then
continue
fi
DEVPATH=$(readlink -f $DEV)
# Drop virtual devices like loopback, tunnels, bonding, vlans ...
case $DEVPATH in
*/virtual/*)
continue
;;
esac
IF=${DEVPATH##*/}
# Check ethernet only
case "$(cat $DEV/type)" in
1)
# TYPE=1 is ethernet, may also be wireless
# Virtual (lo, bound, vlan, tunnel ...) have been skipped before
if [ -d $DEV/wireless -o -L $DEV/phy80211 ]; then
continue
else
# Catch ethernet non-virtual device
echo $IF
fi
;;
*)
continue
;;
esac
done
}
set_interfaces_up_when_booted() {
for name in $(get_all_devices); do
cat > "./ifcfg-${name}" <<EOF
DEVICE=$name
BOOTPROTO=none
ONBOOT=yes
LINKDELAY=30
EOF
done
}
cd /etc/sysconfig/network-scripts/
echo -n "Waiting for network hardware to initialize..."
udevadm trigger --subsystem-match=net
udevadm settle
echo -n "Configure all interfaces as active..."
set_interfaces_up_when_booted
echo "ok."
echo -n "Obtaining boot interface name..."
dev=$(get_bootdev)
rc=$?
if [ $rc -ne 0 ]; then
echo "failed."
echo -en "Obtaining all eth interfaces..."
dev=$(get_all_devices)
if [ -z "$dev" ]; then
rc=1
echo "failed."
else
rc=0
dev_str=$(echo "$dev"|tr "\n" " "|sed 's/ *$//')
echo "ok ($dev_str)."
fi
else
echo "ok ($dev)."
fi
if [ $rc -eq 0 ]; then
for name in $dev; do
# sometimes shell is very picky about tabs and spaces
# tabs used here to make here-document work
cat > "./ifcfg-${name}" <<EOF
DEVICE=$name
BOOTPROTO=dhcp
ONBOOT=yes
LINKDELAY=30
PERSISTENT_DHCLIENT=yes
EOF
done
fi
exit $rc

View File

@ -34,9 +34,6 @@ crontabs
dhcp
docker
fuel-bootstrap-cli
fuel-bootstrap-image
# NOTE(kozhukalov): We don't need target centos images in 8.0
# fuel-target-centos-images{{CENTOS_RELEASE}}
fuelmenu
fuel-mirror
fuel-openstack-metadata

View File

@ -72,7 +72,7 @@ $(eval $(call prepare_git_source,fuel-agent,fuel-agent-$(PACKAGE_VERSION).tar.gz
#FUEL_NAILGUN_AGENT_PKGS
$(eval $(call prepare_git_source,fuel-nailgun-agent,fuel-nailgun-agent-$(PACKAGE_VERSION).tar.gz,$(BUILD_DIR)/repos/fuel-nailgun-agent,HEAD,$(FUEL_NAILGUN_AGENT_GERRIT_COMMIT)))
#FUEL-IMAGE PKGS
$(eval $(call prepare_git_source,fuel-main,fuel-main-$(PACKAGE_VERSION).tar.gz,$(BUILD_DIR)/repos/fuel-main,HEAD,$(FUELMAIN_GERRIT_COMMIT)))
$(eval $(call prepare_git_source,fuel-main,fuel-$(PACKAGE_VERSION).tar.gz,$(BUILD_DIR)/repos/fuel-main,HEAD,$(FUELMAIN_GERRIT_COMMIT)))
#FUEL-MIRROR PKGS
$(eval $(call prepare_git_source,fuel-mirror,fuel-mirror-$(PACKAGE_VERSION).tar.gz,$(BUILD_DIR)/repos/fuel-mirror,HEAD,$(FUEL_MIRROR_GERRIT_COMMIT)))
#FUEL-MENU PKGS
@ -105,20 +105,13 @@ packages-deb: $(BUILD_DIR)/packages/deb/build.done
#### LATE PACKAGES ################
###################################
# fuel-bootstrap-image sources
$(eval $(call prepare_file_source,fuel-bootstrap-image,linux,$(BUILD_DIR)/bootstrap/linux,$(BUILD_DIR)/bootstrap/linux))
$(eval $(call prepare_file_source,fuel-bootstrap-image,initramfs.img,$(BUILD_DIR)/bootstrap/initramfs.img,$(BUILD_DIR)/bootstrap/initramfs.img))
$(eval $(call prepare_file_source,fuel-bootstrap-image,bootstrap.rsa,$(SOURCE_DIR)/bootstrap/ssh/id_rsa,$(SOURCE_DIR)/bootstrap/ssh/id_rsa))
.PHONY: packages-late packages-rpm-late
.PHONY: packages-late
$(BUILD_DIR)/packages/build-late.done: \
$(BUILD_DIR)/packages/rpm/build-late.done \
$(BUILD_DIR)/packages/rpm/fuel-docker-images.done
$(ACTION.TOUCH)
packages-late: $(BUILD_DIR)/packages/build-late.done
packages-rpm-late: $(BUILD_DIR)/packages/rpm/build-late.done
.PHONY: sources

View File

@ -109,7 +109,6 @@ $(BUILD_DIR)/packages/rpm/fuel-docker-images.done: export SANDBOX_DOWN:=$(SANDBO
$(BUILD_DIR)/packages/rpm/fuel-docker-images.done: \
$(BUILD_DIR)/repos/repos.done \
$(BUILD_DIR)/packages/rpm/buildd.tar.gz \
$(BUILD_DIR)/packages/rpm/repo-late.done \
$(BUILD_DIR)/docker/build.done
python $(SOURCE_DIR)/packages/rpm/genpkgnames.py $(SPECFILE) | xargs -I{} sudo find $(LOCAL_MIRROR_MOS_CENTOS_OS_BASEURL)/Packages -regex '.*/{}-[^-]+-[^-]+' -delete
mkdir -p $(BUILD_DIR)/packages/rpm/RPMS/x86_64
@ -131,33 +130,3 @@ ifeq (1,$(strip $(BUILD_PACKAGES)))
$(BUILD_DIR)/packages/rpm/build.done: $(BUILD_DIR)/packages/rpm/repo.done
endif
$(ACTION.TOUCH)
#######################################
# This section is for building container
# packages that depend on other packages.
# For example, bootstrap image package
# assumes passing through the following build stages
# 1) upstream mirror
# 2) fuel packages
# 3) bootstrap image (depends on 1 and 2)
# 4) bootstrap image package (depends on 3)
#######################################
fuel_rpm_packages_late:=\
fuel-bootstrap-image
$(eval $(foreach pkg,$(fuel_rpm_packages_late),$(call build_rpm,$(pkg),-late)$(NEWLINE)))
# BUILD_PACKAGES=0 - for late packages we need to be sure that centos mirror is ready
# BUILD_PACKAGES=1 - for late packages we need to be sure that fuel-* packages was build beforehand
$(BUILD_DIR)/packages/rpm/repo-late.done: $(BUILD_DIR)/mirror/centos/repo.done
ifeq (1,$(strip $(BUILD_PACKAGES)))
$(BUILD_DIR)/packages/rpm/repo-late.done: $(BUILD_DIR)/packages/rpm/repo.done
endif
find $(BUILD_DIR)/packages/rpm/RPMS -name '*.rpm' -exec cp -u --target-directory $(LOCAL_MIRROR_MOS_CENTOS_OS_BASEURL)/Packages {} +
createrepo -g $(LOCAL_MIRROR_MOS_CENTOS)/comps.xml \
-o $(LOCAL_MIRROR_MOS_CENTOS_OS_BASEURL) $(LOCAL_MIRROR_MOS_CENTOS_OS_BASEURL)
$(ACTION.TOUCH)
$(BUILD_DIR)/packages/rpm/build-late.done: $(BUILD_DIR)/packages/rpm/repo-late.done
$(ACTION.TOUCH)

View File

@ -1,38 +0,0 @@
%define name fuel-bootstrap-image
%{!?version: %define version 9.0.0}
%{!?release: %define release 1}
Summary: Fuel bootstrap image package
Name: %{name}
Version: %{version}
Release: %{release}
URL: http://mirantis.com
Source0: linux
Source1: initramfs.img
Source2: bootstrap.rsa
License: Apache
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
Prefix: %{_prefix}
BuildArch: noarch
%description
Fuel bootstrap image package
%prep
%build
%install
install -p -D -m 644 %{SOURCE0} %{buildroot}/var/www/nailgun/bootstrap/linux
install -p -D -m 644 %{SOURCE1} %{buildroot}/var/www/nailgun/bootstrap/initramfs.img
install -D -m 700 -d %{buildroot}/root/.ssh
install -p -m 600 %{SOURCE2} %{buildroot}/root/.ssh/bootstrap.rsa
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
/var/www/nailgun/bootstrap/linux
/var/www/nailgun/bootstrap/initramfs.img
/root/.ssh/bootstrap.rsa

View File

@ -2,7 +2,6 @@ fencing-agent
fuel
fuel-agent
fuel-bootstrap-cli
fuel-bootstrap-image
fuel-dockerctl
fuel-docker-images
fuel-ha-utils

View File

@ -11,11 +11,11 @@ Summary: Fuel for OpenStack
URL: http://mirantis.com
Version: %{version}
Release: %{release}
Source0: %{name}-%{version}.tar.gz
License: Apache
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
Prefix: %{_prefix}
BuildArch: noarch
Requires: fuel-bootstrap-image >= %{version}
Requires: fuel-library9.0
Requires: fuelmenu >= %{version}
Requires: fuel-provisioning-scripts >= %{version}
@ -30,12 +30,24 @@ Requires: yum
Fuel for OpenStack is a lifecycle management utility for
managing OpenStack.
%prep
%setup -cq -n %{name}-%{version}
%build
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/etc
echo %{fuel_release} > %{buildroot}%{_sysconfdir}/fuel_release
install -D -m 700 -d %{buildroot}/root/.ssh
install -p -m 600 %{_builddir}/%{name}-%{version}/bootstrap/ssh/id_rsa %{buildroot}/root/.ssh/bootstrap.rsa
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root)
/root/.ssh/bootstrap.rsa
%package -n fuel-release