Change in vdsm[master]: Hack to fix vdsm-tool import issues during upgrade

ybronhei at redhat.com ybronhei at redhat.com
Tue Mar 31 15:28:34 UTC 2015


Yaniv Bronhaim has uploaded a new change for review.

Change subject: Hack to fix vdsm-tool import issues during upgrade
......................................................................

Hack to fix vdsm-tool import issues during upgrade

In oVirt 3.5 (vdsm 4.16) we started to install vdsm site-packages under /usr/lib
(python_sitelib). In sys.path the import order first check under
/usr/lib64. While upgrading vdsm 3.4 to 3.5 we perform configure call in
%postun which calls vdsm-tool, vdsm-tool tries to import vdsm.tool which
exists both under /usr/lib and under /usr/lib64 in this specific case
before all vdsm 3.4 files were removed. In such case we get failures all
over.

This patch hacks the import part and takes care of importing vdsm.tool
from the /usr/lib on upgrade.

Change-Id: Idf3669b06b308399cb78866d72b592ac2d8b1732
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1200467
Signed-off-by: Yaniv Bronhaim <ybronhei at redhat.com>
---
M vdsm-tool/vdsm-tool
1 file changed, 22 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/10/39410/1

diff --git a/vdsm-tool/vdsm-tool b/vdsm-tool/vdsm-tool
index 8fa3bc5..e46bb21 100755
--- a/vdsm-tool/vdsm-tool
+++ b/vdsm-tool/vdsm-tool
@@ -28,8 +28,30 @@
 import syslog
 import traceback
 
+########################################################################
+# Ugly hack for 3.5 which switches the use of /usr/lib64 to /usr/lib.
+#
+# To avoid loading vdsm-tool verbs from old location (/usr/lib64)
+# we need to explicit import vdsm.tool from /usr/lib.
+# On upgrade from 3.4-3.5 when this directory change first introduced
+# we load vdsm.tool from /usr/lib64 before 3.4 package got removed.
+#
+# This leads to upgrade errors on vdsm-tool calls. With this ugly fix
+# I first add to path /usr/lib, import and then remove sys.path changes.
+# If I don't remove the changes it leads to other issues when
+# importing seobject.
+########################################################################
+
+sys.path.insert(0, '/usr/lib/python2.6/site-packages')
+sys.path.insert(0, '/usr/lib/python2.7/site-packages')
+
 import vdsm.tool
 
+sys.path.pop(0)
+sys.path.pop(0)
+
+########################################################################
+
 tool_modules = []
 tool_command = {}
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idf3669b06b308399cb78866d72b592ac2d8b1732
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybronhei at redhat.com>


More information about the vdsm-patches mailing list