Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1065141 - [RHEL7]virt-tools applications failed to start under directory "/usr/share/virt-manager"
Summary: [RHEL7]virt-tools applications failed to start under directory "/usr/share/vi...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: virt-manager
Version: 7.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Giuseppe Scrivano
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-14 02:16 UTC by zhengqin
Modified: 2015-02-24 11:33 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-02-24 11:33:04 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description zhengqin 2014-02-14 02:16:30 UTC
Description of problem:
virt-tools applications (virt-manager, virt-install, virt-clone, virt-convert and virt-image) could not start if current directory is "/usr/share/virt-manager"

Version-Release number of selected component:
virt-manager-0.10.0-16.el7.noarch
virt-install-0.10.0-16.el7.noarch


How reproducible:
100%

steps:
1. Install virt-manager and virt-install by rpm or yum;
2. Under root user, change directory to "/usr/share/virt-manager" 
[root@localhost ~]# cd /usr/share/virt-manager

3. Start virt-manager, virt-install, virt-clone, virt-convert and virt-image
[root@localhost virt-manager]# pwd
/usr/share/virt-manager

[root@localhost virt-manager]# ls 
icons  ui  virtcli  virt-clone  virtconv  virt-convert  virt-image  virtinst  virt-install  virt-manager  virtManager
 
[root@localhost virt-manager]#virt-manager
Error opening directory '/usr/share/virt-manager/data': No such file or directory
Traceback (most recent call last):
  File "/usr/share/virt-manager/virt-manager", line 36, in <module>
    from virtcli import cliutils, cliconfig
  File "/usr/share/virt-manager/virtcli/cliutils.py", line 31, in <module>
    from virtcli import cliconfig
  File "/usr/share/virt-manager/virtcli/cliconfig.py", line 74, in <module>
    _setup_gsettings_path(icon_dir)
  File "/usr/share/virt-manager/virtcli/cliconfig.py", line 56, in _setup_gsettings_path
    raise RuntimeError("Failed to compile local gsettings schemas")
RuntimeError: Failed to compile local gsettings schemas

Actual results:
virt-manager, virt-install, virt-clone, virt-convert and virt-image could not start.


Expected Results:
All applications should be worked well.


Additional info:
1. After I check the source rpm package for virt-manager-0.10.0-16.el7.src.rpm, I found the folder "data":
[root@localhost BUILD]#  ls -F virt-manager-0.10.0/data/
gschemas.compiled  hicolor/  icons/  org.virt-manager.virt-manager.gschema.xml  virt-manager.desktop.in

After I copy the folder "data" into "/usr/share/virt-manager", all apps could be worked well.  
I think there is some problem with code "/usr/share/virt-manager/virtcli/cliconfig.py" for following section:
---------------------------------------------------------
if os.getcwd() == _srcdir:
    asset_dir = _srcdir
    icon_dir = os.path.join(_srcdir, "data")
    _setup_gsettings_path(icon_dir)
else:
    asset_dir = install_asset_dir
    icon_dir = os.path.join(asset_dir, "icons")
---------------------------------------------------------

Following patch could be worked well for rpm/yum install virt-manager
[root@localhost /]# diff /usr/share/virt-manager/virtcli/cliconfig.py /usr/share/virt-manager/virtcli/cliconfig.py.new 
71,77c71,72
< if os.getcwd() == _srcdir:
<     asset_dir = _srcdir
<     icon_dir = os.path.join(_srcdir, "data")
<     _setup_gsettings_path(icon_dir)
< else:
<     asset_dir = install_asset_dir
<     icon_dir = os.path.join(asset_dir, "icons")
---
> asset_dir = install_asset_dir
> icon_dir = os.path.join(asset_dir, "icons")


2. This issue does not occur on RHEL6.

3. This issue does not occur if starting application but not in directory "/usr/share/virt-manager"

