On 2019年05月27日 23:26, Michal Privoznik wrote:
On 5/23/19 11:34 AM, Wang Huaqiang wrote:
Let 'virDomainResctrlVcpuMatch' return a pointer of
@virDomainResctrlDefPtr in its third parameter.
Signed-off-by: Wang Huaqiang <huaqiang.wang@xxxxxxxxx>
---
src/conf/domain_conf.c | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index dcfd2dd..b0f5d80 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -18992,7 +18992,7 @@ virDomainResctrlParseVcpus(virDomainDefPtr def,
static int
virDomainResctrlVcpuMatch(virDomainDefPtr def,
virBitmapPtr vcpus,
- virResctrlAllocPtr *alloc)
+ virDomainResctrlDefPtr *resctrl)
{
ssize_t i = 0;
@@ -19001,7 +19001,7 @@ virDomainResctrlVcpuMatch(virDomainDefPtr def,
* Just updating memory allocation information of that group
*/
if (virBitmapEqual(def->resctrls[i]->vcpus, vcpus)) {
- *alloc = virObjectRef(def->resctrls[i]->alloc);
+ *resctrl = def->resctrls[i];
break;
}
if (virBitmapOverlaps(def->resctrls[i]->vcpus, vcpus)) {
@@ -19331,19 +19331,19 @@ virDomainCachetuneDefParse(virDomainDefPtr
def,
return -1;
}
- if (virDomainResctrlVcpuMatch(def, vcpus, &alloc) < 0)
+ if (virDomainResctrlVcpuMatch(def, vcpus, &resctrl) < 0)
return -1;
- if (!alloc) {
- alloc = virResctrlAllocNew();
- if (!alloc)
- return -1;
- } else {
+ if (resctrl) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("Identical vcpus in cachetunes found"));
return -1;
}
+ alloc = virResctrlAllocNew();
+ if (!alloc)
+ return -1;
Or simply:
if (!(alloc = virResctrlAllocNew()))
return -1;
Here and in the rest of the patches.
Got. Thanks!
+
for (i = 0; i < n; i++) {
if (virDomainCachetuneDefParseCache(ctxt, nodes[i], alloc)
< 0)
return -1;
Michal
Thanks for review.
Huaqiang
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list