Bug 617711
Summary: | Domain XML parser doesn't reject invalid memory values | ||
---|---|---|---|
Product: | [Community] Virtualization Tools | Reporter: | jrodriguez |
Component: | libvirt | Assignee: | Eric Blake <eblake> |
Status: | CLOSED NEXTRELEASE | QA Contact: | |
Severity: | medium | Docs Contact: | |
Priority: | low | ||
Version: | unspecified | CC: | berrange, clalance, crobinso, eblake, xen-maint |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2012-04-20 01:24:03 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 813972 |
Description
jrodriguez
2010-07-23 19:20:14 UTC
(In reply to comment #0) > <domain type="kvm"> > <name>uml2</name> > <memory>780M</memory> You've got two problems here. The first is that the memory parameter is specified in kilobytes, not megabytes. The second is that libvirt doesn't understand the M notation, so it's interpreting this as 780kb, essentially 0 (which is probably what it passes to kvm). The only bug here is that we should reject invalid XML like yours; I'll change the subject and leave the bug open to track the error reporting. Chris Lalancette Thx! I added support for libvirt XML to take input in megabytes (as in <memory unit='M'>780</memory>), and make it clear that output is in kibibytes, as of this patch in 0.9.11: commit 2e22f23bde0ad6630a29d06ce164b6db8395f72c Author: Eric Blake <eblake> Date: Mon Mar 5 14:52:07 2012 -0700 xml: allow scaled memory on input Output is still in kibibytes, but input can now be in different scales for ease of typing. However, I just checked that we _still_ don't reject <memory>780M</memory> as invalid, so I'll keep this bug open and add another patch. Upstream patch posted: https://www.redhat.com/archives/libvir-list/2012-April/msg00954.html Now committed: commit c09acad352039d896f45374a8241910fb207ae56 Author: Eric Blake <eblake> Date: Wed Apr 18 17:58:44 2012 -0600 conf: tighten up XML integer parsing https://bugzilla.redhat.com/show_bug.cgi?id=617711 reported that even with my recent patched to allow <memory unit='G'>1</memory>, people can still get away with trying <memory>1G</memory> and silently get <memory unit='KiB'>1</memory> instead. While virt-xml-validate catches the error, our C parser did not. Not to mention that it's always fun to fix bugs while reducing lines of code. :) * src/conf/domain_conf.c (virDomainParseMemory): Check for parse error. (virDomainDefParseXML): Avoid strtoll. * src/conf/storage_conf.c (virStorageDefParsePerms): Likewise. * src/util/xml.c (virXPathLongBase, virXPathULongBase) (virXPathULongLong, virXPathLongLong): Likewise. |