Bug 970952 - fail to delete container dir created with given path
fail to delete container dir created with given path
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-05 06:00 EDT by Wayne Sun
Modified: 2014-06-13 06:57 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 06:57:08 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 Wayne Sun 2013-06-05 06:00:37 EDT
Description of problem:
create container with given path, delete will fail to remove container dir

Version-Release number of selected component (if applicable):
libvirt-1.0.6-1.el7.x86_64
libvirt-sandbox-0.2.0-1.el7.x86_64
kernel-3.9.0-0.55.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. create a container with given path
# 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

2. delete
# virt-sandbox-service delete apache13
/usr/bin/virt-sandbox-service: [Errno 2] No such file or directory: '/var/lib/libvirt/filesystems/apache13/etc/machine-id'

# echo $?
0

# ll /home/wayne/test/apache13/
total 20
drwxr-xr-x. 6 root root 4096 Jun  5 17:38 etc
drwxr-xr-x. 2 root root 4096 Jun  5 17:38 home
dr-xr-x---. 2 root root 4096 Jun  5 17:38 root
drwxr-xr-x. 3 root root 4096 Jun  5 17:38 usr
drwxr-xr-x. 8 root root 4096 Jun  5 17:38 var

3.

Actual results:
the container dir still exist

Expected results:
delete the container dir

Additional info:
if rerun create command in step 1 will fail with
/usr/bin/virt-sandbox-service: /home/wayne/test//apache13 already exists
Comment 2 Daniel Berrange 2013-07-09 06:40:10 EDT
Hmm, so the -p option causes it to use the quoted directory instead of /var/lib/libvirt/filesystems/XXXXX, but this is not remembered later when going to delete the filesystem
Comment 3 Alex Jia 2013-07-25 06:35:04 EDT
I can reproduce it on libvirt-sandbox-0.2.1-1.el7.x86_64.



[root@intel-e31225-8-3 ~]# mkdir /home/bob/test/

[root@intel-e31225-8-3 ~]# virt-sandbox-service create -p /home/bob/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/bob/test//apache13
Created unit file /etc/systemd/system/apache13_sandbox.service
Created sandbox config /etc/libvirt-sandbox/services/apache13.sandbox

[root@intel-e31225-8-3 ~]# virt-sandbox-service delete apache13

Notes, no error is raised now.

[root@intel-e31225-8-3 ~]# ll /home/bob/test/apache13/
total 4
drwxr-xr-x. 6 root root 103 Jul 25 18:29 etc
drwxr-xr-x. 2 root root   6 Jul 25 18:29 home
dr-xr-x---. 2 root root  40 Jul 25 18:29 root
drwxr-xr-x. 3 root root  16 Jul 25 18:29 usr
drwxr-xr-x. 8 root root  80 Jul 25 18:29 var
Comment 4 Daniel Berrange 2013-10-02 12:09:24 EDT
commit 7cead289c9162908673a4e8a4a7cc32d752c481a
Author: Daniel P. Berrange <berrange@redhat.com>
Date:   Wed Oct 2 17:06:15 2013 +0100

    Add '-p PATH' arg to virt-sandbox-service clone/delete commands
    
    The 'create' command for virt-sandbox-service accepts a '-p PATH'
    arg to override use of /var/lib/libvirt/filesystems. The 'delete'
    and 'clone' commands must also support this arg if they are to
    work.
    
    Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Comment 6 Wayne Sun 2013-10-08 02:14:35 EDT
pkgs:
libvirt-1.1.1-8.el7.x86_64
libvirt-sandbox-0.5.0-5.el7.x86_64
systemd-206-4.el7.x86_64
kernel-3.10.0-9.el7.x86_64

steps:
1. delete with -p

# 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/config/sandbox.cfg

# virt-sandbox-service delete apache13 -p /home/wayne/test/

# echo $?
0

# ll /home/wayne/test/
total 0

2. clone with -p
# 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/config/sandbox.cfg

# virt-sandbox-service clone apache13 apache13_clone -p /home/wayne/test/
Created sandbox container dir /home/wayne/test//apache13_clone
Created unit file /etc/systemd/system/apache13_clone_sandbox.service
Created sandbox config /etc/libvirt-sandbox/services/apache13_clone/config/sandbox.cfg

# systemctl start apache13_clone_sandbox

# systemctl status apache13_clone_sandbox
apache13_clone_sandbox.service - Secure Sandbox Container apache13_clone
   Loaded: loaded (/etc/systemd/system/apache13_clone_sandbox.service; disabled)
   Active: active (running) since Tue 2013-10-08 14:12:17 CST; 4s ago
 Main PID: 21102 (virt-sandbox-se)
   CGroup: /system.slice/apache13_clone_sandbox.service
           └─21102 /usr/libexec/virt-sandbox-service-util -c lxc:/// -s apache13_clone

Oct 08 14:12:17 ibm-x3850x5-04.qe.lab.eng.nay.redhat.com virt-sandbox-service-util[21102]: [  OK  ] Reached target System Initialization.
Oct 08 14:12:17 ibm-x3850x5-04.qe.lab.eng.nay.redhat.com virt-sandbox-service-util[21102]: [  OK  ] Listening on D-Bus System Message Bus Socket.
Oct 08 14:12:17 ibm-x3850x5-04.qe.lab.eng.nay.redhat.com virt-sandbox-service-util[21102]: [  OK  ] Reached target Sockets.
Oct 08 14:12:17 ibm-x3850x5-04.qe.lab.eng.nay.redhat.com virt-sandbox-service-util[21102]: [  OK  ] Reached target Timers.
Oct 08 14:12:17 ibm-x3850x5-04.qe.lab.eng.nay.redhat.com virt-sandbox-service-util[21102]: [  OK  ] Reached target Basic System.
Oct 08 14:12:17 ibm-x3850x5-04.qe.lab.eng.nay.redhat.com virt-sandbox-service-util[21102]: Starting The Apache HTTP Server...
Oct 08 14:12:17 ibm-x3850x5-04.qe.lab.eng.nay.redhat.com virt-sandbox-service-util[21102]: Starting Cleanup of Temporary Directories...
Oct 08 14:12:17 ibm-x3850x5-04.qe.lab.eng.nay.redhat.com virt-sandbox-service-util[21102]: [  OK  ] Started Cleanup of Temporary Directories.
Oct 08 14:12:17 ibm-x3850x5-04.qe.lab.eng.nay.redhat.com virt-sandbox-service-util[21102]: [  OK  ] Started The Apache HTTP Server.
Oct 08 14:12:17 ibm-x3850x5-04.qe.lab.eng.nay.redhat.com virt-sandbox-service-util[21102]: [  OK  ] Reached target Sandbox multi-user target.
Comment 8 Ludek Smid 2014-06-13 06:57:08 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.