|
122 | 122 | import com.cloud.serializer.GsonHelper; |
123 | 123 | import com.cloud.service.dao.ServiceOfferingDao; |
124 | 124 | import com.cloud.storage.DiskOfferingVO; |
| 125 | +import com.cloud.storage.GuestOSVO; |
125 | 126 | import com.cloud.storage.ScopeType; |
126 | 127 | import com.cloud.storage.Storage; |
127 | 128 | import com.cloud.storage.Volume; |
128 | 129 | import com.cloud.storage.VolumeApiService; |
129 | 130 | import com.cloud.storage.VolumeVO; |
130 | 131 | import com.cloud.storage.dao.DiskOfferingDao; |
| 132 | +import com.cloud.storage.dao.GuestOSDao; |
131 | 133 | import com.cloud.storage.dao.VMTemplateDao; |
132 | 134 | import com.cloud.storage.dao.VolumeDao; |
133 | 135 | import com.cloud.template.VirtualMachineTemplate; |
@@ -232,6 +234,8 @@ public class BackupManagerImpl extends ManagerBase implements BackupManager { |
232 | 234 | private ResourceLimitService resourceLimitMgr; |
233 | 235 | @Inject |
234 | 236 | private AlertManager alertManager; |
| 237 | + @Inject |
| 238 | + private GuestOSDao _guestOSDao; |
235 | 239 |
|
236 | 240 | private AsyncJobDispatcher asyncJobDispatcher; |
237 | 241 | private Timer backupTimer; |
@@ -380,7 +384,12 @@ public Map<String, String> getBackupDetailsFromVM(VirtualMachine vm) { |
380 | 384 | details.put(ApiConstants.SERVICE_OFFERING_ID, serviceOffering.getUuid()); |
381 | 385 | VirtualMachineTemplate template = vmTemplateDao.findById(vm.getTemplateId()); |
382 | 386 | if (template != null) { |
| 387 | + long guestOSId = template.getGuestOSId(); |
383 | 388 | details.put(ApiConstants.TEMPLATE_ID, template.getUuid()); |
| 389 | + GuestOSVO guestOS = _guestOSDao.findById(guestOSId); |
| 390 | + if (guestOS != null) { |
| 391 | + details.put(ApiConstants.OS_ID, guestOS.getUuid()); |
| 392 | + } |
384 | 393 | } |
385 | 394 |
|
386 | 395 | List<VMInstanceDetailVO> vmDetails = vmInstanceDetailsDao.listDetails(vm.getId()); |
@@ -2104,6 +2113,12 @@ Map<String, String> getDetailsFromBackupDetails(Long backupId) { |
2104 | 2113 | details.put(ApiConstants.IS_ISO, String.valueOf(template.getFormat().equals(Storage.ImageFormat.ISO))); |
2105 | 2114 | } |
2106 | 2115 | } |
| 2116 | + if (details.containsKey(ApiConstants.OS_ID)) { |
| 2117 | + GuestOSVO guestOS = _guestOSDao.findByUuid(details.get(ApiConstants.OS_ID)); |
| 2118 | + if (guestOS != null) { |
| 2119 | + details.put(ApiConstants.OS_NAME, guestOS.getDisplayName()); |
| 2120 | + } |
| 2121 | + } |
2107 | 2122 | if (details.containsKey(ApiConstants.SERVICE_OFFERING_ID)) { |
2108 | 2123 | ServiceOffering serviceOffering = serviceOfferingDao.findByUuid(details.get(ApiConstants.SERVICE_OFFERING_ID)); |
2109 | 2124 | if (serviceOffering != null) { |
|
0 commit comments