Bug 1450349

Summary: No ABI check for /memoryBacking/[source|access|allocation] in guest xml
Product: Red Hat Enterprise Linux 7 Reporter: Luyao Huang <lhuang>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: Luyao Huang <lhuang>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.4CC: dyuan, rbalakri, xuzhang, yalzhang
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-3.2.0-9.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-02 00:08:25 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:
Embargoed:

Description Luyao Huang 2017-05-12 10:13:06 UTC
Description of problem:

No ABI check for /memoryBacking/[source|access|allocation] in guest xml

Version-Release number of selected component (if applicable):
libvirt-3.2.0-4.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.prepare a guest with xml like this:

  <memoryBacking>
    <source type='file'/>
    <access mode='private'/>
    <allocation mode='ondemand'/>
  </memoryBacking>


2.start guest and save this guest:

# virsh start r7
Domain r7 started

# virsh managedsave r7

Domain r7 state saved by libvirt

3. use save-image-edit to change the source type or access mode or allocation mode:
# virsh save-image-edit /var/lib/libvirt/qemu/save/r7.save 
change to:
  <memoryBacking>
    <source type='anonymous'/>
    <access mode='private'/>
  </memoryBacking>
State file /var/lib/libvirt/qemu/save/r7.save edited.

4. try to restore guest:

# virsh start r7
error: Failed to start domain r7
error: operation failed: job: unexpectedly failed


5. check guest log

2017-05-12T10:10:30.322768Z qemu-kvm: Unknown ramblock "/objects/ram-node0", cannot accept migration
2017-05-12T10:10:30.322799Z qemu-kvm: error while loading state for instance 0x0 of device 'ram'
2017-05-12T10:10:30.323204Z qemu-kvm: load of migration failed: Invalid argument


Actual results:

No ABI check for /memoryBacking/[source|access|allocation] in guest xml

Expected results:

Libvirt should not allow this change since it will effect the guest resource, and won't pass qemu ABI

Additional info:

Comment 2 Michal Privoznik 2017-05-18 08:06:31 UTC
Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2017-May/msg00626.html

Comment 3 Michal Privoznik 2017-05-24 14:46:32 UTC
Another attempt:

https://www.redhat.com/archives/libvir-list/2017-May/msg00939.html

Comment 4 Michal Privoznik 2017-06-05 07:37:51 UTC
Moving to POST:

http://post-office.corp.redhat.com/archives/rhvirt-patches/2017-June/msg00056.html


During upstream review it turned out that @access and @allocation has no effect on guest ABI. Therefore the only thing that this patch set checks is @source.

Comment 6 Luyao Huang 2017-06-08 06:22:30 UTC
Verify this bug with libvirt-3.2.0-9.el7.x86_64:

1. start a guest use file as memory backend:

# virsh dumpxml r7 
...
  <memoryBacking>
    <source type='file'/>
    <access mode='shared'/>
  </memoryBacking>
...

2. managedsave guest:

# virsh managedsave r7 

Domain r7 state saved by libvirt

3. use save-image-edit try to change source type:

# virsh save-image-edit /var/lib/libvirt/qemu/save/r7.save 
error: unsupported configuration: Target memoryBacking source 'anonymous' doesn't match source memoryBacking source'file'
Failed. Try again? [y,n,f,?]:

Comment 7 errata-xmlrpc 2017-08-02 00:08:25 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, 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/RHEA-2017:1846

Comment 8 errata-xmlrpc 2017-08-02 01:32:35 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, 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/RHEA-2017:1846