]> git.ipfire.org Git - thirdparty/libvirt.git/commit
conf: Don't format cputune element when not needed
authorMartin Kletzander <mkletzan@redhat.com>
Mon, 17 Dec 2012 15:03:01 +0000 (16:03 +0100)
committerMartin Kletzander <mkletzan@redhat.com>
Wed, 30 Jan 2013 08:37:03 +0000 (09:37 +0100)
commit1f50730e44df8cc965149c2b4fd5bdac898e5b62
treedd473ba721b1a191ceb372b2773a3cf27f976397
parent790d364ca282893b12afc9fa2779ba2ff70aa4de
conf: Don't format cputune element when not needed

Commit 60b176c3d0f0d5037acfa5e27c7753f657833a0b introduced a bug that
when editing an XML with cputune similar to this:

...
  <vcpu placement='static' current='1'>2</vcpu>
  <cputune>
    <vcpupin vcpu="1" cpuset="0"/>
  </cputune>
...

results in formatted XML that looks like this:

...
  <vcpu placement='static' current='1'>2</vcpu>
  <cputune>
  </cputune>
...

That is caused by a condition depending on def->cputune.vcpupin being
set rather than checking def->cputune.nvcpupin.  Notice that nvcpupin
can be 0 and vcpupin can still be allocated since it's a pointer to an
array, so no harm done there.

I also changed it on other places in the code where it depended on the
wrong variable.
src/conf/domain_conf.c