Installing libvirt and QEMU
Configure the VM XML file or configure the QEMU command to start the VM to send the cache structure information to the VM. Before and after the feature is enabled, observe the cache structure information in the VM to check whether the feature is enabled successfully. Before the configuration, compile the RPM packages to install libvirt and QEMU.
- Obtain the libvirt and QEMU code repositories.Run the following command to obtain libvirt for openEuler 22.03 LTS SP4:
1git clone https://gitee.com/src-openeuler/libvirt.git -b openEuler-22.03-LTS-SP4
Run the following command to obtain QEMU for openEuler 22.03 LTS SP4:
1git clone https://gitee.com/src-openeuler/qemu.git -b openEuler-22.03-LTS-SP4
- Obtain the libvirt and QEMU patches.
- Check whether the code repositories in step 1 have corresponding patches. If yes, you do not need to download the patches and you can directly go to step 4.
libvirt patch name:
libvirt-Support-specifying-the-cache-size-presented-.patch
QEMU patch name:
qapi-qom-Define-cache-enumeration-and-properties-for.patch hw-core-machine-smp-Initialize-caches_bitmap-before-.patch qemu-Support-specifying-the-cache-size-presented-to-.patch
- If no patch is available, download the patches from the links described in Table 2. Go to the patch download address and click Clone/Download > HTTPS > Email Patch. On the displayed page, copy and save all the code in a Patch_name.patch file, and place the patch file in the directory where the spec file is located, which is in the cloned folder in step 1. After the patches are downloaded, go to step 3.
- Check whether the code repositories in step 1 have corresponding patches. If yes, you do not need to download the patches and you can directly go to step 4.
- Modify libvirt.spec and qemu.spec.
Modify the corresponding spec files. The following uses the libvirt.spec file as an example. At the end of the patch list in the libvirt.spec file, add the name of the downloaded libvirt patch file. The operations are similar for QEMU.

- Copy files.
Take libvirt as an example. Copy all files (libvirt-6.2.0.tar.xz, libvirt.spec, *, and patch) to /root/rpmbuild/SOURCES. The operations are similar for QEMU.
- Compile and install the dependency package.
- Compile libvirt and QEMU separately.
- Configure the Yum repository in advance.
Compile and install related dependency package. Command for libvirt is as follows:
1yum-builddep -y /root/rpmbuild/SOURCES/libvirt.spec
Command for QEMU is as follows:
1yum-builddep -y /root/rpmbuild/SOURCES/qemu.spec
- Compile the RPM package.
Compile and install related dependency package. Command for libvirt is as follows:
1rpmbuild -ba /root/rpmbuild/SOURCES/libvirt.spec
Command for QEMU is as follows:
1rpmbuild -ba /root/rpmbuild/SOURCES/qemu.spec
- Install the RPM package.
Compile and install related dependency package. Command for libvirt is as follows:
1 2
cd /root/rpmbuild/RPMS/aarch64 rpm -ivh libvirt* --nodeps --force
Command for QEMU is as follows:
1 2
cd /root/rpmbuild/RPMS/aarch64 rpm -ivh qemu* --nodeps --force
- Check whether the installation is successful.
Run the following command to query the libvirt and QEMU versions:
1virsh version