opennebula-5.2.1-mkswapsparse.diff

Patch against OpenNebula 5.2.1 which implements the use of a sparse file, untested - Roy Keene, 04/19/2017 04:54 PM

Download (1.11 KB)

View differences:

opennebula-5.2.1-mkswapsparse/src/tm_mad/ceph/mkimage 2017-04-19 11:51:00.207273149 -0500
97 97

  
98 98
MKIMAGE_CMD=$(cat <<EOF
99 99
    export PATH=/usr/sbin:/sbin:\$PATH
100
    $RBD create $FORMAT_OPT $RBD_SOURCE --size ${SIZE} || exit \$?
101

  
102 100
    if [ "$FSTYPE" = "swap" ]; then
103
        $SUDO $RBD map $RBD_SOURCE || exit \$?
104
        $SUDO $MKSWAP -L swap /dev/rbd/$RBD_SOURCE
105
        $SUDO $RBD unmap /dev/rbd/$RBD_SOURCE
101
        tmpfile="\$(mktemp)" && \
102
                dd if=/dev/zero of="\${tmpfile}" bs=$[1024*1024] seek=$[${SIZE} - 1] count=1 2>/dev/null && \
103
                mkswap "\${tmpfile}" && \
104
                dd if="\${tmpfile}" bs=\$(getconf PAGESIZE) count=1 2>/dev/null | $RBD import - $RBD_SOURCE && \
105
                $RBD resize --size ${SIZE}M $RBD_SOURCE
106
        rm -f "\${tmpfile}" 
107
    else
108
        $RBD create $FORMAT_OPT $RBD_SOURCE --size ${SIZE} || exit \$?
106 109
    fi
107 110
EOF
108 111
)