}
@Override
public Void installAsync(TemplateInfo template, PrimaryDataStore store,
AsyncCompletionCallback<CreateBaseImageResult> callback) {
ObjectInDataStoreVO obj = objectInDataStoreMgr.findObject(
template.getId(), template.getType(), store.getId(),
store.getRole());
TemplateInfo templateOnPrimaryStoreObj = null;
boolean freshNewTemplate = false;
if (obj == null) {
try {
/*templateOnPrimaryStoreObj = objectInDataStoreMgr.create(
template, store);*/
freshNewTemplate = true;
} catch (Throwable e) {
obj = objectInDataStoreMgr.findObject(template.getId(),
template.getType(), store.getId(), store.getRole());
if (obj == null) {
CreateBaseImageResult result = new CreateBaseImageResult(
null);
result.setSucess(false);
result.setResult(e.toString());
callback.complete(result);
return null;
}
}
}
if (!freshNewTemplate
&& obj.getState() != ObjectInDataStoreStateMachine.State.Ready) {
try {
templateOnPrimaryStoreObj = waitingForTemplateDownload(
template, store);
} catch (Exception e) {
CreateBaseImageResult result = new CreateBaseImageResult(null);