Rate This Document
Findability
Accuracy
Completeness
Readability

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.

  1. Open virt-manager and click the icon in the red box to open the VM configuration page.
    virt-manager

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

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

  4. Set Memory to 180000 and CPUs to 80, and click Forward.

    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.

  5. Allocate 512 GiB drive storage space and click Forward.

    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:

    1. Create a drive image file vm0.qcow2.
      qemu-img create -f qcow2 vm0.qcow2 1024G
    2. Select Select or create custom storage and click Manage.

    3. Click Browse Local.

    4. Select the created vm0.qcow2 file.

  6. 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 Finish.

    If SR-IOV is selected in Configuring the Host Network, you do not need to configure Network selection, which will be deleted later.

  7. On the following page, click Add Hardware and add the following devices in sequence.
    1. Add peripheral 1: Add Hardware > Input > Generic USB Keyboard > Finish
    2. Add peripheral 2: Add Hardware > Input > Virtio Tablet > Finish
    3. 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.
    4. If the SR-IOV solution is used in Configuring the Host Network, add a vNIC to the VM: Add Hardware > PCI Host Device > Select a node > Finish For details about NIC nodes, see the command output in 5.

    5. If there is no Display VNC device by default, you need to manually add one. Click Add Hardware > Graphics, set Type to VNC server, and click Finish to add the device.
  8. Click Begin Installation. On the displayed page, select the first option to start the installation.
  9. On the INSTALLATION SUMMARY page, select Installation Destination.

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

  11. Set the partitioning scheme to Standard Partition.

  12. Click + and add mount points, as described in Table 1.
    Table 1 Partition mount points

    Mount Point

    Capacity

    /boot

    2 GiB

    /boot/efi

    2 GiB

    /swap

    32 GiB

    Add the three mount points. The remaining space will be allocated to the root directory. Click Done. In the displayed dialog box, click Accept Changes.

  13. 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.

  14. Configure the root account and password and click Begin Installation.

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

  16. (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.

    1. 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.

    2. Open virt-manager and choose Add Hardware > Manage. Set Bus type to VirtIO, Cache mode to none, and IO mode to native.

    3. Choose Browse Local > dev > nvme0n1p7 > Open.

    4. Click Finish.

  17. If the SR-IOV solution is used, delete unnecessary virtual network interfaces.

  18. Delete the virtual graphics card.