protected Void installTemplateCallback(
AsyncCallbackDispatcher<TemplateInstallStrategyImpl, CreateCmdResult> callback,
InstallContext<CreateBaseImageResult> context) {
CreateCmdResult result = callback.getResult();
TemplateInfo templateOnPrimaryStoreObj = context.destTemplate;
CreateBaseImageResult upResult = new CreateBaseImageResult(
templateOnPrimaryStoreObj);
if (result.isFailed()) {
upResult.setResult(result.getResult());
context.getParentCallback().complete(upResult);
return null;
}
ObjectInDataStoreVO obj = objectInDataStoreMgr.findObject(
templateOnPrimaryStoreObj.getId(), templateOnPrimaryStoreObj
.getType(), templateOnPrimaryStoreObj.getDataStore()
.getId(), templateOnPrimaryStoreObj.getDataStore()
.getRole());
obj.setInstallPath(result.getPath());
obj.setSize(result.getSize());
try {
objectInDataStoreMgr.update(obj,
ObjectInDataStoreStateMachine.Event.OperationSuccessed);
} catch (NoTransitionException e) {
try {
objectInDataStoreMgr.update(obj,
ObjectInDataStoreStateMachine.Event.OperationFailed);
} catch (NoTransitionException e1) {
s_logger.debug("failed to change state", e1);
}
upResult.setResult(e.toString());
context.getParentCallback().complete(upResult);
return null;
}
moveTemplate(context.srcTemplate, templateOnPrimaryStoreObj, obj,