diff options
| author | Jonathan Bauer | 2015-04-14 17:58:50 +0200 |
|---|---|---|
| committer | Jonathan Bauer | 2015-04-14 17:58:50 +0200 |
| commit | e4c036d247389cfaeb3da8675ce53f53bef90afe (patch) | |
| tree | ae1c87aeb940147cb258c4b540ad920880781ac0 | |
| parent | static qemu-nbd (diff) | |
| parent | Some tries to fix kernel panic. (diff) | |
| download | systemd-init-e4c036d247389cfaeb3da8675ce53f53bef90afe.tar.gz systemd-init-e4c036d247389cfaeb3da8675ce53f53bef90afe.tar.xz systemd-init-e4c036d247389cfaeb3da8675ce53f53bef90afe.zip | |
Merge branch 'master' of git.openslx.org:openslx-ng/systemd-init
| -rwxr-xr-x | grub2.conf | 5 | ||||
| -rw-r--r-- | readme.md | 2 | ||||
| -rwxr-xr-x | testModule/binaries/busybox (renamed from testModule/busybox) | bin | 931664 -> 931664 bytes | |||
| -rwxr-xr-x | testModule/binaries/dnbd3-client (renamed from testModule/dnbd3-client) | bin | 31150 -> 31150 bytes | |||
| -rwxr-xr-x | testModule/binaries/endless | bin | 0 -> 6752 bytes | |||
| -rwxr-xr-x | testModule/binaries/systemd_preserve_process_marker | bin | 0 -> 7728 bytes | |||
| -rw-r--r-- | testModule/deprecated/network.functions (renamed from testModule/network.functions) | 0 | ||||
| -rw-r--r-- | testModule/deprecated/setup_network.sh (renamed from testModule/setup_network.sh) | 0 | ||||
| -rw-r--r-- | testModule/endless.c | 10 | ||||
| -rw-r--r-- | testModule/hooks/cmdline.sh (renamed from testModule/parse-ip.sh) | 10 | ||||
| -rw-r--r-- | testModule/hooks/pre-mount.sh | 10 | ||||
| -rw-r--r-- | testModule/hooks/pre-pivot.sh | 12 | ||||
| -rwxr-xr-x | testModule/kernel_modules/dnbd3.ko (renamed from testModule/dnbd3.ko) | bin | 1345285 -> 1345285 bytes | |||
| -rw-r--r-- | testModule/kernel_modules/nbd.ko (renamed from testModule/nbd.ko) | bin | 458623 -> 458623 bytes | |||
| -rw-r--r-- | testModule/module-setup.sh | 35 | ||||
| -rw-r--r-- | testModule/mount-dnbd3.sh | 15 | ||||
| -rw-r--r-- | testModule/systemd_preserve_process_marker.c | 31 | ||||
| -rw-r--r-- | testModule/wrap.c | 41 |
18 files changed, 94 insertions, 77 deletions
@@ -6,10 +6,11 @@ menuentry 'test' --class centos --class gnu-linux --class gnu --class os --unres insmod part_msdos insmod xfs set root='hd0,msdos1' - linux16 /vmlinuz-3.10.0-229.1.2.el7.x86_64 ro vconsole.font=latarcyrheb-sun16 vconsole.keymap=de rd.break=cleanup root=UUID=6c06919a-389a-4a50-8c6b-b086e65db9b0 rd.udev.log-priority=debug ip=10.0.2.15:132.230.4.2:10.0.2.2:255.255.255.0 # NOTE: Prevents dracut console: console=tty0 console=ttyS0,9600 ip=enp0s3:dhcp - # selxsrv=132.230.4.2 slxbase=boot/openselx-productive quiet splash vga=current wurstgesicht initrd=http://132.230.4.2/boot/openslx-productive/initramfs-stage31 ip=132.230.4.67:132.230.4.2:132.230.4.254:255.255.255.0 BOOTIF=01-08-00-27-60-49-62 BOOT_IMAGE=http://132.230.4.2/boot/openslx-productive/kernel + linux16 /vmlinuz-3.10.0-229.1.2.el7.x86_64 ro vconsole.font=latarcyrheb-sun16 vconsole.keymap=de rd.break root=UUID=6c06919a-389a-4a50-8c6b-b086e65db9b0 rd.udev.log-priority=debug ip=10.0.2.15:132.230.4.2:10.0.2.2:255.255.255.0 # NOTE: Prevents dracut console: console=tty0 console=ttyS0,9600 ip=enp0s3:dhcp root=/dev/nbd0 rootfstype=ext4 + #linux16 /vmlinuz-3.10.0-229.1.2.el7.x86_64 console=tty0 console=ttyS0,9600 ro vconsole.font=latarcyrheb-sun16 vconsole.keymap=de rd.break rd.debug rd.shell rd.info root=UUID=6c06919a-389a-4a50-8c6b-b086e65db9b0 rd.udev.log-priority=debug ip=10.0.2.15:132.230.4.2:10.0.2.2:255.255.255.0 initrd16 /initramfs-test.img + # fully given: selxsrv=132.230.4.2 slxbase=boot/openselx-productive quiet splash vga=current wurstgesicht initrd=http://132.230.4.2/boot/openslx-productive/initramfs-stage31 ip=132.230.4.67:132.230.4.2:132.230.4.254:255.255.255.0 BOOTIF=01-08-00-27-60-49-62 BOOT_IMAGE=http://132.230.4.2/boot/openslx-productive/kernel # given: ip=132.230.4.67:132.230.4.2:132.230.4.254:255.255.255.0 # test: ip=10.0.2.15:132.230.4.2:10.0.2.2:255.255.255.0 # working dracut configuration: ip=10.0.2.15::10.0.2.2:255.255.255.0:test:enp0s3:none @@ -306,3 +306,5 @@ dnbd3-client -h 132.230.4.1 -i stage4/torben/test -r 1 > # Installiere qemu-img: @yum install qemu-img@ > # Installiere nbd: @wget http://dl.fedoraproject.org/pub/epel/6/x86_64/nbd-2.9.20-7.el6.x86_64.rpm && rpm -Uvh nbd-2.9.20-7.el6.x86_64.rpm@ + +NOTE: Disable NetworkManager to avoid reloading network on boot: systemctl disable NetworkManager diff --git a/testModule/busybox b/testModule/binaries/busybox Binary files differindex 1212ae20..1212ae20 100755 --- a/testModule/busybox +++ b/testModule/binaries/busybox diff --git a/testModule/dnbd3-client b/testModule/binaries/dnbd3-client Binary files differindex 76924b49..76924b49 100755 --- a/testModule/dnbd3-client +++ b/testModule/binaries/dnbd3-client diff --git a/testModule/binaries/endless b/testModule/binaries/endless Binary files differnew file mode 100755 index 00000000..de7a8c0a --- /dev/null +++ b/testModule/binaries/endless diff --git a/testModule/binaries/systemd_preserve_process_marker b/testModule/binaries/systemd_preserve_process_marker Binary files differnew file mode 100755 index 00000000..0181cd80 --- /dev/null +++ b/testModule/binaries/systemd_preserve_process_marker diff --git a/testModule/network.functions b/testModule/deprecated/network.functions index 89ca5a20..89ca5a20 100644 --- a/testModule/network.functions +++ b/testModule/deprecated/network.functions diff --git a/testModule/setup_network.sh b/testModule/deprecated/setup_network.sh index 3b32a68c..3b32a68c 100644 --- a/testModule/setup_network.sh +++ b/testModule/deprecated/setup_network.sh diff --git a/testModule/endless.c b/testModule/endless.c new file mode 100644 index 00000000..22c9bc50 --- /dev/null +++ b/testModule/endless.c @@ -0,0 +1,10 @@ +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include <stdio.h> + +int main(int argc, char *argv[]) { + // Provides a dummy worker. + while (1) + sleep(999999999); +} diff --git a/testModule/parse-ip.sh b/testModule/hooks/cmdline.sh index 3349787b..340467df 100644 --- a/testModule/parse-ip.sh +++ b/testModule/hooks/cmdline.sh @@ -3,11 +3,6 @@ source /usr/lib/test-library.sh -# TODO -warn 'LOAD ...........................' -warn 'LOAD ...........................' -warn 'LOAD ...........................' - for parameter in $(getargs ip=); do local temp="$parameter:" set -- @@ -22,8 +17,9 @@ for parameter in $(getargs ip=); do [ -n "$4" ] && net_mask=$4 warn "PXE given net configuration: ip: $ip server_ip: $server_ip gateway_ip: $gateway_ip net_mask: $net_mask" - # TODO - replace_cmd ip "$ip::$gateway_ip:$net_mask:dracut_test_client:enp0s3:none" + local final_dracut_ip_config="$ip::$gateway_ip:$net_mask:dracut_test_client:enp0s3:none" + warn "Final dracut ip config: $final_dracut_ip_config" + replace_cmd ip "$final_dracut_ip_config" done # NOTE: Doesn't work since dracuts needed version of mount doesn't support diff --git a/testModule/hooks/pre-mount.sh b/testModule/hooks/pre-mount.sh new file mode 100644 index 00000000..7798622e --- /dev/null +++ b/testModule/hooks/pre-mount.sh @@ -0,0 +1,10 @@ +# TODO +warn '............START.............' + +insmod /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/dnbd3.ko +local dnbd3_device_node="$(dnbd3-client -h 132.230.4.1 -i stage4/torben/test \ + -r 1 -d /dev/dnbd0)" +#qemu-img create -f qcow2 -o \ +# backing_file="$dnbd3_device_node",backing_fmt=qcow2 /test.qcow2 +#insmod /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/nbd.ko +#systemd_preserve_process_marker qemu-nbd -c /dev/nbd0 /test.qcow2 diff --git a/testModule/hooks/pre-pivot.sh b/testModule/hooks/pre-pivot.sh new file mode 100644 index 00000000..8b01779a --- /dev/null +++ b/testModule/hooks/pre-pivot.sh @@ -0,0 +1,12 @@ +# TODO +warn '............MOUNT.............' +# TODO +dnbd3_device_node='/dev/dnbd0' +mount -o remount,rw /sysroot +rm /sysroot/test.qcow2 +qemu-img create -f qcow2 -o \ + backing_file="$dnbd3_device_node",backing_fmt=qcow2 /sysroot/test.qcow2 +insmod /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/nbd.ko +systemd_preserve_process_marker qemu-nbd --connect /dev/nbd0 /sysroot/test.qcow2 --socket /sysroot/var/lock/qemu-nbd-TEST +mount /dev/nbd0 /sysroot/TEST +# strace -ff -o /sysroot/log.txt -p PID diff --git a/testModule/dnbd3.ko b/testModule/kernel_modules/dnbd3.ko Binary files differindex d7b7ce3b..d7b7ce3b 100755 --- a/testModule/dnbd3.ko +++ b/testModule/kernel_modules/dnbd3.ko diff --git a/testModule/nbd.ko b/testModule/kernel_modules/nbd.ko Binary files differindex 40b67a92..40b67a92 100644 --- a/testModule/nbd.ko +++ b/testModule/kernel_modules/nbd.ko diff --git a/testModule/module-setup.sh b/testModule/module-setup.sh index ae30de9f..513b9068 100644 --- a/testModule/module-setup.sh +++ b/testModule/module-setup.sh @@ -5,12 +5,13 @@ check() { } depends() { - echo base network rootfs-block bash kernel-modules systemd shutdown udev-rules debug qemu btrfs + echo base network rootfs-block bash kernel-modules debug + # systemd return 0 } installkernel() { - instmods dnbd3 nbd ext4 \ + instmods ext4 mbcache jbd2 \ ip6t_rpfilter ip6t_REJEiCT ipt_REJECT xt_conntrack ebtable_nat \ ebtable_broute bridge stp llc ebtable_filter ebtables ip6table_nat \ nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle \ @@ -20,23 +21,33 @@ installkernel() { iptable_filter ip_tables vboxsf sg ppdev snd_intel8x0 snd_ac97_codec \ ac97_bus serio_raw snd_seq snd_seq_device i2c_piix4 pcspkr snd_pcm \ parport_pc parport snd_page_alloc snd_timer snd video soundcore e1000 \ - mperf xfs libcrc32c sd_mod crc_t10dif crct10dif_common sr_mod cdrom \ + mperf libcrc32c sd_mod crc_t10dif crct10dif_common sr_mod cdrom \ ata_generic pata_acpi ahci libahci vboxvideo drm i2c_core ata_piix \ libata vboxguest dm_mirror dm_region_hash dm_log dm_mod + # Production: instmods ext4 mbcache jbd2 } install() { # Loads globally needed useful functions or fixes some native dracut ones. inst "$moddir/library.sh" /usr/lib/test-library.sh - inst "$moddir/dnbd3-client" /usr/bin/dnbd3-client - inst "$moddir/dnbd3.ko" /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/dnbd3.ko - inst "$moddir/nbd.ko" /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/nbd.ko - # NOTE: Priority has to be greater than the network cmdline parsing hooks + + inst "$moddir/binaries/systemd_preserve_process_marker" /usr/bin/systemd_preserve_process_marker + inst "$moddir/binaries/endless" /usr/bin/endless + inst "$moddir/binaries/dnbd3-client" /usr/bin/dnbd3-client + inst "$moddir/binaries/busybox" /usr/bin/busybox + + inst "$moddir/kernel_modules/dnbd3.ko" /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/dnbd3.ko + inst "$moddir/kernel_modules/nbd.ko" /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/nbd.ko + + # NOTE: Priority has to be lower than the network cmdline parsing hooks # since we have to modify the some kernel parameter before. - inst_hook cmdline 100 "$moddir/parse-ip.sh" - inst_hook pre-mount 100 "$moddir/mount-dnbd3.sh" - inst_simple "$moddir/busybox" /usr/bin/busybox - #inst_hook pre-mount 20 "$moddir/setup_network.sh" - inst_multiple lsblk ping ip ifconfig sshd htop dhclient tail head cat vim touch sed lsmod insmod qemu-img qemu-nbd sleep + inst_hook cmdline 1 "$moddir/hooks/cmdline.sh" + inst_hook pre-mount 10 "$moddir/hooks/pre-mount.sh" + inst_hook pre-pivot 10 "$moddir/hooks/pre-pivot.sh" + + inst_multiple lsblk ping ip ifconfig sshd htop dhclient tail head cat vim \ + touch sed lsmod insmod qemu-img qemu-nbd sleep route wget find lsof \ + strace chroot switch_root pivot_root + # Production: inst_multiple insmod qemu-img qemu-nbd return 0 } diff --git a/testModule/mount-dnbd3.sh b/testModule/mount-dnbd3.sh deleted file mode 100644 index 9629a153..00000000 --- a/testModule/mount-dnbd3.sh +++ /dev/null @@ -1,15 +0,0 @@ -insmod /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/dnbd3.ko - -dnbd3-client --daemon & -sleep 2 -local dnbd3_device_node="$(dnbd3-client -h 132.230.4.1 -i stage4/torben/test -r 1)" - -qemu-img create -f qcow2 -o backing_file="$dnbd3_device_node",backing_fmt=qcow2 /tmp/test.qcow2 -insmod /usr/lib/modules/3.10.0-229.1.2.el7.x86_64/extra/nbd.ko -qemu-nbd -c /dev/nbd0 /tmp/test.qcow2 -mkdir /mnt -mount /dev/nbd0 /mnt - -warn '............JAU.............' -warn '............JAU.............' -warn '............JAU.............' diff --git a/testModule/systemd_preserve_process_marker.c b/testModule/systemd_preserve_process_marker.c new file mode 100644 index 00000000..172a5546 --- /dev/null +++ b/testModule/systemd_preserve_process_marker.c @@ -0,0 +1,31 @@ +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include <stdio.h> + +void print_array(int argc, char *argv[]) { + // Helper function to print given array with given length. + int i = 0; + int j = 0; + for (i = 0; i < argc; i ++) { + j = 0; + while(argv[i][j] != '\0') + printf("%c", argv[i][j++]); + printf(" "); + } + printf("\n"); +} +int main(int argc, char *argv[]) { + int count; + char **copy = malloc(sizeof(char *) * (argc-1)); + for (count = 0; count < argc - 1; count++) + copy[count] = strdup(argv[count + 1]); + // Adding systemd indicator to preserve wrapped process during changing + // root filesystem. We mark wrapper and child process. + copy[0][0] = '@'; + argv[0][0] = '@'; + if (-1 == execvp(argv[1], copy)) { + perror("child process execve failed [%m]"); + return -1; + } +} diff --git a/testModule/wrap.c b/testModule/wrap.c deleted file mode 100644 index 0f118235..00000000 --- a/testModule/wrap.c +++ /dev/null @@ -1,41 +0,0 @@ -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <stdio.h> - -void arg_print(int argc, char *argv[]) { - int i = 0; - int j = 0; - for (i = 0; i < argc; i ++) { - j = 0; - while(argv[i][j] != '\0') - printf("%c", argv[i][j++]); - - printf(" "); - } - printf("\n"); -} - - -int main(int argc, char *argv[]) { - - arg_print(argc, argv); - - int count; - char **copy = malloc(sizeof(char *) * (argc-1)); - for ( count = 0; count < argc - 1; count++ ) { - copy[count] = strdup(argv[count + 1]); - } - - arg_print(argc - 1, copy); - - copy[0][0] = '@'; - argv[0][0] = '@'; - - arg_print(argc - 1, copy); - - if (-1 == execvp(argv[1], copy)) { - perror("child process execve failed [%m]"); - return -1; - } -} |
