apache/incubator-cloudstack — pull request #3 by Lianping (2013-05-01 15:58:32+00:00)
Title: Fixed bug CLOUDSTACK-2217

The snapshots backups are stored in a folder whose name follows the convention of snapshots/data_center_id/account_id/volume_id. However, when garbage collecting the snapshots backups, the Secondary Storage VM Agent tries to delete backups from the folder snapshots/account_id/volume_id. This is one cause of the bug.

There is another cause. The format of the validBackupUUID is in the format of /snapshots/1/2/2422/gitfraud01_DATA-2396_20130322114746 and the snapshot backup filename is gitfraud01_DATA-2396_20130322114746. However, the code for checking whether a backup file is in the list of validBackupUUID is

if (filename.startsWith(uuid)) {
found = true;
break;
}

It will always return false. Thus, all snapshots backups will be deleted.
The bug is fixed by correcting the folder where Secondary Storage VM Agent should look for snapshots backups to garbage collect and correcting the rule for checking whether a backup should be kept.