Bug 1230124 - ovirt-engine.py uses env variables
Summary: ovirt-engine.py uses env variables
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.5.1
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
: 3.5.4
Assignee: Yedidyah Bar David
QA Contact: Pavel Stehlik
URL:
Whiteboard: integration
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-06-10 09:57 UTC by Pavel Zhukov
Modified: 2019-07-16 11:57 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-06-22 05:44:28 UTC
oVirt Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Pavel Zhukov 2015-06-10 09:57:11 UTC
Description of problem:
ovirt-engine.py uses env variable to check if DEBUG is enabled or not. If user restart service using "service ovirt-engine restart" (recommend way btw) environment variables are cleaned up. 
using of "/etc/init.d/ovirt-engine restart" fixes the problem but it's not recommended way to do

Version-Release number of selected component (if applicable):
rhevm-backend-3.5.1.1-0.1.el6ev.noarch


How reproducible:
100%

Steps to Reproduce:
1. export OVIRT_SERVICE_DEBUG=1 
2. service ovirt-engine restart


Actual results:
logger.level = 20 (INFO)

Expected results:
logger.level = 10 (DEBUG)

Additional info:
    if os.environ.get('OVIRT_SERVICE_DEBUG', '0') != '0':
        logger.setLevel(logging.DEBUG)
    else:
        logger.setLevel(logging.INFO)

Comment 1 Alon Bar-Lev 2015-06-10 13:04:27 UTC
should use /etc/sysconfig/ovirt-engine to control the environment.

Comment 4 Sandro Bonazzola 2015-06-16 12:19:57 UTC
I think Alon is correct, please use  /etc/sysconfig/ovirt-engine for setting OVIRT_SERVICE_DEBUG=1 instead of exporting the variable.

Comment 5 Pavel Zhukov 2015-06-16 12:31:45 UTC
(In reply to Sandro Bonazzola from comment #4)
> I think Alon is correct, please use  /etc/sysconfig/ovirt-engine for setting
> OVIRT_SERVICE_DEBUG=1 instead of exporting the variable.
For sure I've tried this approach
I have this:
[root@rhevm engine.conf.d]# cat /etc/ovirt-engine/engine.conf.d/10-debug.conf 
OVIRT_SERVICE_DEBUG=1
and it doesn't work.


    if os.environ.get('OVIRT_SERVICE_DEBUG', '0') != '0':
        logger.setLevel(logging.DEBUG)
        print("Set to debug")
    else:
        logger.setLevel(logging.INFO)
        print("Set to info")  << == !!!!



/ssh:root.85.107: #$ service ovirt-engine restart 
Stopping oVirt Engine: [60G[  OK  ]
Starting oVirt Engine: Set to info   << !!!!
[60G[  OK  ]

Comment 6 Alon Bar-Lev 2015-06-16 12:34:44 UTC
Again, location of environment variables for service is at /etc/sysconfig/ovirt-engine

Please follow instructions closely.

Thanks.

Comment 7 Pavel Zhukov 2015-06-17 06:59:15 UTC
(In reply to Alon Bar-Lev from comment #6)
> Again, location of environment variables for service is at
> /etc/sysconfig/ovirt-engine
> 
> Please follow instructions closely.
> 
> Thanks.

Alon, iirc ovirt-engine switched from using sysconfig to /etc/ovirt-engine/engine.conf.d, didn't it? 

Anyway:
[root@rhevm ~]# service ovirt-engine restart   
Stopping oVirt Engine:                                     [  OK  ]
Starting oVirt Engine: Set to info   <<< !!!!
Test logger before handler 20
                                                           [  OK  ]
[root@rhevm ~]# cat /etc/sysconfig/ovirt-engine 
OVIRT_SERVICE_DEBUG=1

Comment 8 Pavel Zhukov 2015-06-17 07:02:14 UTC
https://bugzilla.redhat.com/show_bug.cgi?id=917586
 [RFE] Use /etc/ovirt-engine/engine.conf for local configuration instead of /etc/sysconfig/ovirt-engine


# rpm -qf /etc/sysconfig/ovirt-engine 
file /etc/sysconfig/ovirt-engine is not owned by any package

Comment 9 Alon Bar-Lev 2015-06-17 07:05:26 UTC
These are two different configurations.

/etc/sysconfig/ovirt-engine - environment for service.
/etc/ovirt-engine/engine.conf.d - configuration for application.

If you need special customization of service environment, the standard method to apply that is /etc/sysconfig/@SERVICE_NAME@.

Comment 10 Yedidyah Bar David 2015-06-17 07:59:20 UTC
(In reply to Pavel Zhukov from comment #7)
> (In reply to Alon Bar-Lev from comment #6)
> > Again, location of environment variables for service is at
> > /etc/sysconfig/ovirt-engine
> > 
> > Please follow instructions closely.
> > 
> > Thanks.
> 
> Alon, iirc ovirt-engine switched from using sysconfig to
> /etc/ovirt-engine/engine.conf.d, didn't it? 
> 
> Anyway:
> [root@rhevm ~]# service ovirt-engine restart   
> Stopping oVirt Engine:                                     [  OK  ]
> Starting oVirt Engine: Set to info   <<< !!!!
> Test logger before handler 20
>                                                            [  OK  ]
> [root@rhevm ~]# cat /etc/sysconfig/ovirt-engine 
> OVIRT_SERVICE_DEBUG=1

please try to export it there:

OVIRT_SERVICE_DEBUG=1
export OVIRT_SERVICE_DEBUG

Comment 11 Pavel Zhukov 2015-06-22 05:44:08 UTC
Exporting works.


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