stateTransitTo(toBeCreated, Volume.Event.OperationRetry);
} catch (NoTransitionException e) {
throw new CloudRuntimeException("Unable to retry a create operation on volume " + toBeCreated);
}
CreateCommand cmd = null;
VMTemplateStoragePoolVO tmpltStoredOn = null;
for (int i = 0; i < 2; i++) {
if (template != null && template.getFormat() != Storage.ImageFormat.ISO) {
tmpltStoredOn = _tmpltMgr.prepareTemplateForCreate(template, pool);
if (tmpltStoredOn == null) {
s_logger.debug("Cannot use this pool " + pool + " because we can't propagate template " + template);
return null;
}
cmd = new CreateCommand(diskProfile, tmpltStoredOn.getLocalDownloadPath(), new StorageFilerTO(pool));
} else {
if (template != null && Storage.ImageFormat.ISO == template.getFormat()) {
VMTemplateHostVO tmpltHostOn = _tmpltMgr.prepareISOForCreate(template, pool);
if (tmpltHostOn == null) {
throw new CloudRuntimeException("Did not find ISO in secondry storage in zone " + pool.getDataCenterId());
}
}
cmd = new CreateCommand(diskProfile, new StorageFilerTO(pool));
}
long[] hostIdsToTryFirst = { dest.getHost().getId() };
Answer answer = sendToPool(pool, hostIdsToTryFirst, cmd);
if (answer.getResult()) {
CreateAnswer createAnswer = (CreateAnswer) answer;