bug 6195,6255,5891: Only ROOT volumes will have templateId. offeringId will be diskOfferingId for DATA volumes and serviceOfferingId for ROOT volume

status 6195,6255,5891: resolved fixed
This commit is contained in:
kishan 2010-09-21 15:45:02 +05:30
parent 0669c2c1d4
commit 85964511b2
1 changed files with 7 additions and 3 deletions

View File

@ -929,11 +929,15 @@ public class StorageManagerImpl implements StorageManager {
s_logger.warn("Error updating the attached value for volume "+v.getId()+":"+e);
}
long templateId = -1;
if(v.getVolumeType() == VolumeType.ROOT && Storage.ImageFormat.ISO != template.getFormat()){
templateId = template.getId();
}
long volumeId = v.getId();
// Create an event
long sizeMB = v.getSize() / (1024 * 1024);
String diskOfferingIdentifier = (diskOffering != null) ? String.valueOf(diskOffering.getId()) : "-1";
String eventParams = "id=" + volumeId + "\ndoId=" + diskOfferingIdentifier + "\ntId=" + template.getId() + "\ndcId=" + dc.getId() + "\nsize=" + sizeMB;
long sizeMB = v.getSize() / (1024 * 1024);
String eventParams = "id=" + volumeId + "\ndoId=" + v.getDiskOfferingId() + "\ntId=" + templateId + "\ndcId=" + dc.getId() + "\nsize=" + sizeMB;
EventVO event = new EventVO();
event.setAccountId(account.getId());
event.setUserId(1L);