Revision d509231b snf-image-host/xen-common.sh

b/snf-image-host/xen-common.sh
2 2
	echo /dev/xvdb
3 3
}
4 4

  
5
#create_mac() {
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/:$//;')"
8
#}
9

  
5 10
launch_helper() {
6
	local name helperid rc blockdev floppy
11
    local name helperid rc blockdev floppy host_mac helper_mac
7 12

  
8
	blockdev="$1"
9
	floppy="$2"
13
    blockdev="$1"
14
    floppy="$2"
10 15

  
11 16
	name=$(uuid)
12 17

  
13
	report_info "Starting customization VM..."
14
	echo "$($DATE +%Y:%m:%d-%H:%M:%S.%N) VM START" >&2
18
    report_info "Starting customization VM..."
19
    echo "$($DATE +%Y:%m:%d-%H:%M:%S.%N) VM START" >&2
15 20

  
16 21
    xm create /dev/null \
17 22
      kernel="$HELPER_DIR/kernel-xen" ramdisk="$HELPER_DIR/initrd-xen" \
18 23
	  root="/dev/xvda1" memory="256" boot="c" vcpus=1 name="$name" \
19 24
      extra="console=hvc0 hypervisor=$HYPERVISOR snf_image_activate_helper \
20
      rules_dev=/dev/xvdc quiet ro boot=local init=/usr/bin/snf-image-helper" \
25
	  ipv6.disable=1 rules_dev=/dev/xvdc ro boot=local init=/usr/bin/snf-image-helper" \
21 26
      disk="file:$HELPER_DIR/image,xvda,r" disk="phy:$blockdev,xvdb,w" \
22
      disk="file:$floppy,xvdc,r" vif="mac=aa:00:00:00:00:11,bridge=$XEN_BRIDGE" \
27
      disk="file:$floppy,xvdc,r" vif="script=${XEN_SCRIPTS_DIR}/vif-snf-image"
23 28

  
24 29
    if ! xenstore-exists snf-image-helper; then
25 30
        xenstore-write snf-image-helper ""
......
28 33

  
29 34
    helperid=$(xm domid "$name")
30 35
    xenstore-write snf-image-helper/${helperid} ""
31
	add_cleanup xenstore-rm snf-image-helper/${helperid}
36
    add_cleanup xenstore-rm snf-image-helper/${helperid}
32 37
    xenstore-chmod snf-image-helper/${helperid} r0 w${helperid}
33 38

  
34
    brctl delif xenbr "vif${helperid}.0"
35

  
36 39
    socat EXEC:"./helper-monitor.py ${MONITOR_FD}" INTERFACE:vif${helperid}.0 &
37 40

  
38
	set +e
41
    set +e
39 42

  
40 43
    $TIMEOUT -k $HELPER_HARD_TIMEOUT $HELPER_SOFT_TIMEOUT \
41 44
      socat EXEC:"xm console $name",pty STDOUT | sed -u 's|^|HELPER: |g'
42 45

  
43
	rc=$?
44
	set -e
46
    rc=$?
47
    set -e
45 48

  
46 49
    echo "$($DATE +%Y:%m:%d-%H:%M:%S.%N) VM STOP" >&2
47 50
    if [ $rc -ne 0 ]; then
......
76 79
    fi
77 80
}
78 81

  
82
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :

Also available in: Unified diff