Bug 1190956
| Summary: | libvirt should report an error or set default value when define/edit a vm have invalid vram or ram | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Luyao Huang <lhuang> |
| Component: | libvirt | Assignee: | Martin Kletzander <mkletzan> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | low | Docs Contact: | |
| Priority: | low | ||
| Version: | 7.1 | CC: | dyuan, mkletzan, mzhan, rbalakri |
| Target Milestone: | rc | Keywords: | Upstream |
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-1.2.13-1.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-11-19 06:14:30 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: | |||
Fixed upstream with:
commit 3f9f4aa84f5f5986b91680a110eb72bf83fef95f
Author: Martin Kletzander <mkletzan>
Date: Tue Feb 10 08:55:06 2015 +0100
conf: disallow invalid values for video attributes
I can produce this bug with build libvirt-1.2.8-16.el7.x86_64
verify it with build libvirt-1.2.14-1.el7.x86_64
1. edit guest xml ram and vram to negative value
...
<video>
<model type='qxl' ram='-1' vram='-1' vgamem='8192' heads='42949672'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
...
save it and report an error
# virsh edit rl
error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng
Extra element devices in interleave
Element domain failed to validate content
Failed. Try again? [y,n,i,f,?]:
2. edit guest xml vgamem to negative value
...
<video>
<model type='qxl' ram='65536' vram='65536' vgamem='-1' heads='42949672'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
...
# virsh edit rl
error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng
Extra element devices in interleave
Element domain failed to validate content
Failed. Try again? [y,n,i,f,?]:
3. edit guest xml heads to negative value
...
<video>
<model type='qxl' ram='65536' vram='65536' vgamem='8192' heads='-1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
..
error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng
Extra element devices in interleave
Element domain failed to validate content
Failed. Try again? [y,n,i,f,?]:
4. try to reset with abc -99999999 !!$#%, get the same error
5. try to set with 0, dumpxml will get ram and vram with default 65536
# virsh dumpxml rl --inactive
...
<video>
<model type='qxl' vgamem='8192' heads='42949672'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
...
start guest and dumpxml again
# virsh dumpxml rl
...
<video>
<model type='qxl' ram='65536' vram='65536' vgamem='8192' heads='42949672'/>
<alias name='video0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
...
6. set vram to 0 will get the vgamem default value 16384
# virsh dumpxml rl
...
<video>
<model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='42949672'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
...
I can produce this bug with build libvirt-1.2.8-16.el7.x86_64
Verify it with build libvirt-1.2.15-2.el7.x86_64
Steps:
1. edit guest xml ram and vram to negative value
...
<video>
<model type='qxl' ram='-1' vram='-1' vgamem='16384' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
...
save it and report an error
# virsh edit vm2
error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng
Extra element devices in interleave
Element domain failed to validate content
Failed. Try again? [y,n,i,f,?]:
2. edit guest xml vgamem to negative value
...
<video>
<model type='qxl' ram='65536' vram='65536' vgamem='-1' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
...
# virsh edit vm2
error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng
Extra element devices in interleave
Element domain failed to validate content
Failed. Try again? [y,n,i,f,?]:
3. edit guest xml heads to negative value
...
<video>
<model type='qxl' ram='65536' vram='65536' vgamem='8192' heads='-1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
..
error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng
Extra element devices in interleave
Element domain failed to validate content
Failed. Try again? [y,n,i,f,?]:
4. try to reset with abc -99999999 !!$#%, get the same error
5. try to set with 0, dumpxml will get ram and vram with default 65536
# virsh dumpxml rl --inactive
...
<video>
<model type='qxl' vgamem='8192' heads='42949672'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
...
start guest and dumpxml again
# virsh dumpxml vm2
...
<video>
<model type='qxl' ram='65536' vram='65536' vgamem='8192' heads='42949672'/>
<alias name='video0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
...
6. set vram to 0 will get the vgamem default value 16384
# virsh dumpxml vm2
...
<video>
<model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='42949672'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
...
move to verified
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/RHBA-2015-2202.html |
description of problem: libvirt should report an error or set default value when define/edit a vm have invalid vram or ram Version-Release number of selected component (if applicable): libvirt-1.2.8-16.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1.edit vm graphics vram and ram as -1: # virsh edit test4 <video> <model type='qxl' ram='-1' vram='-1' vgamem='8192' heads='4294967295'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> 2.check the xml and will get: # virsh dumpxml test4 --inactive <video> <model type='qxl' vgamem='8192' heads='4294967295'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> 3.start the vm (or edit it again) and these settings will auto add in config: # virsh start test4 Domain test4 started # virsh dumpxml test4 --inactive <video> <model type='qxl' ram='65536' vram='65536' vgamem='8192' heads='4294967295'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> Actual results: libvirt set these values to 0 in virDomainDeviceDefPostParseInternal and will add the default value to them when call virDomainVideoDefParseXML also found when try to set ram and vram to 0 will get the same result Expected results: libvirt should report an error or set default value when define/edit a vm have invalid vram or ram Additional info: however if we try to remove these settings(ram or vram), libvirt will auto add them for qxl video: # virsh edit test4 <video> <model type='qxl' vgamem='8192' heads='4294967295'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> # virsh dumpxml test4 --inactive <video> <model type='qxl' ram='65536' vram='65536' vgamem='8192' heads='4294967295'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video>