volume upload: when create template fails, rolling back transaction

This commit is contained in:
Rajani Karuturi 2015-05-04 15:11:05 +05:30
parent ff4f31c4ea
commit e0721fe976
1 changed files with 3 additions and 0 deletions

View File

@ -284,6 +284,9 @@ public class HypervisorTemplateAdapter extends TemplateAdapterBase {
payload.setDescription(template.getDisplayText());
payloads.add(payload);
}
if(payloads.isEmpty()) {
throw new CloudRuntimeException("unable to find zone or an image store with enough capacity");
}
_resourceLimitMgr.incrementResourceCount(profile.getAccountId(), ResourceType.template);
return payloads;
}