Bug 1961114

Summary: vm with memory device started failed
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Jing Qi <jinqi>
Component: libvirtAssignee: khanicov
Status: CLOSED ERRATA QA Contact: Jing Qi <jinqi>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.4CC: jdenemar, jsuchane, khanicov, lmen, mprivozn, virt-maint, xuzhang
Target Milestone: rcKeywords: Triaged, Upstream
Target Release: 8.5Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-7.4.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-16 07:53:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version: 7.4.0
Embargoed:

Description Jing Qi 2021-05-17 09:47:16 UTC
Description of problem:
vm with memory device started failed for below reason-
error: internal error: process exited while connecting to monitor: 2021-05-17T05:11:43.421282Z qemu-kvm: can't open backing store /var/lib/libvirt/qemu/ram/2-avocado-vt-vm1/dimm0 for guest RAM: No such file or directory


Version-Release number of selected component (if applicable):
libvirt-7.3.0-1.module+el8.5.0+11004+f4810536.x86_64
qemu-kvm-6.0.0-16.module+el8.5.0+10848+2dccc46d.x86_64

How reproducible:

always

Steps to Reproduce:
1.prepare vm with memory device as below -

<maxMemory slots='16' unit='KiB'>8388608</maxMemory>
  <memory unit='KiB'>2621439</memory>
  <currentMemory unit='KiB'>2621439</currentMemory>
 ...
  <cpu mode='host-model' check='partial'>
    <feature policy='disable' name='vmx'/>
    <numa>
      <cell id='0' cpus='0-1' memory='2097152' unit='KiB'/>
    </numa>
  </cpu>

<memory model='dimm' access='private' discard='yes'>
      <target>
        <size unit='KiB'>524287</size>
        <node>0</node>
      </target>
      <address type='dimm' slot='0'/>
    </memory>

2.virsh start avocado-vt-vm1
error: Failed to start domain 'avocado-vt-vm1'
error: internal error: process exited while connecting to monitor: 2021-05-17T05:11:43.421282Z qemu-kvm: can't open backing store /var/lib/libvirt/qemu/ram/2-avocado-vt-vm1/dimm0 for guest RAM: No such file or directory


Actual results:
vm started failed

Expected results:
vm can start successfully

Additional info:
If <source type='file'> is added in <memoryBacking> , the vm can be started.

Comment 2 Michal Privoznik 2021-05-18 09:49:12 UTC
The problem is that we construct memory-backend-file with path pointing to /var/lib/libvirt/qemu/ram/... but later when preparing the host qemuProcessBuildDestroyMemoryPaths() is called which subsequently calls qemuProcessNeedMemoryBackingPath() which is supposed to return TRUE, because we need memory backing dir path. However, it checks for NUMA nodes only and not memory devices.

Comment 3 khanicov 2021-05-20 14:30:27 UTC
Patch proposed on the list:
https://listman.redhat.com/archives/libvir-list/2021-May/msg00618.html

Comment 4 khanicov 2021-05-21 12:01:34 UTC
Merged upstream as:

g19967f64f4 qemu: Add check for needed paths for memory devices

v7.3.0-246-g19967f64f4

Comment 5 Michal Privoznik 2021-05-21 12:04:52 UTC
To POST per comment 4.

Comment 6 Jing Qi 2021-05-24 00:52:49 UTC
Tested with libvirt upstream version v7.3.0-257-gd8c468d58c & qemu-kvm-5.2.0-0.7.rc2.fc34.x86_64. 

Vm can be started successfully with memory device -

<maxMemory slots='16' unit='KiB'>8388608</maxMemory>
  <memory unit='KiB'>2621439</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>2</vcpu>
...
 <numa>
      <cell id='0' cpus='0-1' memory='2097152' unit='KiB'/>
    </numa>
  </cpu>
...
 <memory model='dimm' access='private' discard='yes'>
      <target>
        <size unit='KiB'>524287</size>
        <node>0</node>
      </target>
      <address type='dimm' slot='0'/>
    </memory>

# virsh start pc
Domain 'pc' started

Comment 10 Jing Qi 2021-06-21 07:05:55 UTC
Verified with libvirt-daemon-7.4.0-1.module+el8.5.0+11218+83343022.x86_64 & qemu-kvm-6.0.0-19.module+el8.5.0+11385+6e7d542e.x86_64
Passed and test steps are the same as Comment 6.

Comment 12 errata-xmlrpc 2021-11-16 07:53:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (virt:av bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4684