Revision 227737e1
b/snf-image-host/create | ||
---|---|---|
32 | 32 |
{ sleep 1; $PROGRESS_MONITOR "$instance" < "$monitor_pipe" ; } & |
33 | 33 |
monitor_pid="$!" |
34 | 34 |
else |
35 |
sed -u 's|^|MONITOR MSG: |g' < "$monitor_pipe" &
|
|
35 |
sed -u 's|^|[MONITOR] |g' < "$monitor_pipe" &
|
|
36 | 36 |
monitor_pid="$!" |
37 | 37 |
fi |
38 | 38 |
|
... | ... | |
52 | 52 |
image_file="$IMAGE_DIR/$(echo "$IMAGE_NAME" | sed 's/^file://').$IMAGE_TYPE" |
53 | 53 |
if [ ! -e "$image_file" ]; then |
54 | 54 |
log_error "Image file \`$image_file' does not exit." |
55 |
report_error "Unable to retrieve image." |
|
55 |
report_error "Unable to retrieve image file."
|
|
56 | 56 |
exit 1 |
57 | 57 |
fi |
58 | 58 |
image_size="$(stat -L -c %s "$image_file")" |
... | ... | |
158 | 158 |
|
159 | 159 |
"$QEMU_IMG" create -f qcow2 -b "$HELPER_IMG" "$snapshot" |
160 | 160 |
|
161 |
echo -n "$($DATE +%Y:%m:%d-%H:%M:%S.%N) " >&2 |
|
162 | 161 |
report_info "Starting customization VM..." |
162 |
echo "$($DATE +%Y:%m:%d-%H:%M:%S.%N) VM START" >&2 |
|
163 | 163 |
set +e |
164 | 164 |
$TIMEOUT -k "$HELPER_HARD_TIMEOUT" "$HELPER_SOFT_TIMEOUT" \ |
165 | 165 |
kvm -runas "$HELPER_USER" -drive file="$snapshot" \ |
... | ... | |
172 | 172 |
2>&1 | sed -u 's|^|HELPER: |g' |
173 | 173 |
rc=$? |
174 | 174 |
set -e |
175 |
echo "$($DATE +%Y:%m:%d-%H:%M:%S.%N) VM STOP" >&2 |
|
175 | 176 |
if [ $rc -ne 0 ]; then |
176 | 177 |
if [ $rc -eq 124 ]; then |
177 |
log_error "Image customization was terminated. Did not finish on time."
|
|
178 |
report_error "Image customization was terminated. Did not finish on time."
|
|
178 |
log_error "Customization VM was terminated. Did not finish on time."
|
|
179 |
report_error "Image customization failed. Did not finish on time."
|
|
179 | 180 |
elif [ $rc -eq 137 ]; then # (128 + SIGKILL) |
180 |
log_error "Image customization was killed. Did not finish on time."
|
|
181 |
report_error "Image customization was killed. Did not finish on time."
|
|
181 |
log_error "Customization VM was killed. Did not finish on time."
|
|
182 |
report_error "Image customization failed. Did not finish on time."
|
|
182 | 183 |
elif [ $rc -eq 141 ]; then # (128 + SIGPIPE) |
183 |
log_error "Image customization was terminated by a SIGPIPE."
|
|
184 |
log_error "Customization VM was terminated by a SIGPIPE."
|
|
184 | 185 |
log_error "Maybe progress monitor has died unexpectedly." |
185 | 186 |
elif [ $rc -eq 125 ]; then |
186 | 187 |
log_error "Internal Error. Image customization could not start." |
187 | 188 |
log_error "timeout did not manage to run." |
188 | 189 |
else |
189 |
log_error "Image customization died unexpectedly (return code $rc)."
|
|
190 |
log_error "Customization VM died unexpectedly (return code $rc)."
|
|
190 | 191 |
fi |
191 | 192 |
exit 1 |
192 | 193 |
else |
193 |
echo -n "$($DATE +%Y:%m:%d-%H:%M:%S.%N)" >&2 |
|
194 |
report_info "Customization VM finished." |
|
194 |
report_info "Customization VM exited normally." |
|
195 | 195 |
fi |
196 | 196 |
|
197 |
report_info "Checking customization status..." |
|
197 | 198 |
# Read the first line. This will remove \r and \n chars |
198 | 199 |
result=$(sed 's|\r||g' "$result_file" | head -1) |
199 | 200 |
|
Also available in: Unified diff