[libvirt] [PATCHv6 11/18] conf: move virResctrlAllocIsEmpty to a place a litter lower

Wang Huaqiang huaqiang.wang at intel.com
Mon Oct 22 06:59:57 UTC 2018


This refactor allows to add some code between virDomainResctrlNew
and virResctrlAllocIsEmpty to extend the scope of resctrl.

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

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 39bd396..a068d4d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19022,15 +19022,15 @@ virDomainCachetuneDefParse(virDomainDefPtr def,
             goto cleanup;
     }
 
+    resctrl = virDomainResctrlNew(node, &alloc, &vcpus, flags);
+    if (!resctrl)
+        goto cleanup;
+
     if (virResctrlAllocIsEmpty(alloc)) {
         ret = 0;
         goto cleanup;
     }
 
-    resctrl = virDomainResctrlNew(node, &alloc, &vcpus, flags);
-    if (!resctrl)
-        goto cleanup;
-
     if (VIR_APPEND_ELEMENT(def->resctrls, def->nresctrls, resctrl) < 0)
         goto cleanup;
 
-- 
2.7.4




More information about the libvir-list mailing list