Modify kernel VM download to custom build 77/20577/2
authorjuraj.linkes <juraj.linkes@pantheon.tech>
Wed, 10 Jul 2019 09:10:34 +0000 (11:10 +0200)
committerjuraj.linkes <juraj.linkes@pantheon.tech>
Wed, 10 Jul 2019 11:50:39 +0000 (13:50 +0200)
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>
resources/tools/testbed-setup/ansible/roles/common/files/initramfs_modules [new file with mode: 0644]
resources/tools/testbed-setup/ansible/roles/common/tasks/kernel_install.yaml [new file with mode: 0644]
resources/tools/testbed-setup/ansible/roles/sut/tasks/ubuntu_bionic.yaml
resources/tools/testbed-setup/ansible/roles/vpp_device/tasks/main.yaml

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 (file)
index 0000000..00ae8e0
--- /dev/null
@@ -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 (file)
index 0000000..c215085
--- /dev/null
@@ -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
index 962c333..b562ec1 100644 (file)
     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
index 97dec04..93c5d36 100644 (file)
@@ -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

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.