Bug 744021 - RPM not deleted after pulp-admin repo delete
Summary: RPM not deleted after pulp-admin repo delete
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Pulp
Classification: Retired
Component: user-experience
Version: 1.0.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: Sprint 29
Assignee: Pradeep Kilambi
QA Contact: Preethi Thomas
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-10-06 18:47 UTC by Laurent Licour
Modified: 2013-09-09 16:37 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:


Attachments (Terms of Use)

Description Laurent Licour 2011-10-06 18:47:20 UTC
Description of problem:
After deleting a repo, RPM files were not deleted from disk (/var/lib/pulp/packages), even if it not referenced

Version-Release number of selected component (if applicable):
pulp-0.0.237-2.el6.noarch

  
After some investigation, it seems that it's a bug coming from how the pathname of RPM is generated. pathname contain the first 3 hexdigit of the checksum of the RPM
However, at creation time, the checksum is based on sha1
and sha256 at deletion time

example :
having a a rpm on disk (not the 'db6' in pathname, coming from sha1):
# sha1sum /var/lib/pulp/packages/kernel/2.6.18/274.3.1.el5/x86_64/db6/kernel-2.6.18-274.3.1.el5.x86_64.rpm
db650676cd3b253cdb8b43fd19b19b0e8f740a21  /var/lib/pulp/packages/kernel/2.6.18/274.3.1.el5/x86_64/db6/kernel-2.6.18-274.3.1.el5.x86_64.rpm
# sha256sum /var/lib/pulp/packages/kernel/2.6.18/274.3.1.el5/x86_64/db6/kernel-2.6.18-274.3.1.el5.x86_64.rpm
3a5cb82d6e404e332fb9d8f056cc2138398ad698d6542411e3447854dde90172  /var/lib/pulp/packages/kernel/2.6.18/274.3.1.el5/x86_64/db6/kernel-2.6.18-274.3.1.el5.x86_64.rpm

I add a log in api/package.py that display pkg_packages_path in method 'delete'

2011-10-06 19:21:54,255 2154:140297099007744: pulp.server.api.package:INFO: package:103 PreDelete package kernel-2.6.18-274.3.1.el5.x86_64.rpm at /var/lib/pulp//packages/kernel/2.6.
18/274.3.1.el5/x86_64/3a5/kernel-2.6.18-274.3.1.el5.x86_64.rpm

Note the 3a5 (coming from sha256 i supposed)

so the file can't be deleted.


Also : if the right checksum is sha256, it meens that actual packages are stored in wrong place and need to be moved and relinked.
It seems also that due to this bug, actual pulp servers could contain orphean RPM (stored on disk, but not exist in database). A specific procedure should be develop to remove old files

Comment 1 Pradeep Kilambi 2011-10-27 19:50:20 UTC
fixed!
commit f68f0efcd90a2e129d60d427edce0a69639e1b0d
Author: Pradeep Kilambi <pkilambi>
Date:   Thu Oct 27 15:49:14 2011 -0400

    Sync Enhancements for #744021, #749289
    * import the pkg and file information before metadata is regenerated
    * modify the checksum to use the pkg checksum from metadata
    * rewrote local sync metadata to import all the metadata under repodata
    * new method call update_metadata to regenerate metadata if preserve_metadata is set

$ sudo pulp-admin repo create --id=testdel --feed=http://localhost/pub/updates/
Successfully created repository [ testdel ]

$ sudo pulp-admin repo sync -F --id=testdel
Sync for repository testdel started
Sync: Finished
7/7 new items downloaded
0/7 existing items processed

Item Details: 
RPMs: 7/7

$ ls -l /var/lib/pulp/packages/warnerbros/0.1/1/noarch/1f8/warnerbros-0.1-1.noarch.rpm 
-rw-r--r-- 1 apache apache 4347 Oct 27 15:06 /var/lib/pulp/packages/warnerbros/0.1/1/noarch/1f8/warnerbros-0.1-1.noarch.rpm

$ sha1sum  /var/lib/pulp/packages/warnerbros/0.1/1/noarch/1f8/warnerbros-0.1-1.noarch.rpm
1f8ef173032bafe5ded5f5997fcbb613523cbf19  /var/lib/pulp/packages/warnerbros/0.1/1/noarch/1f8/warnerbros-0.1-1.noarch.rpm

