[node-patches] Change in ovirt-node[master]: Do not call ovirt_store_config_retnum for every file to avoi...

pzhukov at redhat.com pzhukov at redhat.com
Wed Jan 6 12:28:16 UTC 2016


Pavel Zhukov has uploaded a new change for review.

Change subject: Do not call ovirt_store_config_retnum for every file to avoid performance degradation
......................................................................

Do not call ovirt_store_config_retnum for every file to avoid performance degradation

Calling ovirt_store_config_retnum for every file instead of filelist requires Python interpreteur for every call
and slows down persistense a lot. As far as ovirt_store_config_retnum accepts list we can pass lists and check
return code of entire call. Exit if severe error occurs

Change-Id: Ie4423baf3446e62ab8af2da2ff4008fe9fbd82b4
Bugzilla-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1296141
Signed-off-by: Pavel Zhukov <pzhukov at redhat.com>
---
M scripts/ovirt-functions.in
1 file changed, 13 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/22/51422/1

diff --git a/scripts/ovirt-functions.in b/scripts/ovirt-functions.in
index 9291a87..96eeccf 100644
--- a/scripts/ovirt-functions.in
+++ b/scripts/ovirt-functions.in
@@ -656,19 +656,23 @@
 #   ovirt_store_config /etc/config /etc/config2 ...
 #   copy to /config and bind-mount back
 ovirt_store_config() {
-    for p in "$@"; do
-        python <<EOP
+    for file in "$@"; do
+      ## ovirt_store_config_retnum accept list
+      ## Passing list here because of performance
+      files="$files","$file"
+    done
+    python <<EOP
 from ovirtnode.ovirtfunctions import ovirt_store_config_retnum
 
-ovirt_store_config_retnum("$p")
+ovirt_store_config_retnum("$files")
 EOP
-        rc=$?
-        if [ $rc -eq 1 ] || [ $rc -eq 2 ]; then
-            return $rc
-        fi
+    rc=$?
+    if [ $rc -eq 1 ] || [ $rc -eq 2 ]; then
+        return $rc
+    fi
     done
-    # We alwasy return 0 here, because:
-    # If any of the persisted files in $@ had a severe issue
+    # We always return 0 here, because:
+    # If any of the persisted files in $files had a severe issue
     # (rc of 1 or 2), then we'd have already exited.
     # But if we got here, then no severe issue was hit and
     # we are good.


-- 
To view, visit https://gerrit.ovirt.org/51422
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie4423baf3446e62ab8af2da2ff4008fe9fbd82b4
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Pavel Zhukov <pzhukov at redhat.com>



More information about the node-patches mailing list