mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
bug 10727: fixed duplicated usage event generation when create volume from snapshot
status 10727: resolved fixed Conflicts: server/src/com/cloud/storage/StorageManagerImpl.java
This commit is contained in:
parent
721ac489b2
commit
3b3a99ce43
@ -577,7 +577,6 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
||||
return new Pair<VolumeVO, String>(createdVolume, details);
|
||||
}
|
||||
|
||||
@DB
|
||||
protected VolumeVO createVolumeFromSnapshot(VolumeVO volume, long snapshotId) {
|
||||
|
||||
// By default, assume failure.
|
||||
@ -589,22 +588,6 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
|
||||
Pair<VolumeVO, String> volumeDetails = createVolumeFromSnapshot(volume, snapshot);
|
||||
createdVolume = volumeDetails.first();
|
||||
|
||||
Long diskOfferingId = volume.getDiskOfferingId();
|
||||
|
||||
if (createdVolume.getPath() != null) {
|
||||
Long offeringId = null;
|
||||
if (diskOfferingId != null) {
|
||||
DiskOfferingVO offering = _diskOfferingDao.findById(diskOfferingId);
|
||||
if (offering != null && (offering.getType() == DiskOfferingVO.Type.Disk)) {
|
||||
offeringId = offering.getId();
|
||||
}
|
||||
}
|
||||
|
||||
UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_VOLUME_CREATE, volume.getAccountId(), volume.getDataCenterId(), volume.getId(), volume.getName(), offeringId, null,
|
||||
createdVolume.getSize());
|
||||
_usageEventDao.persist(usageEvent);
|
||||
}
|
||||
txn.commit();
|
||||
return createdVolume;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user