6 # # MAC address inside the range 00:16:3e:xx:xx:xx are reserved for Xen
7 # echo "aa:$(cat /proc/interrupts | md5sum | sed -r 's/^(.{10}).*$/\1/; s/([0-9a-f]{2})/\1:/g; s/:$//;')"
11 local name helperid rc blockdev floppy host_mac helper_mac
18 report_info "Starting customization VM..."
19 echo "$($DATE +%Y:%m:%d-%H:%M:%S.%N) VM START" >&2
22 kernel="$HELPER_DIR/kernel-xen" ramdisk="$HELPER_DIR/initrd-xen" \
23 root="/dev/xvda1" memory="256" boot="c" vcpus=1 name="$name" \
24 extra="console=hvc0 hypervisor=$HYPERVISOR snf_image_activate_helper \
25 ipv6.disable=1 rules_dev=/dev/xvdc ro boot=local helper_ip=10.0.0.1 \
26 monitor_port=48888 init=/usr/bin/snf-image-helper" \
27 disk="file:$HELPER_DIR/image,xvda,r" disk="phy:$blockdev,xvdb,w" \
28 disk="file:$floppy,xvdc,r" vif="script=${XEN_SCRIPTS_DIR}/vif-snf-image"
29 add_cleanup suppress_errors xm destroy "$name"
31 if ! xenstore-exists snf-image-helper; then
32 xenstore-write snf-image-helper ""
33 #add_cleanup xenstore-rm snf-image-helper
36 helperid=$(xm domid "$name")
37 xenstore-write snf-image-helper/${helperid} ""
38 add_cleanup xenstore-rm snf-image-helper/${helperid}
39 xenstore-chmod snf-image-helper/${helperid} r0 w${helperid}
41 filter='udp and dst port 48888 and dst host 10.0.0.255 and src host 10.0.0.1'
42 $TIMEOUT -k $HELPER_HARD_TIMEOUT $HELPER_SOFT_TIMEOUT \
43 ./helper-monitor.py -i "vif${helperid}.0" -f "$filter" ${MONITOR_FD} &
47 $TIMEOUT -k $HELPER_HARD_TIMEOUT $HELPER_SOFT_TIMEOUT \
48 socat EXEC:"xm console $name",pty STDOUT | sed -u 's|^|HELPER: |g'
52 echo "$($DATE +%Y:%m:%d-%H:%M:%S.%N) VM STOP" >&2
61 if [ $monitor_rc -ne 0 ]; then
62 log_error "Helper VM monitoring failed"
63 report_error "Helper VM monitoring failed"
67 report_info "Checking customization status..."
68 result=$(xenstore-read snf-image-helper/$helperid)
69 report_info "Customization status is: $result"
71 check_helper_result "$result"
74 # vim: set sta sts=4 shiftwidth=4 sw=4 et ai :