@@ -389,6 +389,7 @@ public Map<String, String> getBackupDetailsFromVM(VirtualMachine vm) {
389389 GuestOSVO guestOS = _guestOSDao .findById (guestOSId );
390390 if (guestOS != null ) {
391391 details .put (ApiConstants .OS_TYPE_ID , guestOS .getUuid ());
392+ details .put (ApiConstants .OS_NAME , guestOS .getDisplayName ());
392393 }
393394 }
394395
@@ -2108,21 +2109,13 @@ Map<String, String> getDetailsFromBackupDetails(Long backupId) {
21082109 if (details .containsKey (ApiConstants .TEMPLATE_ID )) {
21092110 VirtualMachineTemplate template = vmTemplateDao .findByUuid (details .get (ApiConstants .TEMPLATE_ID ));
21102111 if (template != null ) {
2111- details .put (ApiConstants .TEMPLATE_ID , template .getUuid ());
21122112 details .put (ApiConstants .TEMPLATE_NAME , template .getName ());
21132113 details .put (ApiConstants .IS_ISO , String .valueOf (template .getFormat ().equals (Storage .ImageFormat .ISO )));
21142114 }
21152115 }
2116- if (details .containsKey (ApiConstants .OS_TYPE_ID )) {
2117- GuestOSVO guestOS = _guestOSDao .findByUuid (details .get (ApiConstants .OS_TYPE_ID ));
2118- if (guestOS != null ) {
2119- details .put (ApiConstants .OS_NAME , guestOS .getDisplayName ());
2120- }
2121- }
21222116 if (details .containsKey (ApiConstants .SERVICE_OFFERING_ID )) {
21232117 ServiceOffering serviceOffering = serviceOfferingDao .findByUuid (details .get (ApiConstants .SERVICE_OFFERING_ID ));
21242118 if (serviceOffering != null ) {
2125- details .put (ApiConstants .SERVICE_OFFERING_ID , serviceOffering .getUuid ());
21262119 details .put (ApiConstants .SERVICE_OFFERING_NAME , serviceOffering .getName ());
21272120 }
21282121 }
@@ -2201,7 +2194,9 @@ public BackupResponse createBackupResponse(Backup backup, Boolean listVmDetails)
22012194
22022195 if (Boolean .TRUE .equals (listVmDetails )) {
22032196 Map <String , String > vmDetails = new HashMap <>();
2204- vmDetails .put (ApiConstants .HYPERVISOR , vm .getHypervisorType ().toString ());
2197+ if (vm != null ) {
2198+ vmDetails .put (ApiConstants .HYPERVISOR , vm .getHypervisorType ().toString ());
2199+ }
22052200 Map <String , String > details = getDetailsFromBackupDetails (backup .getId ());
22062201 vmDetails .putAll (details );
22072202 response .setVmDetails (vmDetails );
0 commit comments