Comment 1 Alex Jia 2014-02-14 04:17:19 UTC
(In reply to zhengqin from comment #0)
> 
> Following patch could be worked well for rpm/yum install virt-manager
> [root@localhost /]# diff /usr/share/virt-manager/virtcli/cliconfig.py
> /usr/share/virt-manager/virtcli/cliconfig.py.new 
> 71,77c71,72
> < if os.getcwd() == _srcdir:
> <     asset_dir = _srcdir
> <     icon_dir = os.path.join(_srcdir, "data")
> <     _setup_gsettings_path(icon_dir)
> < else:
> <     asset_dir = install_asset_dir
> <     icon_dir = os.path.join(asset_dir, "icons")
> ---
> > asset_dir = install_asset_dir
> > icon_dir = os.path.join(asset_dir, "icons")
> 

Not exactly, if running from the virt-manager.git srcdir, you need to compile gsettings schema firstly then run your apps with "GSETTINGS_SCHEMA_DIR" ENV, so the " _setup_gsettings_path()" is necessary, there are several question in here, the first is 'icon_dir' variable is unused in the else statement, the second is w/o any judgement for the 'icon_dir' dir exists or not before _setup_gsettings_path().

Comment 2 zhengqin 2014-02-14 05:42:16 UTC
 (In reply to Alex Jia from comment #1)
> (In reply to zhengqin from comment #0)
> > 
> > Following patch could be worked well for rpm/yum install virt-manager
> > [root@localhost /]# diff /usr/share/virt-manager/virtcli/cliconfig.py
> > /usr/share/virt-manager/virtcli/cliconfig.py.new 
> > 71,77c71,72
> > < if os.getcwd() == _srcdir:
> > <     asset_dir = _srcdir
> > <     icon_dir = os.path.join(_srcdir, "data")
> > <     _setup_gsettings_path(icon_dir)
> > < else:
> > <     asset_dir = install_asset_dir
> > <     icon_dir = os.path.join(asset_dir, "icons")
> > ---
> > > asset_dir = install_asset_dir
> > > icon_dir = os.path.join(asset_dir, "icons")
> > 
> 
> Not exactly, if running from the virt-manager.git srcdir, you need to
> compile gsettings schema firstly then run your apps with
> "GSETTINGS_SCHEMA_DIR" ENV, so the " _setup_gsettings_path()" is necessary,
> there are several question in here, the first is 'icon_dir' variable is
> unused in the else statement, the second is w/o any judgement for the
> 'icon_dir' dir exists or not before _setup_gsettings_path().

Yes, this issue is against yum/rpm installation method, and the patch also is for  yum/rpm installation method.  For yum/rpm installation method, no need to compile gsettings schema.

The code cliconfig.py want to deal with 2 installation methoed both for yum/rpm and git source code installation. If cliconfig.py want to do that, just copy "data" into /usr/share/virt-manager/ just I mentioned in additional info. But it is strange here for this method, since for yum/rpm installation method, no need to compile gsettings schema.  So, I think the patch is good for yum/rpm installation method, and for git source code installation, keep to compile gsettings schema firstly.

Comment 3 zhengqin 2014-02-14 05:57:49 UTC
(In reply to zhengqin from comment #2)
>  (In reply to Alex Jia from comment #1)
> > (In reply to zhengqin from comment #0)
> > > 
> > > Following patch could be worked well for rpm/yum install virt-manager
> > > [root@localhost /]# diff /usr/share/virt-manager/virtcli/cliconfig.py
> > > /usr/share/virt-manager/virtcli/cliconfig.py.new 
> > > 71,77c71,72
> > > < if os.getcwd() == _srcdir:
> > > <     asset_dir = _srcdir
> > > <     icon_dir = os.path.join(_srcdir, "data")
> > > <     _setup_gsettings_path(icon_dir)
> > > < else:
> > > <     asset_dir = install_asset_dir
> > > <     icon_dir = os.path.join(asset_dir, "icons")
> > > ---
> > > > asset_dir = install_asset_dir
> > > > icon_dir = os.path.join(asset_dir, "icons")
> > > 
> > 
> > Not exactly, if running from the virt-manager.git srcdir, you need to
> > compile gsettings schema firstly then run your apps with
> > "GSETTINGS_SCHEMA_DIR" ENV, so the " _setup_gsettings_path()" is necessary,
> > there are several question in here, the first is 'icon_dir' variable is
> > unused in the else statement, the second is w/o any judgement for the
> > 'icon_dir' dir exists or not before _setup_gsettings_path().
> 
> Yes, this issue is against yum/rpm installation method, and the patch also
> is for  yum/rpm installation method.  For yum/rpm installation method, no
> need to compile gsettings schema.
> 
> The code cliconfig.py want to deal with 2 installation methoed both for
> yum/rpm and git source code installation. If cliconfig.py want to do that,
> just copy "data" into /usr/share/virt-manager/ just I mentioned in
> additional info. But it is strange here for this method, since for yum/rpm
> installation method, no need to compile gsettings schema.  So, I think the
> patch is good for yum/rpm installation method, and for git source code
> installation, keep to compile gsettings schema firstly.
Per my understanding:

For 1st question, 'icon_dir' variable is unused in the else statement:
-No need to compile gsettings schema, so need to _setup_gsettings_path(icon_dir)

For 2th question,  w/o any judgement for the 'icon_dir' dir exists or not before _setup_gsettings_path().
-The code does not judgement for it, the source code puts 'icon_dir' named "icons" for its location, so it uses following code to point out its location:
------------------------------------------------------------
prefix = _get_param("prefix", "/usr")
gettext_dir = os.path.join(prefix, "share", "locale")
install_asset_dir = os.path.join(prefix, "share", "virt-manager")
if os.getcwd() == _srcdir:
    asset_dir = _srcdir
    icon_dir = os.path.join(_srcdir, "data")
    _setup_gsettings_path(icon_dir)
else:
    asset_dir = install_asset_dir
    icon_dir = os.path.join(asset_dir, "icons")
-----------------------------------------------------------

Comment 4 zhengqin 2014-02-14 06:15:36 UTC
It is not a good idea to use path for judge whether it is running from the virt-manager.git srcdir
---------------------------
if os.getcwd() == _srcdir:
---------------------------

So, it causes this issue.

Comment 6 Giuseppe Scrivano 2015-02-24 11:33:04 UTC
this is an useful feature to run virt-manager directly from the source directory.  Just do not use /usr/share/virt-manager as working directory.


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