mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-4625:Snapshots and templates should be deleted from staging
storage after create template from snapshot on S3.
This commit is contained in:
parent
f05d6a5419
commit
80aa0d3608
|
|
@ -439,6 +439,11 @@ public class
|
|||
CopyCommand cmd = new CopyCommand(srcData.getTO(), destData.getTO(), _createprivatetemplatefromsnapshotwait, _mgmtServer.getExecuteInSequence());
|
||||
EndPoint ep = selector.select(srcData, destData);
|
||||
Answer answer = ep.sendMessage(cmd);
|
||||
|
||||
// clean up snapshot copied to staging
|
||||
if (srcData != null) {
|
||||
cacheMgr.deleteCacheObject(srcData);
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,15 @@ public class VmwareStorageSubsystemCommandHandler extends StorageSubsystemComman
|
|||
TemplateObjectTO template = (TemplateObjectTO)answer.getNewData();
|
||||
template.setDataStore(srcDataStore);
|
||||
CopyCommand newCmd = new CopyCommand(template, destData, cmd.getWait(), cmd.executeInSequence());
|
||||
return storageResource.defaultAction(newCmd);
|
||||
Answer result = storageResource.defaultAction(newCmd);
|
||||
//clean up template data on staging area
|
||||
try {
|
||||
DeleteCommand deleteCommand = new DeleteCommand(template);
|
||||
storageResource.defaultAction(deleteCommand);
|
||||
} catch (Exception e) {
|
||||
s_logger.debug("Failed to clean up staging area:", e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
needDelegation = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -526,6 +526,14 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
|||
SwiftUtil.putObject(swift, properties, containterName, _tmpltpp);
|
||||
}
|
||||
|
||||
//clean up template data on staging area
|
||||
try {
|
||||
DeleteCommand deleteCommand = new DeleteCommand(newTemplate);
|
||||
execute(deleteCommand);
|
||||
} catch (Exception e) {
|
||||
s_logger.debug("Failed to clean up staging area:", e);
|
||||
}
|
||||
|
||||
TemplateObjectTO template = new TemplateObjectTO();
|
||||
template.setPath(swiftPath);
|
||||
template.setSize(templateFile.length());
|
||||
|
|
@ -543,7 +551,15 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
|||
TemplateObjectTO newTemplate = (TemplateObjectTO)answer.getNewData();
|
||||
newTemplate.setDataStore(srcDataStore);
|
||||
CopyCommand newCpyCmd = new CopyCommand(newTemplate, destData, cmd.getWait(), cmd.executeInSequence());
|
||||
return copyFromNfsToS3(newCpyCmd);
|
||||
Answer result = copyFromNfsToS3(newCpyCmd);
|
||||
//clean up template data on staging area
|
||||
try {
|
||||
DeleteCommand deleteCommand = new DeleteCommand(newTemplate);
|
||||
execute(deleteCommand);
|
||||
} catch (Exception e) {
|
||||
s_logger.debug("Failed to clean up staging area:", e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
s_logger.debug("Failed to create templat from snapshot");
|
||||
|
|
|
|||
Loading…
Reference in New Issue