]> xenbits.xensource.com Git - libvirt.git/commit
domain_conf: Use virDomainParseMemory more widely
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 7 Nov 2014 14:14:11 +0000 (15:14 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 7 Nov 2014 16:39:04 +0000 (17:39 +0100)
commit01b4de2b9f5ca821e341166210161f53552f5d60
tree2a35155a090b1f31fd34c5063d0748b41bff6a27
parent4039e22e460b25cd853bc5dc83b70dbd91ea3a19
domain_conf: Use virDomainParseMemory more widely

As reviewing patches upstream it occurred to me, that we have two
functions doing nearly the same: virDomainParseMemory which
expects XML in the following format:

  <memory unit='MiB'>1337</memory>

The other function being virDomainHugepagesParseXML expecting the
following format:

  <someElement size='1337' unit='MiB'/>

It wouldn't matter to have two functions handle two different
scenarios like this if we could only not copy code that handles
32bit arches around. So this code merges the common parts into
one by inventing new @units_xpath argument to
virDomainParseMemory which allows overriding the default location
of @unit attribute in XML. With this change both scenarios above
can be parsed with virDomainParseMemory.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/conf/domain_conf.c