attach_ceph_image.patch

alan zhang, 08/08/2013 02:32 AM

Download (1.24 KB)

View differences:

/var/lib/one/remotes/vmm/kvm/attach_disk 2013-08-08 10:26:44.475901648 +0800
40 40
done < <($XPATH     $DISK_XPATH/DRIVER \
41 41
                    $DISK_XPATH/TYPE \
42 42
                    $DISK_XPATH/READONLY \
43
                    $DISK_XPATH/CACHE)
43
                    $DISK_XPATH/CACHE \
44
                    $DISK_XPATH/IMAGE_ID)
44 45

  
45 46
DRIVER="${XPATH_ELEMENTS[0]:-$DEFAULT_TYPE}"
46 47
TYPE="${XPATH_ELEMENTS[1]}"
47 48
READONLY="${XPATH_ELEMENTS[2]}"
48 49
CACHE="${XPATH_ELEMENTS[3]}"
50
IMAGE="${XPATH_ELEMENTS[4]}"
49 51

  
50 52
TYPE=$(echo "$TYPE"|tr A-Z a-z)
51 53

  
54
ATTACH_FILE="$SOURCE.attach"
55

  
52 56
case "$TYPE" in
53 57
block)
54 58
    TYPE_SOURCE="dev"
......
60 64
    TYPE_XML="file"
61 65
    DEVICE="cdrom"
62 66
    ;;
67
rbd)
68
    TYPE_SOURCE="protocol"
69
    TYPE_XML="network"
70
    SOURCE="'rbd' name='one/one-$IMAGE'"
71
    DEVICE="disk"
72
    ;;
63 73
*) 
64 74
    #NOTE: This includes TYPE=FS and TYPE=SWAP
65 75
    TYPE_SOURCE="file"
......
78 88
    READONLY=""
79 89
fi
80 90

  
81
ATTACH_FILE="$SOURCE.attach"
82 91

  
83 92
cat <<EOF > $ATTACH_FILE
84 93
<disk type='$TYPE_XML' device='$DEVICE'>
85 94
  <driver name='qemu' type='$DRIVER' $CACHE/>
86
  <source $TYPE_SOURCE='$SOURCE'/>
95
  <source $TYPE_SOURCE=$SOURCE/>
87 96
  <target dev='$TARGET'/>
88 97
  $READONLY
89 98
</disk>