RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1190956 - libvirt should report an error or set default value when define/edit a vm have invalid vram or ram
Summary: libvirt should report an error or set default value when define/edit a vm hav...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Martin Kletzander
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-10 05:27 UTC by Luyao Huang
Modified: 2015-11-19 06:14 UTC (History)
4 users (show)

Fixed In Version: libvirt-1.2.13-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 06:14:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Luyao Huang 2015-02-10 05:27:40 UTC
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>

Comment 1 Martin Kletzander 2015-02-10 08:51:30 UTC
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

Comment 2 vivian zhang 2015-04-28 05:53:23 UTC
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>
...

Comment 4 vivian zhang 2015-05-26 02:27:28 UTC
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

Comment 6 errata-xmlrpc 2015-11-19 06:14:30 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/RHBA-2015-2202.html


Note You need to log in before you can comment on or make changes to this bug.