Bug 973974 - virt-sandbox-service: invalid httpd.service symbol links is generated when creating a apache container
virt-sandbox-service: invalid httpd.service symbol links is generated when cr...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt-sandbox (Show other bugs)
7.0
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: Daniel Berrange
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-13 04:09 EDT by Alex Jia
Modified: 2014-06-13 07:55 EDT (History)
6 users (show)

See Also:
Fixed In Version: libvirt-sandbox-0.5.0-4.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-13 07:55:20 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Alex Jia 2013-06-13 04:09:43 EDT
Description of problem:
Invalid httpd.service symbol links is generated when creating a apache container.

Version-Release number of selected component (if applicable):
# rpm -q libvirt-sandbox libvirt systemd kernel
libvirt-sandbox-0.2.0-1.el7.x86_64
libvirt-1.0.6-1.el7.x86_64
systemd-202-2.el7.x86_64
kernel-3.7.0-0.36.el7.x86_64


How reproducible:
always

Steps to Reproduce:
1. virt-sandbox-service create -C -u httpd.service apache1
2. cat /var/lib/libvirt/filesystems/apache1/etc/systemd/system/multi-user.target.wants/httpd.service


Actual results:

# virt-sandbox-service create -C -u httpd.service apache1
Created sandbox container dir /var/lib/libvirt/filesystems/apache1
Created unit file /etc/systemd/system/apache1_sandbox.service
Created sandbox config /etc/libvirt-sandbox/services/apache1.sandbox

# ll /var/lib/libvirt/filesystems/apache1/etc/systemd/system/
total 4
drwxr-xr-x. 2 root root 30 Jun  5 17:38 httpd.service.d
-rw-r--r--. 1 root root 45 Jun  5 17:38 multi-user.target
drwxr-xr-x. 2 root root 26 Jun  5 17:38 multi-user.target.wants

Notes, without 'httpd.service' file under the above directory.

# ll /var/lib/libvirt/filesystems/apache1/etc/systemd/system/multi-user.target.wants/httpd.service 
lrwxrwxrwx. 1 root root 16 Jun  5 17:38 /var/lib/libvirt/filesystems/apache1/etc/systemd/system/multi-user.target.wants/httpd.service -> ../httpd.service

# cat /var/lib/libvirt/filesystems/apache1/etc/systemd/system/multi-user.target.wants/httpd.service
cat: /var/lib/libvirt/filesystems/apache1/etc/systemd/system/multi-user.target.wants/httpd.service: No such file or directory



Expected results:

# ll /var/lib/libvirt/filesystems/apache1/etc/systemd/system/httpd.service
lrwxrwxrwx. 1 root root 16 Jun 31 17:59 /var/lib/libvirt/filesystems/apache1/etc/systemd/system/httpd.service -> /usr/lib/systemd/system/httpd.service


Additional info:
Comment 2 Daniel Berrange 2013-07-09 06:37:28 EDT
This is caused by

commit 004f5a9a6f9475906348e6bb0f8471b03cf1c031
Author: Michael Scherer <misc@zarb.org>
Date:   Tue May 7 14:17:01 2013 +0100

    Add support for templated unit in virt-sandbox
    
We changed from creating the entire httpd.service unit inside the container, to just creating a httpd.service.d/virt-sandbox.conf override file.
Comment 3 Daniel Berrange 2013-07-09 06:37:50 EDT
Opps, that commit should have been this

commit 775cebb4e2d5cd04d9c4ceb0a48dd36e22a3682c
Author: Michael Scherer <misc@zarb.org>
Date:   Tue May 7 14:15:46 2013 +0100

    Use drop-in configuration file instead of creating a custom file
Comment 4 Daniel Berrange 2013-10-02 11:43:24 EDT
commit 6da3e2232a4edccc6703a9e059ef70ac8988449e
Author: Daniel P. Berrange <berrange@redhat.com>
Date:   Wed Oct 2 16:41:19 2013 +0100

    Fix symlink path in multi-user.target.wants
    
    Sinc we switched to using a drop-in unit file override in
    change 775cebb4e2d5cd04d9c4ceb0a48dd36e22a3682c, the symlink
    from multi-user.target.wants is broken. We must link to the
    original source unit file via the fully qualified path.
    
    Systemd didn't actually mind that the symlink was dangling,
    but it is safer to ensure it is correct, in case systemd gets
    more strict in the future.
    
    Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Comment 6 Alex Jia 2013-10-09 06:22:47 EDT
The bug has been verified on libvirt-sandbox-0.5.0-5.el7.x86_64.


# virt-sandbox-service create -C -u httpd.service apache1
Created sandbox container dir /var/lib/libvirt/filesystems/apache1
Created unit file /etc/systemd/system/apache1_sandbox.service
Created sandbox config /etc/libvirt-sandbox/services/apache1/config/sandbox.cfg

# ll /var/lib/libvirt/filesystems/apache1/etc/systemd/system/
total 12
drwxr-xr-x. 2 root root 4096 Oct  9 18:20 httpd.service.d
-rw-r--r--. 1 root root   45 Oct  9 18:20 multi-user.target
drwxr-xr-x. 2 root root 4096 Oct  9 18:20 multi-user.target.wants

# ll /var/lib/libvirt/filesystems/apache1/etc/systemd/system/multi-user.target.wants/httpd.service
lrwxrwxrwx. 1 root root 33 Oct  9 18:20 /var/lib/libvirt/filesystems/apache1/etc/systemd/system/multi-user.target.wants/httpd.service -> /lib/systemd/system/httpd.service

# cat /var/lib/libvirt/filesystems/apache1/etc/systemd/system/multi-user.target.wants/httpd.service
[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/httpd
ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND
ExecReload=/usr/sbin/httpd $OPTIONS -k graceful
ExecStop=/usr/sbin/httpd $OPTIONS -k graceful-stop
# We want systemd to give httpd some time to finish gracefully, but still want
# it to kill httpd after TimeoutStopSec if something went wrong during the
# graceful stop. Normally, Systemd sends SIGTERM signal right after the
# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give
# httpd time to finish.
KillSignal=SIGCONT
PrivateTmp=true

[Install]
WantedBy=multi-user.target
Comment 8 Ludek Smid 2014-06-13 07:55:20 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

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