Updated Branches:
  refs/heads/master 823abe6a2 -> 794d47c5f
CLOUDSTACK-5883 Improve error handling to get the real error


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/98e529af
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/98e529af
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/98e529af

Branch: refs/heads/master
Commit: 98e529af41fa0a1f8ced6c674848e2130fbb0eb6
Parents: 823abe6
Author: Hugo Trippaers <htrippa...@schubergphilis.com>
Authored: Thu Jan 16 12:31:14 2014 +0100
Committer: Hugo Trippaers <htrippa...@schubergphilis.com>
Committed: Thu Jan 16 14:43:33 2014 +0100

----------------------------------------------------------------------
 .../hypervisor/vmware/mo/HypervisorHostHelper.java    | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98e529af/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
----------------------------------------------------------------------
diff --git 
a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java 
b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
index 9f5d4f9..2ddc144 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
@@ -68,6 +68,7 @@ import 
com.vmware.vim25.VmwareDistributedVirtualSwitchPvlanSpec;
 import com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec;
 import com.vmware.vim25.VmwareDistributedVirtualSwitchVlanSpec;
 
+import com.cloud.exception.CloudException;
 import com.cloud.hypervisor.vmware.util.VmwareContext;
 import com.cloud.hypervisor.vmware.util.VmwareHelper;
 import com.cloud.network.Networks.BroadcastDomainType;
@@ -1296,6 +1297,19 @@ public class HypervisorHostHelper {
             throw new Exception(msg);
         }
 
+        if(!ovfImportResult.getError().isEmpty()) {
+            for (LocalizedMethodFault fault : ovfImportResult.getError()) {
+                s_logger.error("createImportSpec error: " + 
fault.getLocalizedMessage());
+            }
+            throw new CloudException("Failed to create an import spec from " + 
ovfFilePath + ". Check log for details.");
+        }
+
+        if (!ovfImportResult.getWarning().isEmpty()) {
+            for (LocalizedMethodFault fault : ovfImportResult.getError()) {
+                s_logger.warn("createImportSpec warning: " + 
fault.getLocalizedMessage());
+            }
+        }
+
         DatacenterMO dcMo = new DatacenterMO(context, 
host.getHyperHostDatacenter());
         ManagedObjectReference morLease = 
context.getService().importVApp(morRp, ovfImportResult.getImportSpec(), 
dcMo.getVmFolder(), morHost);
         if (morLease == null) {

Reply via email to