From: Ross Brattain Date: Wed, 20 Sep 2017 20:44:43 +0000 (+0000) Subject: Merge "ansible: resize VNF image" X-Git-Tag: opnfv-6.0.0~444 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=42f53e76396ef18b2b4078e90c3bca96dd4cec69;hp=2761306b3d9fa31b192a44129de5bb5d39279d73;p=yardstick.git Merge "ansible: resize VNF image" --- diff --git a/ansible/build_yardstick_image.yml b/ansible/build_yardstick_image.yml index 5f9158576..35d9da45e 100644 --- a/ansible/build_yardstick_image.yml +++ b/ansible/build_yardstick_image.yml @@ -87,6 +87,12 @@ - name: convert image to raw command: "qemu-img convert {{ image_dest }} {{ raw_imgfile }}" + - name: resize image to allow for more VNFs + command: "qemu-img resize -f raw {{ raw_imgfile }} +2G" + + - name: resize parition to allow for more VNFs + command: "parted -s -a optimal {{ raw_imgfile }} resizepart 1 100%" + - name: create mknod devices in chroot command: "mknod -m 0660 /dev/loop{{ item }} b 7 {{ item }}" args: @@ -124,6 +130,18 @@ - set_fact: image_fs_type: "{{ blkid_res.stdout.strip() }}" + - fail: + msg: "We only support ext4 image filesystems because we have to resize" + when: image_fs_type != "ext4" + + - name: fsck the image filesystem + command: "e2fsck -y -f {{ image_first_partition_device }}" + + - name: resize filesystem to full partition size + command: resize2fs {{ image_first_partition_device }} + + - name: fsck the image filesystem + command: "e2fsck -y -f {{ image_first_partition_device }}" - name: make tmp disposable fstab command: mktemp --tmpdir fake_fstab.XXXXXXXXXX