CS-15293: Snapshot deletes the data it backed up

Reviewed-by: Edison
Description:

    Ensure Storage cleanup thread will not attempt to cleanup temporary
    snapshot data of a specific volume & specific account.
This commit is contained in:
Sateesh Chodapuneedi 2012-08-30 17:13:31 -04:00 committed by Vijayendra Bhamidipati
parent cf692e06c2
commit 0c95075677
1 changed files with 13 additions and 8 deletions

View File

@ -2115,11 +2115,14 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag
@Override
public void createCapacityEntry(StoragePoolVO storagePool, short capacityType, long allocated) {
SearchCriteria<CapacityVO> capacitySC = _capacityDao.createSearchCriteria();
List<CapacityVO> capacities = _capacityDao.search(capacitySC, null);
capacitySC = _capacityDao.createSearchCriteria();
capacitySC.addAnd("hostOrPoolId", SearchCriteria.Op.EQ, storagePool.getId());
capacitySC.addAnd("dataCenterId", SearchCriteria.Op.EQ, storagePool.getDataCenterId());
capacitySC.addAnd("capacityType", SearchCriteria.Op.EQ, capacityType);
List<CapacityVO> capacities = _capacityDao.search(capacitySC, null);
capacities = _capacityDao.search(capacitySC, null);
long totalOverProvCapacity;
if (storagePool.getPoolType() == StoragePoolType.NetworkFilesystem) {
@ -2371,13 +2374,15 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag
if (snapshots == null) {
continue;
}
CleanupSnapshotBackupCommand cmd = new CleanupSnapshotBackupCommand(secondaryStorageHost.getStorageUrl(), secondaryStorageHost.getDataCenterId(), volume.getAccountId(),
volumeId, snapshots);
Answer answer = _agentMgr.sendToSecStorage(secondaryStorageHost, cmd);
if ((answer == null) || !answer.getResult()) {
String details = "Failed to cleanup snapshots for volume " + volumeId + " due to " + (answer == null ? "null" : answer.getDetails());
s_logger.warn(details);
List<SnapshotVO> backingupSnapshots = _snapshotDao.listByStatus(volumeId, Snapshot.Status.BackingUp);
if(backingupSnapshots == null) {
CleanupSnapshotBackupCommand cmd = new CleanupSnapshotBackupCommand(secondaryStorageHost.getStorageUrl(), secondaryStorageHost.getDataCenterId(), volume.getAccountId(),
volumeId, snapshots);
Answer answer = _agentMgr.sendToSecStorage(secondaryStorageHost, cmd);
if ((answer == null) || !answer.getResult()) {
String details = "Failed to cleanup snapshots for volume " + volumeId + " due to " + (answer == null ? "null" : answer.getDetails());
s_logger.warn(details);
}
}
} catch (Exception e1) {
s_logger.warn("problem cleaning up snapshots in secondary storage " + secondaryStorageHost, e1);