Eldan Shachar has uploaded a new change for review.

Change subject: core: detailed error message on OVF import error
......................................................................

core: detailed error message on OVF import error

The patch fixes the error message given when importing
a corrupted OVF file, added the actual exception message
to the audit log.

Change-Id: I8fdfd50fe4e956a95d05a70dac7391c39245c9f8
Bug-Url: https://bugzilla.redhat.com/1036635
Signed-off-by: Eldan Shachar <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/GetTemplatesFromExportDomainQuery.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/GetVmsFromExportDomainQuery.java
M 
backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
3 files changed, 8 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/02/35102/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/GetTemplatesFromExportDomainQuery.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/GetTemplatesFromExportDomainQuery.java
index 0cc1344..6e7251f 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/GetTemplatesFromExportDomainQuery.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/GetTemplatesFromExportDomainQuery.java
@@ -40,16 +40,17 @@
                     templateDisksMap.put(vmTemplate, templateDisks);
                 }
             } catch (OvfReaderException ex) {
-                auditLogOvfLoadError(ex.getName());
+                auditLogOvfLoadError(ex.getName(), ex.getMessage());
             }
         }
 
         return templateDisksMap;
     }
 
-    private void auditLogOvfLoadError(String machineName) {
+    private void auditLogOvfLoadError(String machineName, String errorMessage) 
{
         AuditLogableBase logable = new AuditLogableBase();
         logable.addCustomValue("Template", machineName);
+        logable.addCustomValue("ErrorMessage", errorMessage);
         AuditLogDirector.log(logable, 
AuditLogType.IMPORTEXPORT_FAILED_TO_IMPORT_TEMPLATE);
 
     }
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/GetVmsFromExportDomainQuery.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/GetVmsFromExportDomainQuery.java
index 1e59290..b44ac97 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/GetVmsFromExportDomainQuery.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/GetVmsFromExportDomainQuery.java
@@ -34,16 +34,17 @@
                     vms.add(ovfHelper.readVmFromOvf(ovf));
                 }
             } catch (OvfReaderException ex) {
-                auditLogOvfLoadError(ex.getName());
+                auditLogOvfLoadError(ex.getName(), ex.getMessage());
             }
         }
 
         return vms;
     }
 
-    private void auditLogOvfLoadError(String machineName) {
+    private void auditLogOvfLoadError(String machineName, String errorMessage) 
{
         AuditLogableBase logable = new AuditLogableBase();
         logable.addCustomValue("ImportedVmName", machineName);
+        logable.addCustomValue("ErrorMessage", errorMessage);
         AuditLogDirector.log(logable, 
AuditLogType.IMPORTEXPORT_FAILED_TO_IMPORT_VM);
     }
 }
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
index 10795eb..733ad1f 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -653,8 +653,8 @@
 CREATE_OVF_STORE_FOR_STORAGE_DOMAIN_INITIATE_FAILED=Failed to create OVF store 
disk for Storage Domain ${StorageDomainName}. \n OVF data won't be updated 
meanwhile for that domain.
 UPDATE_DESCRIPTION_FOR_OVF_STORE_FAILED=Failed to update OVF disk ${DiskId} 
description to reflect its state, OVF data isn't updated on that OVF store 
(Data Center ${DataCenterName}, Storage Domain ${StorageDomainName}).
 DELETE_OVF_STORE_FOR_STORAGE_DOMAIN_FAILED=Failed to delete the OVF store disk 
for Storage Domain ${StorageDomainName}.\n In order to detach the domain please 
remove it manually or try to detach the domain again for another attempt.
-IMPORTEXPORT_FAILED_TO_IMPORT_VM=Failed to read VM '${ImportedVmName}' OVF, it 
may be corrupted
-IMPORTEXPORT_FAILED_TO_IMPORT_TEMPLATE=Failed to read Template '${Template}' 
OVF, it may be corrupted
+IMPORTEXPORT_FAILED_TO_IMPORT_VM=Failed to read VM '${ImportedVmName}' OVF, it 
may be corrupted. Underlying error message: ${ErrorMessage}
+IMPORTEXPORT_FAILED_TO_IMPORT_TEMPLATE=Failed to read Template '${Template}' 
OVF, it may be corrupted. Underlying error message: ${ErrorMessage}
 CANNOT_HIBERNATE_RUNNING_VMS_AFTER_CLUSTER_CPU_UPGRADE=Hibernation of VMs 
after CPU upgrade of Cluster ${VdsGroup} is not supported. Please stop and 
restart those VMs in case you wish to hibernate them
 STORAGE_ALERT_VG_METADATA_CRITICALLY_FULL=The system has reached the 80% 
watermark on the VG metadata area size on ${StorageDomainName}.\nThis is due to 
a high number of Vdisks or large Vdisks size allocated on this specific VG.
 STORAGE_ALERT_SMALL_VG_METADATA=The allocated VG metadata area size is smaller 
than 50MB on ${StorageDomainName},\nwhich might limit its capacity (the number 
of Vdisks and/or their size).


-- 
To view, visit http://gerrit.ovirt.org/35102
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8fdfd50fe4e956a95d05a70dac7391c39245c9f8
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Eldan Shachar <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to