mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-4625:Snapshots and templates should be deleted from staging
storage after create template from snapshot on S3.
This commit is contained in:
parent
a05ec6df33
commit
b11a8e12e8
@ -440,6 +440,11 @@ public class
|
|||||||
CopyCommand cmd = new CopyCommand(srcData.getTO(), destData.getTO(), _createprivatetemplatefromsnapshotwait, _mgmtServer.getExecuteInSequence());
|
CopyCommand cmd = new CopyCommand(srcData.getTO(), destData.getTO(), _createprivatetemplatefromsnapshotwait, _mgmtServer.getExecuteInSequence());
|
||||||
EndPoint ep = selector.select(srcData, destData);
|
EndPoint ep = selector.select(srcData, destData);
|
||||||
Answer answer = ep.sendMessage(cmd);
|
Answer answer = ep.sendMessage(cmd);
|
||||||
|
|
||||||
|
// clean up snapshot copied to staging
|
||||||
|
if (srcData != null) {
|
||||||
|
cacheMgr.deleteCacheObject(srcData);
|
||||||
|
}
|
||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -102,7 +102,15 @@ public class VmwareStorageSubsystemCommandHandler extends StorageSubsystemComman
|
|||||||
TemplateObjectTO template = (TemplateObjectTO)answer.getNewData();
|
TemplateObjectTO template = (TemplateObjectTO)answer.getNewData();
|
||||||
template.setDataStore(srcDataStore);
|
template.setDataStore(srcDataStore);
|
||||||
CopyCommand newCmd = new CopyCommand(template, destData, cmd.getWait(), cmd.executeInSequence());
|
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;
|
needDelegation = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -526,6 +526,14 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
|||||||
SwiftUtil.putObject(swift, properties, containterName, _tmpltpp);
|
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();
|
TemplateObjectTO template = new TemplateObjectTO();
|
||||||
template.setPath(swiftPath);
|
template.setPath(swiftPath);
|
||||||
template.setSize(templateFile.length());
|
template.setSize(templateFile.length());
|
||||||
@ -543,7 +551,15 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
|||||||
TemplateObjectTO newTemplate = (TemplateObjectTO)answer.getNewData();
|
TemplateObjectTO newTemplate = (TemplateObjectTO)answer.getNewData();
|
||||||
newTemplate.setDataStore(srcDataStore);
|
newTemplate.setDataStore(srcDataStore);
|
||||||
CopyCommand newCpyCmd = new CopyCommand(newTemplate, destData, cmd.getWait(), cmd.executeInSequence());
|
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");
|
s_logger.debug("Failed to create templat from snapshot");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user