Creating a VM Using virt-manager
Four VMs are required in this document. You can perform operations in this section for four times in sequence. Alternatively, you can perform the operations only once and then copy the VM.
For details, see VM Copying.
- Open virt-manager and click the icon in the red box to open the VM configuration page.
virt-manager

- Select Local install media (ISO image or COROM) and click .

- Click , select the openEuler 22.03 LTS SP3 image downloaded before, deselect Automatically detect from installation media / source, enter Generic default, and click .

- Set Memory to 180000 and CPUs to 80, and click .

180000 is for reference only. You are advised to allocate all huge pages of each NUMA node to its corresponding VM based on the huge page configuration in 8.
- Allocate 512 GiB drive storage space and click .
512 GiB is for reference only. Allocate drive storage space as required. If you plan to use passthrough drive partitions as data drives to improve the I/O performance of VMs, allocate a small volume here, for example, 50 GiB, to be used as a system drive.

If the current drive space is insufficient, create a virtual drive file on another drive. The procedure is as follows:
- Create a drive image file vm0.qcow2.
qemu-img create -f qcow2 vm0.qcow2 1024G
- Select Select or create custom storage and click .

- Click .

- Select the created vm0.qcow2 file.

- Create a drive image file vm0.qcow2.
- Set Name to vmX (X = 0, 1, 2, or 3), and select Customize configuration before install. If the bridge mode is configured for the host machine in Configuring the Host Network, select Bridge br0 from Network selection and click .

If SR-IOV is selected in Configuring the Host Network, you do not need to configure Network selection, which will be deleted later.
- On the following page, click and add the following devices in sequence.

- Add peripheral 1:
- Add peripheral 2:
- Add GPU PCIe devices (each VM requires two GPUs and thus eight nodes need to be added in sequence): Add Hardware > PCI Host Device > Select a node > Finish The GPU nodes and NUMA nodes in 2 must correspond to those queried in Querying PCIe Node Information of a GPU.
- If the SR-IOV solution is used in Configuring the Host Network, add a vNIC to the VM: Select a node > Finish For details about NIC nodes, see the command output in 5.

- If there is no Display VNC device by default, you need to manually add one. Click , set Type to VNC server, and click to add the device.
- Click . On the displayed page, select the first option to start the installation.
- On the INSTALLATION SUMMARY page, select Installation Destination.

- On the Installation Destination page, select Custom and click Done in the upper left corner.

- Set the partitioning scheme to Standard Partition.

- Click and add mount points, as described in Table 1.
- Check free memory of the server before the installation.
free -h
If the free memory is less than the VM memory set in 4, perform 3 and 5 in advance. Obtain the VM tuning script setup_vm.sh according to Obtaining the Software Package and enable hugepage memory for the VM. If the free memory is sufficient, skip this step../setup_vm.sh vm0 --numatune {NUMA binding} ./setup_vm.sh vm0 --enable_hugepages
If the VM cannot use huge pages, it will use the free memory of the host by default. If the free memory is insufficient, the VM system fails to be installed. In this case, you need to allocate huge pages to the VM in advance for system installation.
- Configure the root account and password and click Begin Installation.

- After the installation is complete, reopen virt-manager and shut down the VM.

- (Optional) Use a passthrough drive partition as the data drive of the VM.
Passthrough drive partitions can improve the drive I/O performance of VMs. It is recommended that this function be enabled in drive I/O-intensive scenarios, such as high-density cloud gaming.
- View drive partition information of the host.
lsblk
Select a partition as the data drive of the VM. The following uses nvme0n1p7 as an example.

- Open virt-manager and choose . Set Bus type to VirtIO, Cache mode to none, and IO mode to native.

- Choose .

- Click Finish.

- View drive partition information of the host.
- If the SR-IOV solution is used, delete unnecessary virtual network interfaces.

- Delete the virtual graphics card.


