add a new option "testonly"
PATCH 1/3 add a new option "testonly"
Since 04watchdog is used only for test cases. If watchdog want to be handled, the relevant operation need be differentiated. In this patch add a new option "testonly" to set. User can set "--testonly" or "--no-testonly" to decide current execution is for test cases running or building normal initram.
--- dracut-bash-completion.sh | 3 ++- dracut.8.asc | 7 +++++++ dracut.conf | 4 ++++ dracut.conf.5.asc | 3 +++ dracut.sh | 10 +++++++++- 5 files changed, 25 insertions(+), 2 deletions(-)
dracut-bash-completion.sh +2 -1
@@ -34,7 +34,8 @@ _dracut() { --local --hostonly --no-hostonly --fstab --help --bzip2 --lzma --xz --no-compress --gzip --list-modules --show-modules --keep --printsize --regenerate-all --noimageifnotneeded --early-microcode - --no-early-microcode --print-cmdline --prelink --noprelink' + --no-early-microcode --print-cmdline --prelink --noprelink + --testonly --no-testonly' [ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers --omit-drivers --modules --omit --drivers --filesystems --install
dracut.8.asc +7 -0
@@ -203,6 +203,13 @@ example: **--nolvmconf**:: do not include local _/etc/lvm/lvm.conf_ + +**--testonly**:: + execute to run test cases + +**--no-testonly**:: + execute to build normal initram + **--fscks** [LIST]:: add a space-separated list of fsck tools, in addition to _dracut.conf_'s specification; the installation is opportunistic (non-existing tools are
dracut.conf +4 -0
@@ -33,6 +33,10 @@ # install local /etc/lvm/lvm.conf #lvmconf="no" +# + +#execute to build normal initram, not for test cases running +#testonly="no" # A list of fsck tools to install. If it's not specified, module's hardcoded # default is used, currently: "umount mount /sbin/fsck* xfs_db xfs_check
dracut.conf.5.asc +3 -0
@@ -104,6 +104,9 @@ If chrooted to another root other than the real root device, use --fstab and pro *lvmconf=*"__{yes|no}__":: Include local _/etc/lvm/lvm.conf_ (default=yes) +*testonly=*"__{yes|no}__":: + execute to run test cases only (default=no) + *fscks=*" __<fsck tools>__ ":: Add a space-separated list of fsck tools. If nothing is specified, the default is: "umount mount /sbin/fsck* xfs_db xfs_check xfs_repair e2fsck
dracut.sh +9 -1
@@ -107,6 +107,8 @@ Creates initial ramdisk images for preloading modules --nomdadmconf Do not include local /etc/mdadm.conf --lvmconf Include local /etc/lvm/lvm.conf --nolvmconf Do not include local /etc/lvm/lvm.conf + --testonly Execute to run test cases + --no-testonly Execute for real initram building --fscks [LIST] Add a space-separated list of fsck helpers. --nofscks Inhibit installation of any fsck helpers. --ro-mnt Mount / and /usr read-only by default.
@@ -333,6 +335,8 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \ --long nomdadmconf \ --long lvmconf \ --long nolvmconf \ + --long testonly \ + --long no-testonly \ --long debug \ --long profile \ --long sshkey: \
@@ -417,6 +421,8 @@ while :; do --nomdadmconf) mdadmconf_l="no";; --lvmconf) lvmconf_l="yes";; --nolvmconf) lvmconf_l="no";; + --testonly) testonly_l="yes";; + --no-testonly) testonly_l="no";; --debug) debug="yes";; --profile) profile="yes";; --sshkey) sshkey="$2"; shift;;
@@ -682,6 +688,8 @@ stdloglvl=$((stdloglvl + verbosity_mod_l)) [[ $use_fstab_l ]] && use_fstab=$use_fstab_l [[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l [[ $lvmconf_l ]] && lvmconf=$lvmconf_l +[[ $testonly_l ]] && testonly=$testonly_l +[[ $testonly ]] || testonly=no [[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut [[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware" [[ $tmpdir_l ]] && tmpdir="$tmpdir_l"
@@ -1062,7 +1070,7 @@ export initdir dracutbasedir dracutmodules \ debug host_fs_types host_devs sshkey add_fstab \ DRACUT_VERSION udevdir prefix filesystems drivers \ systemdutildir systemdsystemunitdir systemdsystemconfdir \ - host_modalias host_modules + host_modalias host_modules testonly mods_to_load="" # check all our modules to see if they should be sourced.
Signature · 1 line
1.8.3.1
PATCH 2/3 set testonly for the relevant test cases
In reply to a message not in the archiveNow only watchdog module is for test only. So test cases which relates to watchdog need be set the testonly option. So add "--testonly" to the relevant test cases.
--- test/TEST-01-BASIC/test.sh | 1 + test/TEST-03-USR-MOUNT/test.sh | 1 + test/TEST-20-NFS/test.sh | 1 + test/TEST-40-NBD/test.sh | 1 + test/TEST-50-MULTINIC/test.sh | 1 + 5 files changed, 5 insertions(+)
test/TEST-01-BASIC/test.sh +1 -0
@@ -86,6 +86,7 @@ test_setup() { inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules ) sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \ + --testonly \ -a "debug watchdog" \ -d "piix ide-gd_mod ata_piix ext3 sd_mod i6300esb ib700wdt" \ -f $TESTDIR/initramfs.testing $KVERSION || return 1
test/TEST-03-USR-MOUNT/test.sh +1 -0
@@ -121,6 +121,7 @@ test_setup() { inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules ) sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \ + --testonly \ -a "debug watchdog" \ -o "network" \ -d "piix ide-gd_mod ata_piix btrfs sd_mod i6300esb ib700wdt" \
test/TEST-20-NFS/test.sh +1 -0
@@ -346,6 +346,7 @@ test_setup() { # Make client's dracut image $basedir/dracut.sh -l -i $TESTDIR/overlay / \ + --testonly \ -o "plymouth dash" \ -a "debug watchdog" \ -d "af_packet piix ide-gd_mod ata_piix sd_mod e1000 nfs sunrpc i6300esb" \
test/TEST-40-NBD/test.sh +1 -0
@@ -357,6 +357,7 @@ test_setup() { -f $TESTDIR/initramfs.server $KVERSION || return 1 sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \ + --testonly \ -o "plymouth" \ -a "debug watchdog" \ -d "af_packet piix ide-gd_mod ata_piix ext2 ext3 sd_mod e1000 i6300esb ib700wdt" \
test/TEST-50-MULTINIC/test.sh +1 -0
@@ -264,6 +264,7 @@ test_setup() { # Make server's dracut image $basedir/dracut.sh -l -i "$TESTDIR"/overlay / \ + --testonly \ -m "dash udev-rules base rootfs-block debug kernel-modules watchdog" \ -d "af_packet piix ide-gd_mod ata_piix ext3 sd_mod nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files nfsd e1000 i6300esb ib700wdt" \ -f "$TESTDIR"/initramfs.server "$KVERSION" || return 1
Signature · 1 line
1.8.3.1
PATCH 3/3 insert wdt kernel modules when watchdog is active
In reply to a message not in the archiveWhen watchdog is enabled in 1st kernel, then crash dump in kdump kernel will be interrupted if watchdog is timeout. Since some wdt drivers can stop the watchdog when its driver is loaded, e.g iTCO_wdt, this can benefit crash dump.
Add watchdog driver which is active in system to initramfs, its loading can stop watchdog.
--- modules.d/04watchdog/module-setup.sh | 37 +++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-)
modules.d/04watchdog/module-setup.sh +24 -13
@@ -14,18 +14,29 @@ depends() { # called by dracut install() { - inst_hook cmdline 00 "$moddir/watchdog.sh" - inst_hook cmdline 50 "$moddir/watchdog.sh" - inst_hook pre-trigger 00 "$moddir/watchdog.sh" - inst_hook initqueue 00 "$moddir/watchdog.sh" - inst_hook mount 00 "$moddir/watchdog.sh" - inst_hook mount 50 "$moddir/watchdog.sh" - inst_hook mount 99 "$moddir/watchdog.sh" - inst_hook pre-pivot 00 "$moddir/watchdog.sh" - inst_hook pre-pivot 99 "$moddir/watchdog.sh" - inst_hook cleanup 00 "$moddir/watchdog.sh" - inst_hook cleanup 99 "$moddir/watchdog.sh" - inst_hook emergency 02 "$moddir/watchdog-stop.sh" - inst_multiple -o wdctl + if [[$testonly = "yes" ]]; then + inst_hook cmdline 00 "$moddir/watchdog.sh" + inst_hook cmdline 50 "$moddir/watchdog.sh" + inst_hook pre-trigger 00 "$moddir/watchdog.sh" + inst_hook initqueue 00 "$moddir/watchdog.sh" + inst_hook mount 00 "$moddir/watchdog.sh" + inst_hook mount 50 "$moddir/watchdog.sh" + inst_hook mount 99 "$moddir/watchdog.sh" + inst_hook pre-pivot 00 "$moddir/watchdog.sh" + inst_hook pre-pivot 99 "$moddir/watchdog.sh" + inst_hook cleanup 00 "$moddir/watchdog.sh" + inst_hook cleanup 99 "$moddir/watchdog.sh" + inst_hook emergency 02 "$moddir/watchdog-stop.sh" + inst_multiple -o wdctl + fi } +installkernel() { + if [[$testonly = "no" ]]; then + wdt=$(lsmod|cut -f1 -d' '|grep "wdt$") + if [ -n "$wdt" ]; then + instmods $wdt + [ "$wdt" = "iTCO_wdt" ] && instmods lpc_ich + fi + fi +}
Signature · 1 line
1.8.3.1
Bao,
This is harald's call but personally to me this testonly options look little odd.
I am looking at old discussion here.
http://thread.gmane.org/gmane.linux.kernel.initramfs/3370
So harald's suggestion of using systemd looks fine. It is just a matter of figuring out who should load watchdog modules in initramfs.
I personally feel it should be watchdog module but if harald does not like it, we can atleast for the time being keep that logic in kdump module. But trying to create this testonly mode feels odd to me.
Harald, can you please let us know your preference on this. Modify 04watchdog module to include relevant drivers in hostonly mode or push this logic into kdump module for now.
Thanks
Vivek
Quoted 125 lines · Baoquan He
Since 04watchdog is used only for test cases. If watchdog want to be handled, the relevant operation need be differentiated. In this patch add a new option "testonly" to set. User can set "--testonly" or "--no-testonly" to decide current execution is for test cases running or building normal initram.
--- dracut-bash-completion.sh | 3 ++- dracut.8.asc | 7 +++++++ dracut.conf | 4 ++++ dracut.conf.5.asc | 3 +++ dracut.sh | 10 +++++++++- 5 files changed, 25 insertions(+), 2 deletions(-)dracut-bash-completion.sh +2
-1@@ -34,7 +34,8 @@ _dracut() { --local --hostonly --no-hostonly --fstab --help --bzip2 --lzma --xz --no-compress --gzip --list-modules --show-modules --keep --printsize --regenerate-all --noimageifnotneeded --early-microcode - --no-early-microcode --print-cmdline --prelink --noprelink' + --no-early-microcode --print-cmdline --prelink --noprelink + --testonly --no-testonly' [ARG]='-a -m -o -d -I -k -c -L --kver --add --force-add --add-drivers --omit-drivers --modules --omit --drivers --filesystems --installdracut.8.asc +7
-0@@ -203,6 +203,13 @@ example: **--nolvmconf**:: do not include local _/etc/lvm/lvm.conf_ + +**--testonly**:: + execute to run test cases + +**--no-testonly**:: + execute to build normal initram + **--fscks** [LIST]:: add a space-separated list of fsck tools, in addition to _dracut.conf_'s specification; the installation is opportunistic (non-existing tools aredracut.conf +4
-0@@ -33,6 +33,10 @@ # install local /etc/lvm/lvm.conf #lvmconf="no" +# + +#execute to build normal initram, not for test cases running +#testonly="no" # A list of fsck tools to install. If it's not specified, module's hardcoded # default is used, currently: "umount mount /sbin/fsck* xfs_db xfs_checkdracut.conf.5.asc +3
-0@@ -104,6 +104,9 @@ If chrooted to another root other than the real root device, use --fstab and pro *lvmconf=*"__{yes|no}__":: Include local _/etc/lvm/lvm.conf_ (default=yes) +*testonly=*"__{yes|no}__":: + execute to run test cases only (default=no) + *fscks=*" __<fsck tools>__ ":: Add a space-separated list of fsck tools. If nothing is specified, the default is: "umount mount /sbin/fsck* xfs_db xfs_check xfs_repair e2fsckdracut.sh +9
-1@@ -107,6 +107,8 @@ Creates initial ramdisk images for preloading modules --nomdadmconf Do not include local /etc/mdadm.conf --lvmconf Include local /etc/lvm/lvm.conf --nolvmconf Do not include local /etc/lvm/lvm.conf + --testonly Execute to run test cases + --no-testonly Execute for real initram building --fscks [LIST] Add a space-separated list of fsck helpers. --nofscks Inhibit installation of any fsck helpers. --ro-mnt Mount / and /usr read-only by default.@@ -333,6 +335,8 @@ TEMP=$(unset POSIXLY_CORRECT; getopt \ --long nomdadmconf \ --long lvmconf \ --long nolvmconf \ + --long testonly \ + --long no-testonly \ --long debug \ --long profile \ --long sshkey: \@@ -417,6 +421,8 @@ while :; do --nomdadmconf) mdadmconf_l="no";; --lvmconf) lvmconf_l="yes";; --nolvmconf) lvmconf_l="no";; + --testonly) testonly_l="yes";; + --no-testonly) testonly_l="no";; --debug) debug="yes";; --profile) profile="yes";; --sshkey) sshkey="$2"; shift;;@@ -682,6 +688,8 @@ stdloglvl=$((stdloglvl + verbosity_mod_l)) [[ $use_fstab_l ]] && use_fstab=$use_fstab_l [[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l [[ $lvmconf_l ]] && lvmconf=$lvmconf_l +[[ $testonly_l ]] && testonly=$testonly_l +[[ $testonly ]] || testonly=no [[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut [[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware" [[ $tmpdir_l ]] && tmpdir="$tmpdir_l"@@ -1062,7 +1070,7 @@ export initdir dracutbasedir dracutmodules \ debug host_fs_types host_devs sshkey add_fstab \ DRACUT_VERSION udevdir prefix filesystems drivers \ systemdutildir systemdsystemunitdir systemdsystemconfdir \ - host_modalias host_modules + host_modalias host_modules testonly mods_to_load="" # check all our modules to see if they should be sourced.Signature · 1 line
1.8.3.1
Quoted 12 lines · Vivek Goyal
Bao,
This is harald's call but personally to me this testonly options look little odd.
I am looking at old discussion here.
http://thread.gmane.org/gmane.linux.kernel.initramfs/3370
So harald's suggestion of using systemd looks fine. It is just a matter of figuring out who should load watchdog modules in initramfs.
Quoted 8 lines
I personally feel it should be watchdog module but if harald does not like it, we can atleast for the time being keep that logic in kdump module. But trying to create this testonly mode feels odd to me.
Harald, can you please let us know your preference on this. Modify 04watchdog module to include relevant drivers in hostonly mode or push this logic into kdump module for now.
Adding wdt stuff in dracut would also help diskless system and NFS root system.
Thanks
Dave
Quoted 17 lines · Dave Young
Quoted 16 lines · Vivek Goyal
Bao,
This is harald's call but personally to me this testonly options look little odd.
I am looking at old discussion here.
http://thread.gmane.org/gmane.linux.kernel.initramfs/3370
So harald's suggestion of using systemd looks fine. It is just a matter of figuring out who should load watchdog modules in initramfs.
I personally feel it should be watchdog module but if harald does not like it, we can atleast for the time being keep that logic in kdump module. But trying to create this testonly mode feels odd to me.
Quoted 6 lines
Quoted 4 lines
Harald, can you please let us know your preference on this. Modify 04watchdog module to include relevant drivers in hostonly mode or push this logic into kdump module for now.
Adding wdt stuff in dracut would also help diskless system and NFS root system.
NFS root can use watchdog in real root. so correct myself, it only benifits the initramfs-only system.
Thanks
Dave
Quoted 4 lines · Vivek Goyal
Bao,
This is harald's call but personally to me this testonly options look little odd.
Yeah, it does look odd. But I don't want this to affect the existed test cases.
Quoted 11 lines
I am looking at old discussion here.
http://thread.gmane.org/gmane.linux.kernel.initramfs/3370
So harald's suggestion of using systemd looks fine. It is just a matter of figuring out who should load watchdog modules in initramfs.
I personally feel it should be watchdog module but if harald does not like it, we can atleast for the time being keep that logic in kdump module. But trying to create this testonly mode feels odd to me.
Yeah, agree. For the time being, only iTCO_wdt need load module and satisfacory. However, there are many kinds of watchdog with different implementation. Finally, a independent dracut module may be needed, it can be put into dracut as a independent folder, e.g 06wdt which is different then 04watchdog.
Quoted 9 lines
Harald, can you please let us know your preference on this. Modify 04watchdog module to include relevant drivers in hostonly mode or push this logic into kdump module for now.
Thanks
VivekOn Wed, Jan 15, 2014 at 08:53:48PM +0800, Baoquan He wrote:
On Mon, Jan 20, 2014 at 10:28:48AM +0800, Baoquan He wrote:
[..]
Quoted 9 lines
Quoted 3 lines
I personally feel it should be watchdog module but if harald does not like it, we can atleast for the time being keep that logic in kdump module. But trying to create this testonly mode feels odd to me.
Yeah, agree. For the time being, only
iTCO_wdtneed load module and satisfacory. However, there are many kinds of watchdog with different implementation. Finally, a independent dracut module may be needed, it can be put into dracut as a independent folder, e.g 06wdt which is different then 04watchdog.
I think creating another watchdog module 06wdt does not make much sense. Eiter this logic needs to be merged into existing watchdog module 04wdt or we modify kdump module to load watchdog drivers in kdump initramfs as a short term approach till we can convince harald that keeping this logic in 04watchdog is a good idea.
Thanks
Vivek