0013-Convert-image-to-qcow2-format-if-DRIVER-is-qcow2.patch

Jean-Philippe Garcia Ballester, 04/26/2013 08:30 AM

Download (2.35 KB)

View differences:

src/datastore_mad/remotes/fs/mkfs
51 51
                    /DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/UMASK \
52 52
                    /DS_DRIVER_ACTION_DATA/IMAGE/FSTYPE \
53 53
                    /DS_DRIVER_ACTION_DATA/IMAGE/SIZE \
54
                    /DS_DRIVER_ACTION_DATA/IMAGE/NAME)
54
                    /DS_DRIVER_ACTION_DATA/IMAGE/NAME \
55
                    /DS_DRIVER_ACTION_DATA/IMAGE/TEMPLATE/DRIVER)
55 56

  
56 57

  
57 58
BASE_PATH="${XPATH_ELEMENTS[0]}"
......
61 62
FSTYPE="${XPATH_ELEMENTS[4]}"
62 63
SIZE="${XPATH_ELEMENTS[5]}"
63 64
NAME="${XPATH_ELEMENTS[6]}"
65
DRIVER="${XPATH_ELEMENTS[7]}"
64 66

  
65 67
mkdir -p "$BASE_PATH"
66 68
set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK"
......
83 85
exec_and_log "$MKFS_CMD" \
84 86
    "Unable to create filesystem $FSTYPE in $DST"
85 87

  
88
case "$DRIVER" in
89
    "qcow2")
90
        exec_and_log "$MV $DST $DST.raw" \
91
            "Could not move temporary raw image"
92
        exec_and_log "$QEMU_IMG convert $DST.raw -O qcow2 $DST" \
93
            "Could not convert temporary row image to qcow2"
94
        exec_and_log "$RM $DST.raw" \
95
            "Could not remove temporary raw image"
96
        ;;
97
esac
98

  
86 99
echo "$DST"
src/mad/sh/scripts_common.sh
35 35
MKFS=mkfs
36 36
MKISOFS=genisoimage
37 37
MKSWAP=mkswap
38
MV=mv
38 39
QEMU_IMG=qemu-img
39 40
RBD=rbd
40 41
READLINK=readlink
41
-