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

Wang Huaqiang posted 9 patches 6 years, 8 months ago
There is a newer version of this series
[libvirt] [PATCH 3/9] conf: check if vcpus matches with any 'existing' allocaiton
Posted by Wang Huaqiang 6 years, 8 months ago
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@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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list