Commit 7cdf34a1 authored by Xiaowu Zhang's avatar Xiaowu Zhang Committed by Ophélie Gagnard

dracut: break at mount step to label xfs device

xfs device can't be modified when mounted, so use image which break at mount step
then in command line, user can use xfs command to label device
parent 50e6dba3
......@@ -2,25 +2,3 @@
. /lib/dracut-lib.sh
source $NEWROOT/etc/opt/slapos/get-network.sh
SLAPOS_CFG_FILE="$NEWROOT"/etc/opt/slapos/slapos.cfg
WENDELIN_REFERENCE=$(sed -n '/computer_id = /p' "$SLAPOS_CFG_FILE" | sed 's/computer_id = \(.*\)/\1/g')
WENDELIN_URL=$(sed -n '/master_url = /p' "$SLAPOS_CFG_FILE" | sed 's/master_url = \(.*\)/\1/g')
SLAPOS_KEY_FILE="$NEWROOT"$(sed -n '/key_file = /p' "$SLAPOS_CFG_FILE" | sed 's/key_file = \(.*\)/\1/g')
SLAPOS_CERT_FILE="$NEWROOT"$(sed -n '/cert_file = /p' "$SLAPOS_CFG_FILE" | sed 's/cert_file = \(.*\)/\1/g')
SCAN_FILE=/var/log/metadata_collect.log
sed -i "s|%SCAN_FILE%|$SCAN_FILE|g;s|%WENDELIN_REFERENCE%|$WENDELIN_REFERENCE|g;s|%SLAPOS_KEY_FILE%|$SLAPOS_KEY_FILE|g;s|%SLAPOS_CERT_FILE%|$SLAPOS_CERT_FILE|g;s|%WENDELIN_URL%|$WENDELIN_URL|g" /etc/flb.conf
timestamp_cmd='date +"%Y/%m/%d %H:%M %Z"'
/sbin/fluent-bit -e /etc/libfluentbit_wendelin.so -c /etc/flb.conf &
flb_pid=$!
sleep 1 # let fluent-bit be ready to listen to the log file
echo "{\"beginning_date\": \"$(eval "$timestamp_cmd")\"}" >> $SCAN_FILE
/sbin/metadata-collect-agent $NEWROOT/usr/bin $SCAN_FILE
/sbin/metadata-collect-agent $NEWROOT/usr/sbin $SCAN_FILE
echo "{\"end_date\": \"$(eval "$timestamp_cmd")\", \"end_marker\": \"fluentbit_end\"}" >> $SCAN_FILE
wait $flb_pid
#!/bin/bash
check() {
require_binaries grep head tail wc ip ls sleep date find fdisk du dh tree xargs || return 1
require_binaries grep head tail wc ip ls sleep date find fdisk du dh tree xargs xfs_admin xfs_db || return 1
return 255
}
......@@ -10,7 +10,7 @@ depends() {
}
install() {
inst_multiple head tail wc ip grep ls sleep date find fdisk du dh tree xargs
inst_multiple head tail wc ip grep ls sleep date find fdisk du dh tree xargs xfs_admin xfs_db
inst "$moddir"/metadata-collect-agent "/sbin/metadata-collect-agent"
inst "$moddir"/fluent-bit "/sbin/fluent-bit"
inst "$moddir"/libfluentbit_wendelin.so "/etc/libfluentbit_wendelin.so"
......
......@@ -4,15 +4,7 @@ compress=xz
hostonly=no
hostonly_cmdline=no
kernel_image=%KERNEL_IMAGE%
# model kernel command, see more in /boot/grub.cfg
# options in "ip=" are dummy except for the last one (NTP)
# next line
# - works without the "kernel_image" option
# - fails to boot the image with an efi stub enabled [kernel or dracut? kernel i believe]
# - fails at systemd initqueue with the kernel_image option and a non efi stub enabled kernel
# - passes systemd initqueue when properly including the module directory
# (i.e. with "-amd64" and the end of the name and all the "modules.xxx" files)
kernel_cmdline="root=LABEL=Root ip=10.42.42.42::10.42.42.42:255.255.255.255:aaaaa:eno1:off:1.1.1.1:8.8.8.8:130.79.14.172 rd.neednet=1 ro console=ttyS1,57600"
kernel_cmdline="root=/dev/vda2 rd.neednet=0 ro rd.break=pre-mount"
drivers_dir=%DRIVERS_DIR%
add_drivers+=" xfs "
show_modules=yes
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment