diff options
| author | torben | 2015-11-06 13:52:41 +0100 |
|---|---|---|
| committer | torben | 2015-11-06 13:52:41 +0100 |
| commit | 3f051116a8f35b76d98de2dee32641e409109f69 (patch) | |
| tree | 10147547e7141e1ab3f153720898bb10036e2fba | |
| parent | Improve build process. (diff) | |
| download | systemd-init-3f051116a8f35b76d98de2dee32641e409109f69.tar.gz systemd-init-3f051116a8f35b76d98de2dee32641e409109f69.tar.xz systemd-init-3f051116a8f35b76d98de2dee32641e409109f69.zip | |
Improve debugging features.
| -rwxr-xr-x | builder/dnbd3-rootfs/hooks/pre-mount/mount-qcow.sh | 18 | ||||
| -rwxr-xr-x | builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh | 18 |
2 files changed, 22 insertions, 14 deletions
diff --git a/builder/dnbd3-rootfs/hooks/pre-mount/mount-qcow.sh b/builder/dnbd3-rootfs/hooks/pre-mount/mount-qcow.sh index d70492bf..290bc213 100755 --- a/builder/dnbd3-rootfs/hooks/pre-mount/mount-qcow.sh +++ b/builder/dnbd3-rootfs/hooks/pre-mount/mount-qcow.sh @@ -26,19 +26,19 @@ fi # ok, let's source the setup script if ! . ${SETUP_ROOTFS_SCRIPT} ; then - warn "Could not source: ${SETUP_ROOTFS_SCRIPT}" - emergency_shell -n "Error in $0" - return 1 + warn "Could not source: ${SETUP_ROOTFS_SCRIPT}" + emergency_shell -n "Error in $0" + return 1 fi # just go over the functions in the right order ;-) for fun in connect_dnbd3 create_qcow export_qcow connect_qcow; do - if ! $fun; then - # something failed, drop a shell for debugging - warn "'$fun' failed with: $?" - emergency_shell -n "Error in $fun" - return 1 - fi + if ! $fun; then + # something failed, drop a shell for debugging + warn "'$fun' failed with: $?" + emergency_shell -n "Error in $fun" + return 1 + fi done # all good, we are done 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 2e60061f..f84dec4f 100755 --- a/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh +++ b/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh @@ -7,11 +7,18 @@ declare -rg DNBD3_DEVICE="/dev/dnbd0" # Close previous connections to be able to run this script many times. dnbd3-client --device "$DNBD3_DEVICE" --close && \ -dnbd3-client --host "$DNBD3_SERVER" --image "$DNBD3_IMAGE" --device \ - "$DNBD3_DEVICE" --rid "$DNBD3_RID" && \ -qemu-nbd --connect=/dev/nbd0 "$DNBD3_DEVICE" --read-only && \ -local read_only_partition="$(utils_create_partition_via_offset \ - /dev/nbd0 system)" && \ +if ! dnbd3-client --host "$DNBD3_SERVER" --image "$DNBD3_IMAGE" --device \ + "$DNBD3_DEVICE" --rid "$DNBD3_RID" +then + warn "Failed to connect $DNBD3_IMAGE from $DNBD3_SERVER to $DNBD3_DEVICE" + emergency_shell -n "Error in $0" + return 1 +fi +local nbd_device='/dev/nbd0' && \ +qemu-nbd --connect="$nbd_device" "$DNBD3_DEVICE" --read-only && \ +# TODO make partition label configurable. +local read_only_partition="$(utils_create_partition_via_offset "$nbd_device" \ + system)" && \ # Make read-only partition writable. # TODO implement persistent available indicator. local persistent="N" # 'P' for persistent storage, 'N' for not persistent @@ -34,5 +41,6 @@ modprobe dm_snapshot dmsetup create "$writable_partition_name" --table \ "0 $partition_size snapshot $read_only_partition $writable_device $persistent $chunksize" dmsetup mknodes "$writable_partition_name" +# TODO remove after debugging. warn "ls /dev/mapper: " warn $(ls /dev/mapper/) |
