Revision b206849d snf-image-host/create
b/snf-image-host/create | ||
---|---|---|
41 | 41 |
image_file="$IMAGE_DIR/$IMAGE_NAME-$ARCH.extdump";; |
42 | 42 |
ntfsdump) |
43 | 43 |
image_file="$IMAGE_DIR/$IMAGE_NAME-$ARCH.ntfsdump";; |
44 |
diskdump) |
|
45 |
image_file="$IMAGE_DIR/$IMAGE_NAME-$ARCH.diskdump";; |
|
44 | 46 |
*) |
45 | 47 |
log_error "Unknown image type: \`$IMAGE_TYPE'."; |
46 | 48 |
exit 1 |
... | ... | |
66 | 68 |
add_cleanup "$LOSETUP" -d "$blockdev" |
67 | 69 |
fi |
68 | 70 |
|
69 |
format_disk0 "$blockdev" "$IMAGE_TYPE" |
|
70 |
|
|
71 |
filesystem_dev=$(map_disk0 "$blockdev") |
|
72 |
add_cleanup unmap_disk0 "$blockdev" |
|
73 |
|
|
74 |
root_dev="${filesystem_dev}-1" |
|
71 |
case "$IMAGE_TYPE" in |
|
72 |
ntfsdump, extdump) |
|
73 |
format_disk0 "$blockdev" "$IMAGE_TYPE" |
|
74 |
|
|
75 |
target="$(map_disk0 "$blockdev")-1" #the root device |
|
76 |
add_cleanup unmap_disk0 "$blockdev" |
|
77 |
;; |
|
78 |
diskdump) |
|
79 |
target="$blockdev" |
|
80 |
;; |
|
81 |
esac |
|
75 | 82 |
|
76 | 83 |
# dd the dump to its new home :-) |
77 |
# Deploying an image file on a target block device is a streaming |
|
78 |
# copy operation. Enable the direct I/O flag on the output fd to
|
|
79 |
# avoid polluting the host cache with useless data.
|
|
80 |
$monitor dd bs=4M if="$image_file" of="$root_dev" oflag=direct
|
|
84 |
# Deploying an image file on a target block device is a streaming copy
|
|
85 |
# operation. Enable the direct I/O flag on the output fd to avoid polluting the
|
|
86 |
# host cache with useless data. |
|
87 |
$monitor dd bs=4M if="$image_file" of="$target" oflag=direct
|
|
81 | 88 |
|
82 | 89 |
# Create a floppy image |
83 | 90 |
floppy=$(mktemp --tmpdir floppy.XXXXXX) |
... | ... | |
105 | 112 |
echo "$(date +%Y:%m:%d-%H:%M:%S.%N) Starting helper VM..." |
106 | 113 |
"$TIMELIMIT" -t "$HELPER_SOFT_TIMEOUT" -T "$HELPER_HARD_TIMEOUT" \ |
107 | 114 |
kvm -runas "$HELPER_USER" -drive file="$snapshot" \ |
108 |
-drive file="$root_dev",format=raw,if=virtio,cache=none \
|
|
115 |
-drive file="$blockdev",format=raw,if=virtio,cache=none \
|
|
109 | 116 |
-boot c -serial stdio -serial file:"$result_file" \ |
110 | 117 |
-fda "$floppy" -vga none -nographic -parallel none -monitor null \ |
111 | 118 |
-kernel "$HELPER_KERNEL" -initrd "$HELPER_INITRD" \ |
Also available in: Unified diff