From e4203c1cdcdc845cfac0e679df890076a7f92abf Mon Sep 17 00:00:00 2001 From: Albert Stefanov Date: Sun, 15 Oct 2023 10:02:02 +0300 Subject: [PATCH] VM Definitions --- server-configs/vms/README.md | 65 ++++++++ server-configs/vms/dns.xml | 207 +++++++++++++++++++++++++ server-configs/vms/gateway.xml | 233 ++++++++++++++++++++++++++++ server-configs/vms/monitoring.xml | 210 +++++++++++++++++++++++++ server-configs/vms/voip.xml | 247 ++++++++++++++++++++++++++++++ 5 files changed, 962 insertions(+) create mode 100644 server-configs/vms/README.md create mode 100644 server-configs/vms/dns.xml create mode 100644 server-configs/vms/gateway.xml create mode 100644 server-configs/vms/monitoring.xml create mode 100644 server-configs/vms/voip.xml diff --git a/server-configs/vms/README.md b/server-configs/vms/README.md new file mode 100644 index 0000000..c652f38 --- /dev/null +++ b/server-configs/vms/README.md @@ -0,0 +1,65 @@ +# Virtual Machines + +## Resources used + +| Name | vCPU | Memory (MiB) | Disk (GiB) | VLANs | +| --------------- | ---- | ------------ | ---------- | ----- | +| gateway-openwrt | 8 | 4096 | 1 | all | +| dns | 2 | 4096 | 20 | all | +| monitoring | 4 | 4096 | 40 | 20 | +| voip | 2 | 2048 | 20 | 26 | + +## SR-IOV + +Intel's X520 network adapters we are currently using support passing through a virtual function of the NIC directly to the VM. + +### Host configuration + +SR-IOV should be enabled in the server's BIOS. + +To create virtual functions on boot, a `udev` rule has to be created. +On dual-port cards even VF numbers are given to the first port (`..f0`). Odd ones are connected to the second port (`..f1`). + +```bash +cat > /etc/udev/rules.d/enp1s0f0.rules << EOF +KERNEL=="0000:01:00.0", SUBSYSTEM=="pci", DRIVER=="ixgbe", ATTR{vendor}=="0x8086", ATTR{device}=="0x154d", ATTR{sriov_numvfs}="15" +KERNEL=="0000:01:00.1", SUBSYSTEM=="pci", DRIVER=="ixgbe", ATTR{vendor}=="0x8086", ATTR{device}=="0x154d", ATTR{sriov_numvfs}="15" +EOF +``` + +### Attaching a virtual function to a VM + +We have to manually edit the VM's XML definition. +The function IDs must be unique as each virtual function can be used exclusively by a single VM (and is detached from the host). +Depending on our needs, we can attach: + +#### In a specific VLAN (the NIC/hypervisor is responsible for tagging the frames) + +```xml + + + +
+ + + + + +
+ +``` + +#### Directly (to use as a dot1q trunk) + +```xml + + + +
+ + +
+ +``` + +All offloading features work on virtual functions, including VLAN tagging. diff --git a/server-configs/vms/dns.xml b/server-configs/vms/dns.xml new file mode 100644 index 0000000..0c0f3fc --- /dev/null +++ b/server-configs/vms/dns.xml @@ -0,0 +1,207 @@ + + dns + 3c603d11-23d5-46b0-b944-390923af9f3d + + + + + + 4194304 + 4194304 + 2 + + /machine + + + hvm + + + + + + + + + + + + + destroy + restart + destroy + + + + + + /usr/bin/qemu-system-x86_64 + + + + + + +
+ + + +
+ + + + + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + +
+ + + +
+ + + + + + + +
+ + + + + +
+ + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + +