提交 51da92f4 编写于 作者: W Wang Huaqiang 提交者: Michal Privoznik

conf: resctrl object is not properly handled

resctrl object stored in def->resctrls is shared by cachetune and
memorytune. The domain xml configuration is parsed firstly for
cachetune then memorytune, and the resctrl object will not be created
in parsing settings for memorytune once it found sharing exists.

But resctrl is improperly freed when sharing happens.
Signed-off-by: NWang Huaqiang <huaqiang.wang@intel.com>
Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 25b94e3b
...@@ -19590,7 +19590,6 @@ virDomainMemorytuneDefParse(virDomainDefPtr def, ...@@ -19590,7 +19590,6 @@ virDomainMemorytuneDefParse(virDomainDefPtr def,
VIR_AUTOUNREF(virResctrlAllocPtr) alloc = NULL; VIR_AUTOUNREF(virResctrlAllocPtr) alloc = NULL;
ssize_t i = 0; ssize_t i = 0;
int n; int n;
int ret = -1;
ctxt->node = node; ctxt->node = node;
...@@ -19632,14 +19631,13 @@ virDomainMemorytuneDefParse(virDomainDefPtr def, ...@@ -19632,14 +19631,13 @@ virDomainMemorytuneDefParse(virDomainDefPtr def,
if (!(resctrl = virDomainResctrlNew(node, alloc, vcpus, flags))) if (!(resctrl = virDomainResctrlNew(node, alloc, vcpus, flags)))
return -1; return -1;
if (VIR_APPEND_ELEMENT(def->resctrls, def->nresctrls, resctrl) < 0) if (VIR_APPEND_ELEMENT(def->resctrls, def->nresctrls, resctrl) < 0) {
goto cleanup; virDomainResctrlDefFree(resctrl);
return -1;
}
} }
ret = 0; return 0;
cleanup:
virDomainResctrlDefFree(resctrl);
return ret;
} }
......
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
<currentMemory unit='KiB'>219136</currentMemory> <currentMemory unit='KiB'>219136</currentMemory>
<vcpu placement='static'>4</vcpu> <vcpu placement='static'>4</vcpu>
<cputune> <cputune>
<cachetune vcpus='0-1'>
<cache id='0' level='3' type='both' size='768' unit='KiB'/>
<cache id='1' level='3' type='both' size='768' unit='KiB'/>
</cachetune>
<memorytune vcpus='0-1'> <memorytune vcpus='0-1'>
<node id='0' bandwidth='20'/> <node id='0' bandwidth='20'/>
<node id='1' bandwidth='30'/> <node id='1' bandwidth='30'/>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册