From 1f9103bb6748951a5653d0ea7fc1b1a05258f7b2 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Thu, 2 Jul 2020 12:54:07 +0200 Subject: [PATCH] test_data: Update Ubuntu cloud-init to support all integration tests Updating the cloud-init files related to Ubuntu images is needed to be able to use Ubuntu images for running all integration tests. Signed-off-by: Sebastien Boeuf --- test_data/cloud-init/ubuntu/network-config | 38 +++++++++++++++------- test_data/cloud-init/ubuntu/user-data | 33 ++++++++++++++++++- 2 files changed, 58 insertions(+), 13 deletions(-) diff --git a/test_data/cloud-init/ubuntu/network-config b/test_data/cloud-init/ubuntu/network-config index 8742313ba..ce5ed03f5 100644 --- a/test_data/cloud-init/ubuntu/network-config +++ b/test_data/cloud-init/ubuntu/network-config @@ -1,12 +1,26 @@ -network: - version: 1 - config: - - type: physical - name: eth0 - mac_address: 12:34:56:78:90:ab - subnets: - - type: static - address: 192.168.2.2/24 - gateway: 192.168.2.1 - dns_nameservers: - - 192.168.2.1 \ No newline at end of file +version: 2 +ethernets: + id0: + match: + macaddress: 12:34:56:78:90:ab + addresses: + - 192.168.2.2/24 + gateway4: 192.168.2.1 + id1: + match: + macaddress: de:ad:be:ef:12:34 + addresses: + - 192.168.2.3/24 + gateway4: 192.168.2.1 + id2: + match: + macaddress: de:ad:be:ef:34:56 + addresses: + - 192.168.2.4/24 + gateway4: 192.168.2.1 + id3: + match: + macaddress: de:ad:be:ef:56:78 + addresses: + - 192.168.2.5/24 + gateway4: 192.168.2.1 diff --git a/test_data/cloud-init/ubuntu/user-data b/test_data/cloud-init/ubuntu/user-data index 8dbd3b4ec..954bcc4d9 100644 --- a/test_data/cloud-init/ubuntu/user-data +++ b/test_data/cloud-init/ubuntu/user-data @@ -7,4 +7,35 @@ users: inactive: False shell: /bin/bash -ssh_pwauth: True \ No newline at end of file +ssh_pwauth: True + +write_files: + - + path: /etc/systemd/system/vfio.service + permissions: 0644 + content: | + [Unit] + Description=VFIO test systemd service + + [Service] + Type=simple + ExecStart=/bin/bash /usr/bin/cloud-hypervisor-vfio.sh + + [Install] + WantedBy=multi-user.target + + - + path: /usr/bin/cloud-hypervisor-vfio.sh + permissions: 0755 + content: | + #!/bin/bash + + mount -t virtiofs -o dax myfs /mnt + bash -c "echo 0000:00:05.0 > /sys/bus/pci/devices/0000\:00\:05.0/driver/unbind" + bash -c "echo 1af4 1041 > /sys/bus/pci/drivers/vfio-pci/new_id" + bash -c "echo 0000:00:06.0 > /sys/bus/pci/devices/0000\:00\:06.0/driver/unbind" + bash -c "echo 1af4 1041 > /sys/bus/pci/drivers/vfio-pci/new_id" + # 1G ram requires 512 pages + echo 512 | sudo tee /proc/sys/vm/nr_hugepages + sudo chmod a+rwX /dev/hugepages + /mnt/cloud-hypervisor --kernel /mnt/vmlinux --cmdline "console=hvc0 reboot=k panic=1 nomodules i8042.noaux i8042.nomux i8042.nopnp i8042.dumbkbd root=/dev/vda1 VFIOTAG" --disk path=/mnt/focal-server-cloudimg-amd64-custom.qcow2 path=/mnt/cloudinit.img --cpus boot=1 --memory size=512M,hotplug_size=1G,file=/dev/hugepages --device path=/sys/bus/pci/devices/0000:00:05.0/ path=/sys/bus/pci/devices/0000:00:06.0/ --api-socket /tmp/ch_api.sock