|
55 | 55 | import com.cloud.agent.api.Command;
|
56 | 56 | import com.cloud.agent.api.StartupCommand;
|
57 | 57 | import com.cloud.alert.AlertManager;
|
| 58 | +import com.cloud.api.query.dao.TemplateJoinDao; |
| 59 | +import com.cloud.api.query.vo.TemplateJoinVO; |
58 | 60 | import com.cloud.configuration.Resource;
|
59 | 61 | import com.cloud.event.EventTypes;
|
60 | 62 | import com.cloud.event.UsageEventUtils;
|
@@ -111,6 +113,8 @@ public class ImageStoreUploadMonitorImpl extends ManagerBase implements ImageSto
|
111 | 113 | private TemplateDataFactory templateFactory;
|
112 | 114 | @Inject
|
113 | 115 | private TemplateService templateService;
|
| 116 | + @Inject |
| 117 | + private TemplateJoinDao templateJoinDao; |
114 | 118 |
|
115 | 119 | private long _nodeId;
|
116 | 120 | private ScheduledExecutorService _executor = null;
|
@@ -322,7 +326,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
|
322 | 326 |
|
323 | 327 | // publish usage events
|
324 | 328 | UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VOLUME_UPLOAD, tmpVolume.getAccountId(),
|
325 |
| - tmpVolumeDataStore.getDataStoreId(), tmpVolume.getId(), tmpVolume.getName(), |
| 329 | + tmpVolume.getDataCenterId(), tmpVolume.getId(), tmpVolume.getName(), |
326 | 330 | null, null, tmpVolumeDataStore.getPhysicalSize(), tmpVolumeDataStore.getSize(),
|
327 | 331 | Volume.class.getName(), tmpVolume.getUuid());
|
328 | 332 |
|
@@ -425,7 +429,9 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
|
425 | 429 | if (tmpTemplate.getFormat() == Storage.ImageFormat.ISO) {
|
426 | 430 | etype = EventTypes.EVENT_ISO_CREATE;
|
427 | 431 | }
|
428 |
| - UsageEventUtils.publishUsageEvent(etype, tmpTemplate.getAccountId(), tmpTemplateDataStore.getDataStoreId(), tmpTemplate.getId(), tmpTemplate.getName(), null, null, |
| 432 | + TemplateJoinVO vo = templateJoinDao.findById(tmpTemplate.getId()); |
| 433 | + assert (vo != null) : "Couldn't find the template view for given template ID"; |
| 434 | + UsageEventUtils.publishUsageEvent(etype, tmpTemplate.getAccountId(), vo.getDataCenterId(), tmpTemplate.getId(), tmpTemplate.getName(), null, null, |
429 | 435 | tmpTemplateDataStore.getPhysicalSize(), tmpTemplateDataStore.getSize(), VirtualMachineTemplate.class.getName(), tmpTemplate.getUuid());
|
430 | 436 |
|
431 | 437 | if (s_logger.isDebugEnabled()) {
|
|
0 commit comments