Use standard tools for resize

ubuntu/yakkety
Ben Howard 9 years ago
parent 9a87b066cf
commit 4a752e14c0

@ -112,16 +112,17 @@ create_vmdk() {
src="$1" src="$1"
destination="$2" destination="$2"
size="${3:-102400}" size="${3:-10240}"
apt-get install -qqy qemu-utils vmdk-stream-converter apt-get install -qqy qemu-utils vmdk-stream-converter
streamconverter="/usr/share/pyshared/VMDKstream.py" streamconverter="/usr/share/pyshared/VMDKstream.py"
scratch_d=$(mktemp -d) scratch_d=$(mktemp -d)
cp ${src} ${scratch_d}/resize.img cp ${src} ${scratch_d}/resize.img
qemu-img resize ${scratch_d}/resize.img ${size}M
truncate --size=${size}M ${scratch_d}/resize.img
python ${streamconverter} ${scratch_d}/resize.img "${destination}" python ${streamconverter} ${scratch_d}/resize.img "${destination}"
modify_vmdk_header "${destination}" modify_vmdk_header "${destination}"
qemu-img info "${destination}" qemu-img info "${destination}"
rm -rf ${scratch_d} rm -rf ${scratch_d}

Loading…
Cancel
Save