Revision 7836baff snf-image-host/create
b/snf-image-host/create | ||
---|---|---|
152 | 152 |
"$QEMU_IMG" create -f qcow2 -b "$HELPER_IMG" "$snapshot" |
153 | 153 |
|
154 | 154 |
echo "$(date +%Y:%m:%d-%H:%M:%S.%N) Starting helper VM..." |
155 |
$TIMELIMIT -t "$HELPER_SOFT_TIMEOUT" -T "$HELPER_HARD_TIMEOUT" \ |
|
155 |
set +e |
|
156 |
$TIMEOUT -k "$HELPER_HARD_TIMEOUT" "$HELPER_SOFT_TIMEOUT" \ |
|
156 | 157 |
kvm -runas "$HELPER_USER" -drive file="$snapshot" \ |
157 | 158 |
-drive file="$blockdev",format=raw,if=virtio,cache=none \ |
158 | 159 |
-boot c -serial stdio -serial "file:$(printf "%q" "$result_file")" \ |
... | ... | |
161 | 162 |
-kernel "$HELPER_KERNEL" -initrd "$HELPER_INITRD" \ |
162 | 163 |
-append "quiet ro root=/dev/sda1 console=ttyS0,9600n8 snf_image_activate_helper" \ |
163 | 164 |
2>&1 | sed 's|^|HELPER: |g' |
164 |
echo "$(date +%Y:%m:%d-%H:%M:%S.%N) Helper VM finished." |
|
165 |
|
|
166 |
if [ $? -ne 0 ]; then |
|
167 |
if [ $? -gt 128 ]; then |
|
168 |
log_error "Helper was terminated. Did not finish on time." |
|
165 |
rc=$? |
|
166 |
set -e |
|
167 |
if [ $rc -ne 0 ]; then |
|
168 |
if [ $rc -eq 124 ]; then |
|
169 |
log_error "Helper VM was terminated. Did not finish on time." |
|
170 |
if [ $rc -eq 137 ]; then # (128 + SIGKILL) |
|
171 |
log_error "Helper VM was killed. Did not finish on time." |
|
172 |
elif [ $rc -eq 141 ]; then # (128 + SIGPIPE) |
|
173 |
log_error "Helper was killed by a SIGPIPE signal." |
|
174 |
log_error "Maybe progress monitor has died unexpectedly." |
|
175 |
elif [ $rc -eq 125 ]; then |
|
176 |
log_error "timeout did not manage to run." |
|
177 |
else |
|
178 |
log_error "KVM returned an error (return code $rc)." |
|
169 | 179 |
fi |
170 | 180 |
exit 1 |
181 |
else |
|
182 |
echo "$(date +%Y:%m:%d-%H:%M:%S.%N) Helper VM finished." |
|
171 | 183 |
fi |
172 | 184 |
|
173 | 185 |
# Do not report errors after this. If the result is not "SUCCESS" then the |
Also available in: Unified diff