$ sudo pulp-admin repo delete --id=testdel
Successful deleted repository [ testdel ]

$ ls -l /var/lib/pulp/packages/warnerbros/0.1/1/noarch/1f8/warnerbros-0.1-1.noarch.rpm 
ls: cannot access /var/lib/pulp/packages/warnerbros/0.1/1/noarch/1f8/warnerbros-0.1-1.noarch.rpm: No such file or directory

Comment 2 Jeff Ortel 2011-10-27 20:56:13 UTC
build: 0.243

Comment 3 Preethi Thomas 2011-11-09 20:04:23 UTC
verified


[root@preethi ~]# rpm -q pulp
pulp-0.0.244-5.fc15.noarch

[root@preethi ~]# pulp-admin -u admin -p admin repo create --id=pulp --feed=http://repos.fedorapeople.org/repos/pulp/pulp/fedora-14/x86_64/
Successfully created repository [ pulp ]

[root@preethi ~]# pulp-admin -u admin -p admin repo sync -F --id=pulp
Sync for repository pulp started
Sync: Finished
18/18 new items downloaded
0/18 existing items processed

Item Details: 
RPMs: 18/18

[root@preethi ~]# ls -l /var/lib/pulp/packages/
gofer/              mod_wsgi-debuginfo/ pulp-consumer/
gofer-package/      pulp/               python-gofer/
grinder/            pulp-admin/         python-isodate/
m2crypto/           pulp-cds/           python-qpid/
m2crypto-debuginfo/ pulp-client-lib/    python-rhsm/
mod_wsgi/           pulp-common/        python-webpy/
[root@preethi ~]# ls -l /var/lib/pulp/packages/
total 72
drwxr-sr-x. 3 apache apache 4096 Nov  9 14:54 gofer
drwxr-sr-x. 3 apache apache 4096 Nov  9 14:54 gofer-package
drwxr-sr-x. 3 apache apache 4096 Nov  9 14:54 grinder
drwxr-sr-x. 3 apache apache 4096 Nov  9 14:54 m2crypto
drwxr-sr-x. 3 apache apache 4096 Nov  9 14:54 m2crypto-debuginfo
drwxr-sr-x. 3 apache apache 4096 Nov  9 14:54 mod_wsgi
drwxr-sr-x. 3 apache apache 4096 Nov  9 14:54 mod_wsgi-debuginfo
drwxr-sr-x. 3 apache apache 4096 Nov  9 14:54 pulp
drwxr-sr-x. 3 apache apache 4096 Nov  9 14:54 pulp-admin
drwxr-sr-x. 3 apache apache 4096 Nov  9 14:54 pulp-cds
drwxr-sr-x. 3 apache apache 4096 Nov  9 14:54 pulp-client-lib
drwxr-sr-x. 3 apache apache 4096 Nov  9 14:54 pulp-common
drwxr-sr-x. 3 apache apache 4096 Nov  9 14:54 pulp-consumer
drwxr-sr-x. 3 apache apache 4096 Nov  9 14:54 python-gofer
drwxr-sr-x. 3 apache apache 4096 Nov  9 14:54 python-isodate
drwxr-sr-x. 3 apache apache 4096 Nov  9 14:54 python-qpid
drwxr-sr-x. 3 apache apache 4096 Nov  9 14:54 python-rhsm
drwxr-sr-x. 3 apache apache 4096 Nov  9 14:54 python-webpy

[root@preethi ~]# ls -l /var/lib/pulp/packages/gofer/0.54/1.fc14/noarch/01c/
total 64
-rw-r--r--. 1 apache apache 61832 Nov  9 14:54 gofer-0.54-1.fc14.noarch.rpm
[root@preethi ~]# pulp-admin -u admin -p admin repo delete --id=pulp
Successful deleted repository [ pulp ]

[root@preethi ~]# ls -l /var/lib/pulp/packages/gofer/0.54/1.fc14/noarch/01c/
ls: cannot access /var/lib/pulp/packages/gofer/0.54/1.fc14/noarch/01c/: No such file or directory
[root@preethi ~]# ls -l /var/lib/pulp/packages/
total 0
[root@preethi ~]#

Comment 4 Preethi Thomas 2012-02-24 20:18:24 UTC
Pulp v1.0 is released
Closed Current Release.

Comment 5 Preethi Thomas 2012-02-24 20:19:04 UTC
Pulp v1.0 is released.


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