Bug 1003720

Summary: fail to create postfix container
Product: Red Hat Enterprise Linux 7 Reporter: zhe peng <zpeng>
Component: libvirt-sandboxAssignee: Daniel Berrangé <berrange>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: ajia, dallan, dyuan, gsun, weizhan
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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 10:10:45 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:

Description zhe peng 2013-09-03 02:31:15 UTC
Description of problem:
Can't create container with postfix.service.

Version-Release number of selected component (if applicable):
libvirt-sandbox-0.5.0-3.el7.x86_64
libvirt-1.1.1-3.el7.x86_64
postfix-2.10.1-1.el7.x86_64

How reproducible:

100%

Steps to Reproduce:
1. create a container with postfix
# virt-sandbox-service create -C -u postfix.service mypost
Traceback (most recent call last):
  File "/usr/bin/virt-sandbox-service", line 1160, in <module>
    args.func(args)
  File "/usr/bin/virt-sandbox-service", line 811, in create
    container.create()
  File "/usr/bin/virt-sandbox-service", line 748, in create
    raise e
shutil.Error: [('/var/spool/postfix/public/qmgr', '/var/lib/libvirt/filesystems/mypost/var/spool/postfix/public/qmgr', "[Errno 6] No such device or address:
........

2. # ll /var/spool/postfix/public/ -a
total 8
drwx--x---.  2 postfix postdrop 4096 Sep  2 11:39 .
drwxr-xr-x. 16 root    root     4096 Sep  2 11:31 ..
srw-rw-rw-.  1 postfix postfix     0 Sep  2 11:39 cleanup
srw-rw-rw-.  1 postfix postfix     0 Sep  2 11:39 flush
srw-rw-rw-.  1 postfix postfix     0 Sep  2 11:39 pickup
srw-rw-rw-.  1 postfix postfix     0 Sep  2 11:39 qmgr
srw-rw-rw-.  1 postfix postfix     0 Sep  2 11:39 showq

3. # virsh -c lxc:/// list --all
 Id    Name                           State
----------------------------------------------------

[root@intel-5504-12-1 images]# virt-sandbox-service create -C -u postfix.service mypost
/usr/bin/virt-sandbox-service: /var/lib/libvirt/filesystems/mypost already exists


Actual results:
see description


Expected results:

succeed

Additional info:

Comment 2 Daniel Berrangé 2013-09-18 11:58:55 UTC
It seems that /var/spool/postfix/public/qmgr is a UNIX socket. Python's shutil.copytree() code just raises an exception if it finds  a UNIX socket or FIFO file, which is less than helpful.

Comment 3 Daniel Berrangé 2013-09-18 12:30:48 UTC
commit 45891224a46c13200303a9d100ce1763acfd4509
Author: Daniel P. Berrange <berrange>
Date:   Wed Sep 18 13:22:32 2013 +0100

    Stop using broken shutil.copytree() method
    
    The shutil.copytree() method is broken in several ways
    
     - Raises exceptions if it sees a socket or fifo
     - Copies block/char device content into plain files
     - Calls stat() far too many times
    
    Fixing this requires passing a callback to filter the
    file list, which requires more use of stat() making it
    even less efficient.
    
    Ditch it and write a method that works correctly for
    our needs, skipping block/char/fifo/socket files entirely.
    
    Signed-off-by: Daniel P. Berrange <berrange>

Comment 5 zhe peng 2013-10-09 09:41:18 UTC
verify with build:
libvirt-sandbox-0.5.0-5.el7.x86_64
libvirt-1.1.1-8.el7.x86_64
postfix-2.10.1-2.el7.x86_64

step:
1:# virt-sandbox-service create -C -u postfix.service mypost 
Created sandbox container dir /var/lib/libvirt/filesystems/mypost
Created unit file /etc/systemd/system/mypost_sandbox.service
Created sandbox config /etc/libvirt-sandbox/services/mypost/config/sandbox.cfg

2:# virsh -c lxc:/// start mypost
Domain mypost started

3:# virt-sandbox-service connect mypost
sh-4.2# systemctl status postfix
postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled)
  Drop-In: /etc/systemd/system/postfix.service.d
           └─virt-sandbox.conf
   Active: active (running) since Wed 2013-10-09 17:37:52 CST; 18s ago
  Process: 20 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS)
  Process: 19 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
  Process: 14 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)
 Main PID: 91 (master)
   CGroup: name=systemd:/system/libvirtd.service/system/postfix.service
           ├─91 /usr/libexec/postfix/master -w
           ├─92 pickup -l -t unix -u
           └─93 qmgr -l -t unix -u
           ‣ 91 /usr/libexec/postfix/master -w

move to verified.

Comment 7 Ludek Smid 2014-06-13 10:10:45 UTC
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.