Skip to content

Commit 98e529a

Browse files
committed
CLOUDSTACK-5883 Improve error handling to get the real error
1 parent 823abe6 commit 98e529a

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
import com.vmware.vim25.VmwareDistributedVirtualSwitchVlanIdSpec;
6969
import com.vmware.vim25.VmwareDistributedVirtualSwitchVlanSpec;
7070

71+
import com.cloud.exception.CloudException;
7172
import com.cloud.hypervisor.vmware.util.VmwareContext;
7273
import com.cloud.hypervisor.vmware.util.VmwareHelper;
7374
import com.cloud.network.Networks.BroadcastDomainType;
@@ -1296,6 +1297,19 @@ public static void importVmFromOVF(VmwareHypervisorHost host, String ovfFilePath
12961297
throw new Exception(msg);
12971298
}
12981299

1300+
if(!ovfImportResult.getError().isEmpty()) {
1301+
for (LocalizedMethodFault fault : ovfImportResult.getError()) {
1302+
s_logger.error("createImportSpec error: " + fault.getLocalizedMessage());
1303+
}
1304+
throw new CloudException("Failed to create an import spec from " + ovfFilePath + ". Check log for details.");
1305+
}
1306+
1307+
if (!ovfImportResult.getWarning().isEmpty()) {
1308+
for (LocalizedMethodFault fault : ovfImportResult.getError()) {
1309+
s_logger.warn("createImportSpec warning: " + fault.getLocalizedMessage());
1310+
}
1311+
}
1312+
12991313
DatacenterMO dcMo = new DatacenterMO(context, host.getHyperHostDatacenter());
13001314
ManagedObjectReference morLease = context.getService().importVApp(morRp, ovfImportResult.getImportSpec(), dcMo.getVmFolder(), morHost);
13011315
if (morLease == null) {

0 commit comments

Comments
 (0)