Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1081621

Summary: vdsm-tool drops its environment when it execs /sbin/service
Product: [Retired] oVirt Reporter: Donn Seeley <donn.seeley>
Component: vdsmAssignee: Mooli Tayer <mtayer>
Status: CLOSED CURRENTRELEASE QA Contact: Gil Klein <gklein>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.0CC: acathrow, bazulay, donn.seeley, gklein, iheim, mgoldboi, mtayer, ybronhei, yeylon
Target Milestone: ---   
Target Release: 3.4.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: infra
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-05-08 13:37:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
patch for lib/vdsm/tool/service.py none

Description Donn Seeley 2014-03-27 17:34:10 UTC
Description of problem:

vdsm-tool drops the rest of its environment when it adds SYSTEMCTL_SKIP_REDIRECT=1 just before starting /sbin/service.  This leads to errors like:

  /etc/init.d/vdsmd: line 201: start-stop-daemon: command not found

/sbin is no longer in $PATH.


Version-Release number of selected component (if applicable):

4.14.5


How reproducible:

Easy.

Steps to Reproduce:
1. Build vdsm to use sysvinit init scripts.
2. Add a command in /sbin to /etc/init.d/vdsm (or just arrange to echo $PATH)
3. Run 'vdsm-tool service-status vdsmd'.

Actual results:

  # vdsm-tool service-status vdsmd
  service-status: ServiceOperationError: _serviceStatus failed
  VDS daemon is not running

  /etc/init.d/vdsmd: line 201: start-stop-daemon: command not found
  /etc/init.d/vdsmd: line 207: start-stop-daemon: command not found

  #


Expected results:

No output.

Additional info:

On my system, if I insert 'echo $PATH' in the vdsmd init script, I get:

  /usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.

The following change to lib/vdsm/tool/service.py appears to fix the problem:

-    _sysvEnv = {'SYSTEMCTL_SKIP_REDIRECT': '1'}
+    _sysvEnv = os.environ.copy()
+    _sysvEnv['SYSTEMCTL_SKIP_REDIRECT'] = '1'

Comment 1 Dan Kenigsberg 2014-03-27 18:43:45 UTC
Could you provide the complete version and release of your rpm? which platform are you using?

Comment 2 Donn Seeley 2014-03-27 19:09:58 UTC
We built from commit 048fcf6212e9e796af70653155f1c94635bf5654 in the git tree, for x86 64-bit.  We added some changes to make the sysvinit script work with Yocto style init script features.

However, the issue is fairly obvious just based on reading the code, and it doesn't appear to be fixed in the current git tree.

Comment 3 Dan Kenigsberg 2014-03-28 13:11:21 UTC
(I was wondering why we have not seen it in Fedora and EL)

Any chance you could post your suggested patch on gerrit.ovirt.org?

Comment 4 Donn Seeley 2014-03-28 21:02:26 UTC
Created attachment 880027 [details]
patch for lib/vdsm/tool/service.py

I don't know anything about gerrit, I'm afraid, but I'm happy to attach the patch file that I generated.

Donn

Comment 5 Sandro Bonazzola 2014-05-08 13:37:49 UTC
This is an automated message

oVirt 3.4.1 has been released:
 * should fix your issue
 * should be available at your local mirror within two days.

If problems still persist, please make note of it in this bug report.