aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/testbed-setup/ansible
diff options
context:
space:
mode:
authorjuraj.linkes <juraj.linkes@pantheon.tech>2019-07-10 11:10:34 +0200
committerjuraj.linkes <juraj.linkes@pantheon.tech>2019-07-10 13:50:39 +0200
commite45404bf7b8cbdb10adf85815c2e005134e463ad (patch)
treedd1b3d44cfc31beee9c0f31734595a32bf1ec30f /resources/tools/testbed-setup/ansible
parentd5a0c7319ac12bbf56cfae8d9c6778bb2834f7dd (diff)
Modify kernel VM download to custom build
Instead of downloading linux-image-kvm, build custom initrd from currently used kernel on perf sut or vpp device host. Change-Id: I836f9c5264695c44566b7d52f3ec03e26a474524 Signed-off-by: juraj.linkes <juraj.linkes@pantheon.tech>
Diffstat (limited to 'resources/tools/testbed-setup/ansible')
-rw-r--r--resources/tools/testbed-setup/ansible/roles/common/files/initramfs_modules4
-rw-r--r--resources/tools/testbed-setup/ansible/roles/common/tasks/kernel_install.yaml45
-rw-r--r--resources/tools/testbed-setup/ansible/roles/sut/tasks/ubuntu_bionic.yaml20
-rw-r--r--resources/tools/testbed-setup/ansible/roles/vpp_device/tasks/main.yaml4
4 files changed, 56 insertions, 17 deletions
diff --git a/resources/tools/testbed-setup/ansible/roles/common/files/initramfs_modules b/resources/tools/testbed-setup/ansible/roles/common/files/initramfs_modules
new file mode 100644
index 0000000000..00ae8e03e7
--- /dev/null
+++ b/resources/tools/testbed-setup/ansible/roles/common/files/initramfs_modules
@@ -0,0 +1,4 @@
+9p
+9pnet
+9pnet_virtio
+vfio-pci \ No newline at end of file
diff --git a/resources/tools/testbed-setup/ansible/roles/common/tasks/kernel_install.yaml b/resources/tools/testbed-setup/ansible/roles/common/tasks/kernel_install.yaml
new file mode 100644
index 0000000000..c215085d69
--- /dev/null
+++ b/resources/tools/testbed-setup/ansible/roles/common/tasks/kernel_install.yaml
@@ -0,0 +1,45 @@
+---
+# file: roles/common/tasks/kernel_install.yaml
+
+- name: Backup remote initramfs modules
+ copy:
+ src: '/etc/initramfs-tools/modules'
+ dest: '/etc/initramfs-tools/modules.bkp'
+ remote_src: yes
+ tags: install-kernel-image
+
+- name: Update initramfs modules
+ copy:
+ src: '../files/initramfs_modules'
+ dest: '/etc/initramfs-tools/modules'
+ tags: install-kernel-image
+
+- name: Create target kernel dir
+ file:
+ path: '/opt/boot'
+ state: 'directory'
+ tags: install-kernel-image
+
+- name: Build initrd image
+ shell: 'update-initramfs -k {{ ansible_kernel }} -c -b /opt/boot'
+ tags: install-kernel-image
+
+- name: Copy corresponding kernel img
+ copy:
+ src: '/boot/vmlinuz-{{ ansible_kernel }}'
+ dest: '/opt/boot/vmlinuz-{{ ansible_kernel }}'
+ remote_src: yes
+ tags: install-kernel-image
+
+- name: Restore remote initramfs modules
+ copy:
+ src: '/etc/initramfs-tools/modules.bkp'
+ dest: '/etc/initramfs-tools/modules'
+ remote_src: yes
+ tags: install-kernel-image
+
+- name: Remove backup initramfs modules
+ file:
+ path: '/etc/initramfs-tools/modules.bkp'
+ state: 'absent'
+ tags: install-kernel-image
diff --git a/resources/tools/testbed-setup/ansible/roles/sut/tasks/ubuntu_bionic.yaml b/resources/tools/testbed-setup/ansible/roles/sut/tasks/ubuntu_bionic.yaml
index 962c333276..b562ec1158 100644
--- a/resources/tools/testbed-setup/ansible/roles/sut/tasks/ubuntu_bionic.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/sut/tasks/ubuntu_bionic.yaml
@@ -27,20 +27,6 @@
install_recommends: False
tags: install-csit-dependencies
-- name: Get kernel-kvm version
- shell: "apt-cache depends -i linux-image-kvm | grep Depends: | cut -d' ' -f4"
- register: 'linux__image_kvm_read'
- tags: install-kernelvm
-
-- name: Download kernel-kvm
- shell: "apt-get -y download {{ linux__image_kvm_read.stdout }}"
- args:
- warn: false # Prevent warning as APT module does not support download.
- register: 'linux__image_kvm_download'
- when: 'linux__image_kvm_read'
- tags: install-kernelvm
-
-- name: Unpack kernel-kvm
- shell: "dpkg --extract {{ linux__image_kvm_read.stdout }}_*.deb /opt/"
- when: 'linux__image_kvm_download'
- tags: install-kernelvm
+- name: Kernel VM install
+ include_tasks: '../../common/tasks/kernel_install.yaml'
+ tags: install-kernel-image
diff --git a/resources/tools/testbed-setup/ansible/roles/vpp_device/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/vpp_device/tasks/main.yaml
index 97dec04d8f..93c5d36bc2 100644
--- a/resources/tools/testbed-setup/ansible/roles/vpp_device/tasks/main.yaml
+++ b/resources/tools/testbed-setup/ansible/roles/vpp_device/tasks/main.yaml
@@ -35,3 +35,7 @@
tags: set-grub
- meta: flush_handlers
+
+- name: Kernel VM install
+ include_tasks: '../../common/tasks/kernel_install.yaml'
+ tags: install-kernel-image