[libvirt] [PATCH 3/9] conf: check if vcpus matches with any 'existing' allocaiton

Wang Huaqiang huaqiang.wang at intel.com
Thu May 23 09:34:14 UTC 2019


In checking if vcpus matches with any exisitng resctrl allocation it
should consider if the allocation exists or not.
'@resctrl->alloc != NULL' means an allocation exists.

Signed-off-by: Wang Huaqiang <huaqiang.wang at intel.com>
---
 src/conf/domain_conf.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index db25c1f..9c95467 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19088,10 +19088,9 @@ virDomainCachetuneDefParseCache(xmlXPathContextPtr ctxt,
 /* Checking if the monitor's vcpus is conflicted with existing allocation
  * and monitors.
  *
- * Returns 1 if @vcpus equals to @resctrl->vcpus, then the monitor will
- * share the underlying resctrl group with @resctrl->alloc. Returns - 1
- * if any conflict found. Returns 0 if no conflict and @vcpus is not equal
- * to @resctrl->vcpus.
+ * Returns 1 if @vcpus equals to vcpus of an existing resctrl allocation group.
+ * Returns -1 if any conflict found. Returns 0 if no conflict and @vcpus is
+ * not equal to any created resctrl allocation.
  */
 static int
 virDomainResctrlMonValidateVcpus(virDomainResctrlDefPtr resctrl,
@@ -19115,7 +19114,7 @@ virDomainResctrlMonValidateVcpus(virDomainResctrlDefPtr resctrl,
         }
     }
 
-    if (virBitmapEqual(vcpus, resctrl->vcpus))
+    if (virBitmapEqual(vcpus, resctrl->vcpus) && resctrl->alloc != NULL)
         return 1;
 
     for (i = 0; i < resctrl->nmonitors; i++) {
-- 
2.7.4




More information about the libvir-list mailing list