Bug 927122

Summary: [virt-sandbox-service] path option is ignored when create sandbox
Product: Red Hat Enterprise Linux 7 Reporter: Wayne Sun <gsun>
Component: libvirt-sandboxAssignee: Daniel Berrangé <berrange>
Status: CLOSED WORKSFORME QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: ajia, berrange, dwalsh, dyuan, mzhan, rwu, virt-maint, weizhan, zpeng
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 922630 Environment:
Last Closed: 2013-06-25 03:23:00 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:
Bug Depends On: 922630    
Bug Blocks:    

Description Wayne Sun 2013-03-25 06:08:05 UTC
packages:
libvirt-1.0.3-1.el7.x86_64
libvirt-sandbox-0.1.2-1.el7.x86_64
kernel-3.7.0-0.36.el7.x86_64

steps:
1. create with -p option
# virt-sandbox-service create -p /home/wayne/test/ -t svirt_lxc_net_t -l s0:c200,c300 -C -u httpd.service apache13
Loaded plugins: product-id
Created sandbox container dir /var/lib/libvirt/filesystems/apache13
Created sandbox config /etc/libvirt-sandbox/services/apache13.sandbox
Created unit file /etc/systemd/system/apache13_sandbox.service

# ll /home/wayne/test/
total 0

2. start sandbox
# virt-sandbox-service start apache13
systemd 198 running in system mode. (+PAM +LIBWRAP +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ)
Detected virtualization 'lxc-libvirt'.
1Set hostname to <apache13>.
Default target could not be isolated, starting instead: Operation refused, unit may not be isolated.
[  OK  ] Listening on Journal Socket.
[  OK  ] Listening on Delayed Shutdown Socket.
[  OK  ] Reached target Swap.
[  OK  ] Reached target Local File Systems.
         Starting Recreate Volatile Files and Directories...
         Starting Journal Service...
[  OK  ] Started Journal Service.
[  OK  ] Started Recreate Volatile Files and Directories.
[  OK  ] Reached target System Initialization.
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Reached target Sockets.
[  OK  ] Reached target Basic System.
         Starting The Apache HTTP Server...
httpd.service: main process exited, code=exited, status=1/FAILURE
[FAILED] Failed to start The Apache HTTP Server.
See 'systemctl status httpd.service' for details.
Unit httpd.service entered failed state
[  OK  ] Reached target Sandbox multi-user target.

# ll -Z /home/wayne/test/
# ll -Zd /home/wayne/test/
drwxr-xr-x. root root unconfined_u:object_r:user_home_t:s0 /home/wayne/test/
[root@intel-e7420-128-2 ~]# ll -Z /var/lib/libvirt/filesystems/apache13
drwxr-xr-x. root root system_u:object_r:svirt_lxc_file_t:s0:c200,c300 etc
drwxr-xr-x. root root system_u:object_r:svirt_lxc_file_t:s0:c200,c300 home
dr-xr-x---. root root system_u:object_r:svirt_lxc_file_t:s0:c200,c300 root
drwxr-xr-x. root root system_u:object_r:svirt_lxc_file_t:s0:c200,c300 usr
drwxr-xr-x. root root system_u:object_r:svirt_lxc_file_t:s0:c200,c300 var

The path is still as default.

+++ This bug was initially created as a clone of Bug #922630 +++

Description of problem:
The path option -p or --path is ignored when create sandbox container.

Version-Release number of selected component (if applicable):
libvirt-sandbox-0.1.0-1.fc18.x86_64
httpd-2.4.3-15.fc18.x86_64
kernel-3.8.2-206.fc18.x86_64

How reproducible:
always

Steps to Reproduce:
1. make a dir
# ll /home/wayne/test/ -dZ
drwxr-xr-x. root root unconfined_u:object_r:user_home_t:s0 /home/wayne/test/

2. create a sandbox container with -p
# virt-sandbox-service create -p /home/wayne/test/ -t svirt_lxc_net_t -l s0:c200,c300 -C -u httpd.service apache13
Created sandbox container dir /var/lib/libvirt/filesystems/apache13
Created sandbox config /etc/libvirt-sandbox/services/apache13.sandbox
Created unit file /etc/systemd/system/httpd

