mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-5883 Improve error handling to get the real error
This commit is contained in:
parent
ab0a068d9f
commit
e49a60c544
|
|
@ -44,6 +44,7 @@ import com.vmware.vim25.HostVirtualSwitch;
|
|||
import com.vmware.vim25.HttpNfcLeaseDeviceUrl;
|
||||
import com.vmware.vim25.HttpNfcLeaseInfo;
|
||||
import com.vmware.vim25.HttpNfcLeaseState;
|
||||
import com.vmware.vim25.LocalizedMethodFault;
|
||||
import com.vmware.vim25.LongPolicy;
|
||||
import com.vmware.vim25.ManagedObjectReference;
|
||||
import com.vmware.vim25.ObjectContent;
|
||||
|
|
@ -66,6 +67,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;
|
||||
|
|
@ -1332,6 +1334,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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue