2019-05-23 15:45:13 +00:00
|
|
|
#cloud-config
|
|
|
|
users:
|
2019-07-30 10:46:13 +00:00
|
|
|
- name: cloud
|
2019-05-23 15:45:13 +00:00
|
|
|
passwd: $6$7125787751a8d18a$sHwGySomUA1PawiNFWVCKYQN.Ec.Wzz0JtPPL1MvzFrkwmop2dq7.4CYf03A5oemPQ4pOFCCrtCelvFBEle/K.
|
|
|
|
sudo:
|
|
|
|
- ALL=(ALL) NOPASSWD:ALL
|
|
|
|
write_files:
|
|
|
|
-
|
2019-07-19 08:26:13 +00:00
|
|
|
path: /etc/systemd/network/00-static-l1.network
|
2019-05-23 15:45:13 +00:00
|
|
|
permissions: 0644
|
|
|
|
content: |
|
|
|
|
[Match]
|
2019-07-08 22:31:13 +00:00
|
|
|
MACAddress=12:34:56:78:90:ab
|
2019-05-23 15:45:13 +00:00
|
|
|
|
|
|
|
[Network]
|
|
|
|
Address=192.168.2.2/24
|
|
|
|
Gateway=192.168.2.1
|
2019-07-19 08:26:13 +00:00
|
|
|
|
|
|
|
-
|
2019-12-06 19:38:56 +00:00
|
|
|
path: /etc/systemd/network/00-static-l2-1.network
|
2019-07-19 08:26:13 +00:00
|
|
|
permissions: 0644
|
|
|
|
content: |
|
|
|
|
[Match]
|
|
|
|
MACAddress=de:ad:be:ef:12:34
|
|
|
|
|
|
|
|
[Network]
|
|
|
|
Address=192.168.2.3/24
|
|
|
|
Gateway=192.168.2.1
|
|
|
|
|
2019-12-06 19:38:56 +00:00
|
|
|
-
|
|
|
|
path: /etc/systemd/network/00-static-l2-2.network
|
|
|
|
permissions: 0644
|
|
|
|
content: |
|
|
|
|
[Match]
|
|
|
|
MACAddress=de:ad:be:ef:34:56
|
|
|
|
|
|
|
|
[Network]
|
|
|
|
Address=192.168.2.4/24
|
|
|
|
Gateway=192.168.2.1
|
|
|
|
|
2020-03-03 07:42:13 +00:00
|
|
|
-
|
|
|
|
path: /etc/systemd/network/00-static-l2-3.network
|
|
|
|
permissions: 0644
|
|
|
|
content: |
|
|
|
|
[Match]
|
|
|
|
MACAddress=de:ad:be:ef:56:78
|
|
|
|
|
|
|
|
[Network]
|
|
|
|
Address=192.168.2.5/24
|
|
|
|
Gateway=192.168.2.1
|
|
|
|
|
2019-07-19 08:26:13 +00:00
|
|
|
-
|
|
|
|
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
|
|
|
|
|
2020-01-02 18:04:48 +00:00
|
|
|
mount -t virtiofs -o dax myfs /mnt
|
2019-10-08 05:05:08 +00:00
|
|
|
bash -c "echo 0000:00:05.0 > /sys/bus/pci/devices/0000\:00\:05.0/driver/unbind"
|
2019-07-19 08:26:13 +00:00
|
|
|
bash -c "echo 1af4 1041 > /sys/bus/pci/drivers/vfio-pci/new_id"
|
2019-12-06 19:38:56 +00:00
|
|
|
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"
|
2020-03-26 16:19:41 +00:00
|
|
|
# 1G ram requires 512 pages
|
|
|
|
echo 512 | sudo tee /proc/sys/vm/nr_hugepages
|
2020-02-13 14:32:24 +00:00
|
|
|
sudo chmod a+rwX /dev/hugepages
|
2020-03-26 16:19:41 +00:00
|
|
|
/mnt/cloud-hypervisor --kernel /mnt/vmlinux --cmdline "console=hvc0 reboot=k panic=1 nomodules i8042.noaux i8042.nomux i8042.nopnp i8042.dumbkbd root=PARTUUID=6fb4d1a8-6c8c-4dd7-9f7c-1fe0b9f2574c VFIOTAG" --disk path=/mnt/clear-31311-cloudguest.img 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
|