Bug 865265

Summary: Beaker allows "duplicate" logs with different but equivalent path components
Product: [Retired] Beaker Reporter: Dan Callaghan <dcallagh>
Component: schedulerAssignee: Dan Callaghan <dcallagh>
Status: CLOSED CURRENTRELEASE QA Contact: Qixiang Wan <qwan>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.9CC: asaha, dcallagh, mishin, qwan, rglasz, rmancy
Target Milestone: 0.10.0   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: LogStorage
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-11-22 06:43:53 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 Dan Callaghan 2012-10-11 05:41:07 UTC
It's possible to have two "different" logs which equate to the same filesystem path, such as:

+----------+----------------+------+-------------+---------------------+
| id       | recipe_task_id | path | filename    | start_time          |
+----------+----------------+------+-------------+---------------------+
| 61093855 |        7194525 | /    | TESTOUT.log | 2012-08-01 08:17:34 |
| 61095279 |        7194525 |      | TESTOUT.log | 2012-08-01 08:38:09 |

These are really both pointing at the same log file, and will appear in the web UI as two separate hyperlinks to the same URL. More seriously, it will confuse beaker-transfer which will end up trying to link the same file twice:

2012-10-11 00:05:49 [ERROR   ] {  322} bkr.labcontroller.proxy:346 unable to hardlink /var/www/beaker/logs/tasks/7676703//TESTOUT.log to
/var/www/beaker/logs/tmpMj2bFJ/2012/08/2855/285510/613630/7676703//TESTOUT.log, [Errno 17] File exists

We should probably apply some better normalisation to path and filename on the server side before saving the rows, to avoid such duplicates.

Comment 2 Dan Callaghan 2012-10-31 07:59:53 UTC
On Gerrit: http://gerrit.beaker-project.org/1454

Comment 3 Qixiang Wan 2012-11-14 02:33:54 UTC
Verified with build 0.9.4-2.git.104.1433411.

Reproduced by something like:

s = xmlrpclib.ServerProxy('%s:8000/RPC2' % os.environ['LAB_CONTROLLER'])
s.task_upload_file(task_id, '', 'RHBZ865265', len(task_log), task_log_md5, 0, task_log_enc)
s.task_upload_file(task_id, '/', 'RHBZ865265', len(task_log), task_log_md5, 0, task_log_enc)
s.result_upload_file(result_id, '', 'RHBZ865265RECIPE', len(recipe_log), recipe_log_md5, 0, recipe_log_enc)
s.result_upload_file(result_id, '/', 'RHBZ865265RECIPE', len(recipe_log), recipe_log_md5, 0, recipe_log_enc)

Before the fix, there are duplicate recipe/task logs with different but equivalent path. The patch fixes this issue by normalizing the "" path to "/", so there is no duplicate logs now.

Comment 4 Raymond Mancy 2012-11-22 06:43:53 UTC
This has now been released