Bug 726643 - host installation failed - vds_bootstrap imports utils from yum [for RHEL 5.8 / VDSM 2.2.x]
Summary: host installation failed - vds_bootstrap imports utils from yum [for RHEL 5....
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: vdsm22
Version: 5.7
Hardware: All
OS: Linux
urgent
urgent
Target Milestone: rc
: ---
Assignee: Federico Simoncelli
QA Contact: Pavel Stehlik
URL:
Whiteboard:
Depends On:
Blocks: 726937 726941 729324
TreeView+ depends on / blocked
 
Reported: 2011-07-29 10:14 UTC by Pavel Stehlik
Modified: 2018-11-14 11:28 UTC (History)
13 users (show)

Fixed In Version: rhev-m-2.2.9.1
Doc Type: Bug Fix
Doc Text:
Attaching a Red Hat Enterprise Linux 5.7 host to a Red Hat Enterprise Virtualization Manager failed because when the bootstrap process imported the utilities, installing utils from yum overwrote the VDSM directory from the current Python path. The VDSM directory is now added to the current Python path so you can attach the 5.7 host successfully.
Clone Of:
: 726941 (view as bug list)
Environment:
Last Closed: 2012-02-21 04:53:02 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Legacy) 60375 0 None None None Never
Red Hat Product Errata RHBA-2012:0169 0 normal SHIPPED_LIVE vdsm bug fix update 2012-02-21 09:51:13 UTC

Comment 2 Miroslav Suchý 2011-07-29 12:11:41 UTC
I would say that bug 726644 is not in fault. You just import it and you hope it will work. But..:

If you do:
  import utils
and utils already exist in cache then it is used. Today it is rhnplugin, but tomorrow it will be somebody else. And it will not help you to prepend path to sys.path, since that package is already in cache. See:
http://docs.python.org/reference/simple_stmts.html#import

Correct way to avoid is to not install packages to
 /usr/share/vdsm/
but to
 %{python_sitelib}/vdsm
where
 %if 0%{?rhel} && 0%{?rhel} < 6
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%endif

Then you can do:
 import vdsm.utils
and you will have no conflict now nor in future.

Comment 3 Federico Simoncelli 2011-07-29 12:52:49 UTC
I agree on the fact that we should move to %{python_sitelib}/vdsm.

Nevertheless we won't face this problem anyway because the imported modules never change sys.path.

Also your plugin is not immune by this very same problem:

# mkdir rhnplugin-test && cd rhnplugin-test
# touch output.py
# python
>>> import os, sys, yum
>>> sys.path.append(os.getcwd())
>>> my = yum.YumBase()
>>> cu = my.pkgSack.searchNevra(name='coreutils')
Plugin "rhnplugin" can't be imported
Loaded plugins: product-id

Comment 5 Federico Simoncelli 2011-08-01 08:32:08 UTC
BZ#726643 Force VDSM_DIR in sys.path
Change-Id: I9d951b1263bac52c350fe02012a5cfeeef48ba70

http://gerrit.usersys.redhat.com/766

Comment 7 Daniel Paikov 2011-08-10 13:32:40 UTC
Checked on sm109.

Comment 8 Kate Grainger 2011-08-24 07:36:35 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Attaching a Red Hat Enterprise Linux 5.7 host to a Red Hat Enterprise Virtualization manager failed because when the bootstrap process imported the utilities, installing utils from yum overwrote the VDSM directory from the current Python path. The VDSM directory is now added to the current Python path so you can attach the 5.7 host successfully.

Comment 9 Stephen Gordon 2012-02-13 16:19:07 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-Attaching a Red Hat Enterprise Linux 5.7 host to a Red Hat Enterprise Virtualization manager failed because when the bootstrap process imported the utilities, installing utils from yum overwrote the VDSM directory from the current Python path. The VDSM directory is now added to the current Python path so you can attach the 5.7 host successfully.+Attaching a Red Hat Enterprise Linux 5.7 host to a Red Hat Enterprise Virtualization Manager failed because when the bootstrap process imported the utilities, installing utils from yum overwrote the VDSM directory from the current Python path. The VDSM directory is now added to the current Python path so you can attach the 5.7 host successfully.

Comment 10 errata-xmlrpc 2012-02-21 04:53:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0169.html


Note You need to log in before you can comment on or make changes to this bug.