volume.setTemplateId(parentVolume.getTemplateId());
volume.setFormat(parentVolume.getFormat());
}  else {
volume.setTemplateId(null);
}
<BUG>volume = _volsDao.persist(volume);
CallContext.current().setEventDetails("Volume Id: " + volume.getId());</BUG>
_resourceLimitMgr.incrementResourceCount(volume.getAccountId(),
ResourceType.volume);
_resourceLimitMgr.incrementResourceCount(volume.getAccountId(), ResourceType.primary_storage,

volume.setTemplateId(parentVolume.getTemplateId());
volume.setFormat(parentVolume.getFormat());
}  else {
volume.setTemplateId(null);
}
volume = _volsDao.persist(volume);
if (cmd.getSnapshotId() == null) {
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VOLUME_CREATE, volume.getAccountId(), volume.getDataCenterId(), volume.getId(), volume.getName(), diskOfferingId,
null, size, Volume.class.getName(), volume.getUuid());
}
CallContext.current().setEventDetails("Volume Id: " + volume.getId());
_resourceLimitMgr.incrementResourceCount(volume.getAccountId(),
ResourceType.volume);
_resourceLimitMgr.incrementResourceCount(volume.getAccountId(), ResourceType.primary_storage,