# ll -Zd /home/wayne/test/
drwxr-xr-x. root root unconfined_u:object_r:user_home_t:s0 /home/wayne/test/

container dir remains at the default dir, the given dir is empty.

3.
  
Actual results:
-p is ignored

Expected results:
given path should work with create sandbox container

Additional info:

Comment 2 Daniel Walsh 2013-04-01 19:05:01 UTC
Fix path handling in my pool, needed for handling of openshift.

Comment 3 Wayne Sun 2013-06-05 07:19:39 UTC
pkgs:
libvirt-sandbox-0.2.0-1.el7.x86_64
libvirt-1.0.6-1.el7.x86_64
kernel-3.9.0-0.55.el7.x86_64

steps:
1. create container with given path
# ll -Zd /home/wayne/test/
drwxrwxr-x. wayne wayne unconfined_u:object_r:user_home_t:s0 /home/wayne/test/

# virt-sandbox-service create -p /home/wayne/test/ -s static,label=system_u:system_r:svirt_lxc_net_t:s0:c200,c300 -C -u httpd.service -N dhcp,source=default apache13
Created sandbox container dir /home/wayne/test//apache13
Created unit file /etc/systemd/system/apache13_sandbox.service
Created sandbox config /etc/libvirt-sandbox/services/apache13.sandbox

# ll -Z /home/wayne/test/apache13/
drwxr-xr-x. root root system_u:object_r:svirt_lxc_file_t:s0:c200,c300 etc
drwxr-xr-x. root root system_u:object_r:svirt_lxc_file_t:s0:c200,c300 home
dr-xr-x---. root root system_u:object_r:svirt_lxc_file_t:s0:c200,c300 root
drwxr-xr-x. root root system_u:object_r:svirt_lxc_file_t:s0:c200,c300 usr
drwxr-xr-x. root root system_u:object_r:svirt_lxc_file_t:s0:c200,c300 var

2. start it
# virt-sandbox-service start apache13
systemd 204 running in system mode. (+PAM +LIBWRAP +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ)
Detected virtualization 'lxc-libvirt'.

Welcome to Red Hat Enterprise Linux Server 7.0 (Maipo)!

Set hostname to <apache13>.
  /dev/mapper/control: mknod failed: Operation not permitted
  Failure to communicate with kernel device-mapper driver.
  Check that device-mapper is available in the kernel.
[  OK  ] Reached target Paths.
[  OK  ] Listening on Delayed Shutdown Socket.
[  OK  ] Listening on Journal Socket.
[  OK  ] Reached target Swap.
         Starting Activation of LVM2 logical volumes...
         Starting Journal Service...
[  OK  ] Started Journal Service.
[  OK  ] Started Activation of LVM2 logical volumes.
         Starting Activation of LVM2 logical volumes...
[  OK  ] Started Activation of LVM2 logical volumes.
[  OK  ] Reached target Local File Systems.
         Starting Recreate Volatile Files and Directories...
[  OK  ] Started Recreate Volatile Files and Directories.
[  OK  ] Reached target System Initialization.
[  OK  ] Reached target Timers.
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Reached target Sockets.
[  OK  ] Reached target Basic System.
         Starting The Apache HTTP Server...
         Starting Cleanup of Temporary Directories...
[  OK  ] Started Cleanup of Temporary Directories.
httpd.service: main process exited, code=exited, status=1/FAILURE
[FAILED] Failed to start The Apache HTTP Server.
See 'systemctl status httpd.service' for details.
Unit httpd.service entered failed state.
[  OK  ] Reached target Sandbox multi-user target.

# ps auxZ|grep lxc

unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 root 21564 0.9  0.0 269940 5648 pts/0 S+ 15:11   0:00 virt-sandbox-service-util -c lxc:/// -s apache13
system_u:system_r:virtd_lxc_t:s0-s0:c0.c1023 root 21599 0.0  0.0 168348 2816 ? Ssl  15:11   0:00 /usr/libexec/libvirt_lxc --name apache13 --console 26 --security=selinux --handshake 29 --background
system_u:system_r:svirt_lxc_net_t:s0:c200,c300 root 21602 0.3  0.0 48248 3360 pts/0 Ss+ 15:11   0:00 /bin/systemd --unit multi-user.target --log-target console --system
system_u:system_r:svirt_lxc_net_t:s0:c200,c300 root 21613 0.0  0.0 38060 1612 ? Ss  15:11   0:00 /usr/lib/systemd/systemd-journald

