diff options
5 files changed, 31 insertions, 10 deletions
diff --git a/builder/dnbd3-rootfs/hooks/cmdline/set-dracut-environment-variables.sh b/builder/dnbd3-rootfs/hooks/cmdline/set-dracut-environment-variables.sh index c47af818..a934731e 100755 --- a/builder/dnbd3-rootfs/hooks/cmdline/set-dracut-environment-variables.sh +++ b/builder/dnbd3-rootfs/hooks/cmdline/set-dracut-environment-variables.sh @@ -1,5 +1,8 @@ # Set rootok and root as dracut expects them to be set by the module preparing # the root filesystem. +# Tell dracut that we parsed the command line and all needed parameters are +# available. rootok=1 +# Tell dracut where the final root fs will be located. root=block:/dev/devicemapper/root diff --git a/builder/dnbd3-rootfs/hooks/pre-mount/fetch-config.sh b/builder/dnbd3-rootfs/hooks/pre-mount/fetch-config.sh index 0f4b24f2..4930c94a 100755 --- a/builder/dnbd3-rootfs/hooks/pre-mount/fetch-config.sh +++ b/builder/dnbd3-rootfs/hooks/pre-mount/fetch-config.sh @@ -13,7 +13,7 @@ for host in ${SLX_SERVER}; do done IFS="$IFS_backup" if [[ $return_code != 0 ]]; then - warn "Downloading OpenSLX configuration file from all server in \"${SLX_SERVER}\" in location \"${SLX_SERVER_BASE}${configuration_file_name}\" failed. Return code: $return_code" + warn "Downloading OpenSLX configuration file from any of the servers \"${SLX_SERVER}\" at location \"${SLX_SERVER_BASE}${configuration_file_name}\" failed. Return code: $return_code" emergency_shell -n "$0" return 1 fi diff --git a/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh b/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh index 9dfe5e3e..6fe86d12 100755 --- a/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh +++ b/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh @@ -29,19 +29,34 @@ systemd-preserve-process-marker qemu-nbd --connect="$nbd_device" \ "$SLX_DNBD3_DEVICE" --read-only local read_only_partition="$(utils.create_partition_via_offset "$nbd_device" \ "$SLX_SYSTEM_PARTITION_LABEL")" + # Make read-only partition writable. -# TODO implement persistent available indicator. +## detect partition for persistent storage +local persistent_device=$(utils.find_block_device \ + '$SLX_PERSISTENT_PARTITION_PATTERN_LABEL_UUID_TYPE') +local tmp_device=$(utils.find_block_device \ + '$SLX_TMP_PARTITION_PATTERN_LABEL_UUID_TYPE') +if [ -n $tmp_device ]; then + mount -t auto "$tmp_device" $NEWROOT/tmp +fi + local persistent="N" # 'P' for persistent storage, 'N' for not persistent -if true; then - modprobe brd max_part=1 rd_size=524288 - local writable_device="/dev/ram0" -else - # Use next free loop device. - local writable_device="$(losetup -f)" - dd if=/dev/zero of=persistent_storage.img bs=1k count=1000 - losetup "$writable_device" persistent_storage.img +local writable_device +if [ -n $persistent_device ]; then + writable_device=$persistent_device persistent="P" +else + modprobe brd max_part=1 rd_size=$SLX_RAMDISK_SIZE + writable_device="/dev/ram0" + persistent="N" fi + +# persistent storage on a filesystem (e.g. usb stick) +# writable_device="$(losetup -f)" +#dd if=/dev/zero of=persistent_storage.img bs=1k count=1000 +#losetup "$writable_device" persistent_storage.img +#persistent="P" + local partition_size="$(blockdev --getsz "$read_only_partition")" local writable_partition_name="root" local chunksize="1" diff --git a/builder/dnbd3-rootfs/scripts/rebash b/builder/dnbd3-rootfs/scripts/rebash -Subproject 9c466b7a080768202e786c203b25736d67a2ead +Subproject 60555ec672f3aca994d19c89cac47ae8e0b8666 diff --git a/dev-tools/example-openslx.config b/dev-tools/example-openslx.config index 7b085740..66b679af 100644 --- a/dev-tools/example-openslx.config +++ b/dev-tools/example-openslx.config @@ -4,6 +4,9 @@ SLX_DNBD3_RID='0' SLX_DNBD3_DEVICE='/dev/dnbd0' SLX_DNBD3_IMAGE='archLinux.vmdk' SLX_SYSTEM_PARTITION_LABEL='system' +SLX_PERSISTENT_PARTITION_PATTERN_LABEL_UUID_TYPE='' +SLX_TMP_PARTITION_PATTERN_LABEL_UUID_TYPE='' +SLX_RAMDISK_SIZE=524288 # TODO: Following parameter aren't supported yet. SLX_VM_NFS='132.230.4.1:/mnt/lehrpools/dnbd3' |