Bug 1358728

Summary: Migration failed when the secondary video devices have different ram/vram sizes.
Product: Red Hat Enterprise Linux 7 Reporter: Fangge Jin <fjin>
Component: libvirtAssignee: Pavel Hrdina <phrdina>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: dyuan, mzhan, rbalakri, xuzhang, yafu, zpeng
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-2.0.0-4.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-03 18:50:52 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 Fangge Jin 2016-07-21 11:41:00 UTC
Description of problem:
Guest has three video devices, and the vram or ram size of the second video and the third video are not equal. Start the guest, and migration will fail:
# virsh migrate rhel7.2 qemu+ssh://hp-dl385g7-06.lab.eng.pek2.redhat.com/system --live --verbose
error: internal error: qemu unexpectedly closed the monitor: 2016-07-20T09:17:43.220520Z qemu-kvm: Length mismatch: 0000:00:09.0/qxl.vram: 0x2000000 in != 0x4000000: Invalid argument
2016-07-20T09:17:43.221314Z qemu-kvm: error while loading state for instance 0x0 of device 'ram'
2016-07-20T09:17:43.222751Z qemu-kvm: load of migration failed: Invalid argument

Version-Release number of selected component:
libvirt-2.0.0-2.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Prepare a guest with three videos, and set different ram or vram size for the second video and the third video:
# virsh dumpxml rhel7.2 --inactive
...
    <video>
      <model type='qxl' ram='1048576' vram='16384' vgamem='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <video>
      <model type='qxl' ram='65536' vram='**32768**' vgamem='8192' heads='3'/>  
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </video>
    <video>
      <model type='qxl' ram='65536' vram='**65536**' vgamem='8192' heads='7'/>  
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
    </video>
...

2.Start guest
# virsh start rhel7.2

3.Check live vram/ram size, find that the value of the second video devices becomes 65536:
# virsh dumpxml rhel7.2
...
    <video>
      <model type='qxl' ram='524288' vram='16384' vgamem='16384' primary='yes'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='8192'/>
      <alias name='video1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </video>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='8192'/>
      <alias name='video2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
    </video>
...

4.Do migration and failed.

Actual results:
Migration failed

Expected results:
Migration can succeed

Additional info:
1)
The qemu command line on source host:
-device qxl-vga,id=video0,ram_size=1073741824,vram_size=16777216,vram64_size_mb=0,vgamem_mb=16,bus=pci.0,addr=0x2 -device qxl,id=video1,ram_size=67108864,vram_size=33554432,vram64_size_mb=0,vgamem_mb=8,bus=pci.0,addr=0x9 -device qxl,id=video2,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=8,bus=pci.0,addr=0xb

2)
The qemu command line on target host:
-device qxl-vga,id=video0,ram_size=536870912,vram_size=16777216,vram64_size_mb=0,vgamem_mb=16,bus=pci.0,addr=0x2 -device qxl,id=video1,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=8,bus=pci.0,addr=0x9 -device qxl,id=video2,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=8,bus=pci.0,addr=0xb

3)
I tried several times, and found that the vram/ram size of the second video device is always adjusted to the vram/ram value of the third video device

Comment 2 Pavel Hrdina 2016-07-25 14:25:21 UTC
Upstream commit:

commit 4a585a884fc8cfd11f6206cd6f1a7db824395e86
Author: Pavel Hrdina <phrdina>
Date:   Mon Jul 25 10:47:00 2016 +0200

    qemu_monitor_json: add support to search QOM device path by device alias

Comment 5 yafu 2016-08-17 04:20:50 UTC
Can reproduce this BZ with libvirt-2.0.0-2.el7.x86_64.

Verified pass with libvirt-2.0.0-5.el7.x86_64.
Test steps:
1. Prepare a guest with three videos, and set different ram or vram size for the second video and the third video:
# virsh dumpxml rhel7.2 --inactive
...
    <video>
      <model type='qxl' ram='1048576' vram='16384' vgamem='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <video>
      <model type='qxl' ram='65536' vram='**32768**' vgamem='8192' heads='3'/>  
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </video>
    <video>
      <model type='qxl' ram='65536' vram='**65536**' vgamem='8192' heads='7'/>  
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
    </video>
...

2.Start guest
# virsh start rhel7.2

3.Check live vram/ram size, find all the value of video devices are not changes:
# virsh dumpxml rhel7.2
...
    <video>
      <model type='qxl' ram='524288' vram='16384' vgamem='16384' primary='yes'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <video>
      <model type='qxl' ram='65536' vram='**32768**' vgamem='8192'/>
      <alias name='video1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </video>
    <video>
      <model type='qxl' ram='65536' vram='**65536**' vgamem='8192'/>
      <alias name='video2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
    </video>
...

4.Do migration,migration complete correctly and guest works well after migration:
#virsh migrate rhel7.2 qemu+ssh://10.66.144.76/system --live --verbose
Migration: [100 %]


5.Also try four video devices with different ram/vram size, all the value of video devices are not changed when start the guest.

Comment 7 errata-xmlrpc 2016-11-03 18:50:52 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://rhn.redhat.com/errata/RHSA-2016-2577.html