The container created with given path works now.

Comment 4 Daniel Walsh 2013-06-07 20:06:24 UTC
It works for me?

Sometimes apache fails because it can not resolve its hostname.

Comment 5 Wayne Sun 2013-06-25 03:23:00 UTC
(In reply to Daniel Walsh from comment #4)
> It works for me?
> 
> Sometimes apache fails because it can not resolve its hostname.

pkgs:
libvirt-1.0.6-1.el7.x86_64
libvirt-sandbox-0.2.0-1.el7.x86_64
libvirt-gobject-0.1.6-1.el7.x86_64
libvirt-glib-0.1.6-1.el7.x86_64
qemu-kvm-1.5.0-2.el7.x86_64
kernel-3.9.0-0.55.el7.x86_64
lvm2-2.02.98-6.el7.x86_64

steps:
1. create container with given path
# ll -Z /home/wayne/test

# virt-sandbox-service create -p /home/wayne/test/ -s static,label=system_u:system_r:svirt_lxc_net_t:s0:c200,c300 -C -u httpd.service -N dhcp,source=default apache13
Created sandbox container dir /home/wayne/test//apache13
Created unit file /etc/systemd/system/apache13_sandbox.service
Created sandbox config /etc/libvirt-sandbox/services/apache13.sandbox

# ll -Z /home/wayne/test/apache13/
drwxr-xr-x. root root system_u:object_r:svirt_lxc_file_t:s0:c200,c300 etc
drwxr-xr-x. root root system_u:object_r:svirt_lxc_file_t:s0:c200,c300 home
dr-xr-x---. root root system_u:object_r:svirt_lxc_file_t:s0:c200,c300 root
drwxr-xr-x. root root system_u:object_r:svirt_lxc_file_t:s0:c200,c300 usr
drwxr-xr-x. root root system_u:object_r:svirt_lxc_file_t:s0:c200,c300 var

2. start container
# virt-sandbox-service start apache13
2013-06-25 03:20:15.189+0000: 1: debug : lxcContainerSetStdio:278 : rc=0
2013-06-25 03:20:15.189+0000: 1: debug : virFileClose:90 : Closed fd 14
2013-06-25 03:20:15.189+0000: 1: debug : virFileClose:90 : Closed fd 9
2013-06-25 03:20:15.189+0000: 1: debug : virFileClose:90 : Closed fd 11
systemd 204 running in system mode. (+PAM +LIBWRAP +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ)
Detected virtualization 'lxc-libvirt'.

Welcome to Red Hat Enterprise Linux Server 7.0 (Maipo)!

Set hostname to <apache13>.
  /dev/mapper/control: mknod failed: Operation not permitted
  Failure to communicate with kernel device-mapper driver.
  Check that device-mapper is available in the kernel.
[  OK  ] Reached target Paths.
[  OK  ] Listening on Delayed Shutdown Socket.
[  OK  ] Listening on Journal Socket.
[  OK  ] Reached target Swap.
         Starting Activation of LVM2 logical volumes...
         Starting Journal Service...
[  OK  ] Started Journal Service.
[  OK  ] Started Activation of LVM2 logical volumes.
         Starting Activation of LVM2 logical volumes...
[  OK  ] Started Activation of LVM2 logical volumes.
[  OK  ] Reached target Local File Systems.
         Starting Recreate Volatile Files and Directories...
[  OK  ] Started Recreate Volatile Files and Directories.
[  OK  ] Reached target System Initialization.
[  OK  ] Reached target Timers.
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Reached target Sockets.
[  OK  ] Reached target Basic System.
         Starting The Apache HTTP Server...
         Starting Cleanup of Temporary Directories...
[  OK  ] Started Cleanup of Temporary Directories.
         Starting D-Bus System Message Bus...
[  OK  ] Started D-Bus System Message Bus.
[  OK  ] Started The Apache HTTP Server.
[  OK  ] Reached target Sandbox multi-user target.

it works fine, so close it.