Resize VCP images

Related-Prod: PROD-24537
Closes-Bug: #PROD-25991
Change-Id: Ib5097eaa0bff0aba1d91733589f734be207325b4
diff --git a/tcp_tests/templates/cookied-cicd-k8s-genie/underlay--user-data-cfg01.yaml b/tcp_tests/templates/cookied-cicd-k8s-genie/underlay--user-data-cfg01.yaml
deleted file mode 100644
index 4c43578..0000000
--- a/tcp_tests/templates/cookied-cicd-k8s-genie/underlay--user-data-cfg01.yaml
+++ /dev/null
@@ -1,101 +0,0 @@
-| # All the data below will be stored as a string object
-  #cloud-config, see http://cloudinit.readthedocs.io/en/latest/topics/examples.html
-
-  ssh_pwauth: True
-  users:
-   - name: root
-     sudo: ALL=(ALL) NOPASSWD:ALL
-     shell: /bin/bash
-     ssh_authorized_keys:
-     {% for key in config.underlay.ssh_keys %}
-      - ssh-rsa {{ key['public'] }}
-     {% endfor %}
-
-  disable_root: false
-  chpasswd:
-   list: |
-    root:r00tme
-   expire: False
-
-  bootcmd:
-   # Block access to SSH while node is preparing
-   - cloud-init-per once sudo touch /is_cloud_init_started
-   # Enable root access
-   - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
-   - service sshd restart
-
-  output:
-    all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
-
-  runcmd:
-   - echo "******** MOUNT CONFIG DRIVE"
-   # Mount config drive
-   - mkdir /root/config-drive
-   - mount /dev/sr0 /root/config-drive
-
-   # Configure dhclient
-   - sudo echo "nameserver {gateway}" >> /etc/resolvconf/resolv.conf.d/base
-   - sudo resolvconf -u
-
-   # Enable grub menu using updated config below
-   - update-grub
-
-   # Prepare network connection
-   #- sudo ifdown ens3
-   #- sudo ip r d default || true  # remove existing default route to get it from dhcp
-   #- sudo ifup ens3
-   #- sudo route add default gw {gateway} {interface_name}
-
-   # Create swap
-   - fallocate -l 16G /swapfile
-   - chmod 600 /swapfile
-   - mkswap /swapfile
-   - swapon /swapfile
-   - echo "/swapfile   none    swap    defaults    0   0" >> /etc/fstab
-
-   # Run user data script from config drive
-   - ifdown --force ens3; ifconfig ens3 down; ip a flush dev ens3; rm -f /var/run/network/ifstate.ens3; ip l set down ens3
-   - ifdown --force ens4; ifconfig ens4 down; ip a flush dev ens4; rm -f /var/run/network/ifstate.ens4; ip l set down ens4
-   - rm -f /etc/network/interfaces
-   #- ifdown --force ens5; ifconfig ens5 down; ip a flush dev ens5; rm -f /var/run/network/ifstate.ens5
-   #- cp /root/config-drive/user-data /root/user-data
-   #- sed -i '/^reboot$/d' /root/user-data
-   #- set -x; cd /root && /bin/bash -xe ./user-data
-   - |
-     set -x
-     cd /root/config-drive
-     if /bin/bash -xe ./user-data; then
-         touch /is_cloud_init_finished
-     else
-         set +x
-         echo "bootstrap script /root/config-drive/user-data failed\n" > /is_cloud_init_failed
-     fi
-
-   # Enable root access (after reboot)
-   - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
-
-  write_files:
-   - path: /etc/default/grub.d/97-enable-grub-menu.cfg
-     content: |
-         GRUB_RECORDFAIL_TIMEOUT=30
-         GRUB_TIMEOUT=3
-         GRUB_TIMEOUT_STYLE=menu
-
-   #- path: /etc/network/interfaces
-   - path: /root/interfaces
-     content: |
-          auto lo
-          iface lo inet loopback
-
-          auto ens3
-          iface ens3 inet dhcp
-
-   - path: /root/.ssh/config
-     owner: root:root
-     permissions: '0600'
-     content: |
-          Host *
-            ServerAliveInterval 60
-            ServerAliveCountMax 0
-            StrictHostKeyChecking no
-            UserKnownHostsFile /dev/null
diff --git a/tcp_tests/templates/cookied-cicd-k8s-genie/underlay--user-data1604-swp.yaml b/tcp_tests/templates/cookied-cicd-k8s-genie/underlay--user-data1604-swp.yaml
index 319c007..d3d97a4 100644
--- a/tcp_tests/templates/cookied-cicd-k8s-genie/underlay--user-data1604-swp.yaml
+++ b/tcp_tests/templates/cookied-cicd-k8s-genie/underlay--user-data1604-swp.yaml
@@ -25,6 +25,9 @@
     all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
 
   runcmd:
+   - if lvs vg0; then pvresize /dev/vda3; fi
+   - if lvs vg0; then /usr/bin/growlvm.py --image-layout-file /usr/share/growlvm/image-layout.yml; fi
+
    - export TERM=linux
    - export LANG=C
    # Configure dhclient
@@ -57,3 +60,25 @@
           auto ens3
           iface ens3 inet dhcp
 
+   - path: /usr/share/growlvm/image-layout.yml
+     content: |
+       root:
+         size: '50%VG'
+       home:
+         size: '100M'
+       var_log:
+         size: '15%VG'
+       var_log_audit:
+         size: '500M'
+       var_tmp:
+         size: '500M'
+       tmp:
+         size: '500M'
+     owner: root:root
+
+  growpart:
+    mode: auto
+    devices:
+      - '/'
+      - '/dev/vda3'
+    ignore_growroot_disabled: false
diff --git a/tcp_tests/templates/cookied-cicd-k8s-genie/underlay--user-data1604.yaml b/tcp_tests/templates/cookied-cicd-k8s-genie/underlay--user-data1604.yaml
index b1b6430..730382e 100644
--- a/tcp_tests/templates/cookied-cicd-k8s-genie/underlay--user-data1604.yaml
+++ b/tcp_tests/templates/cookied-cicd-k8s-genie/underlay--user-data1604.yaml
@@ -25,6 +25,9 @@
     all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
 
   runcmd:
+   - if lvs vg0; then pvresize /dev/vda3; fi
+   - if lvs vg0; then /usr/bin/growlvm.py --image-layout-file /usr/share/growlvm/image-layout.yml; fi
+
    - export TERM=linux
    - export LANG=C
    # Configure dhclient
@@ -57,3 +60,25 @@
           auto ens3
           iface ens3 inet dhcp
 
+   - path: /usr/share/growlvm/image-layout.yml
+     content: |
+       root:
+         size: '50%VG'
+       home:
+         size: '100M'
+       var_log:
+         size: '15%VG'
+       var_log_audit:
+         size: '500M'
+       var_tmp:
+         size: '500M'
+       tmp:
+         size: '500M'
+     owner: root:root
+
+  growpart:
+    mode: auto
+    devices:
+      - '/'
+      - '/dev/vda3'
+    ignore_growroot_disabled: false