Fix NPE reported on IRC, provide the user an informative error message

This commit is contained in:
Hugo Trippaers 2014-07-22 17:43:49 +02:00
parent 4523490d44
commit 1d2124dcbf

View File

@ -268,6 +268,9 @@ public class VmwareStorageProcessor implements StorageProcessor {
Pair<String, String> templateInfo = VmwareStorageLayoutHelper.decodeTemplateRelativePathAndNameFromUrl(secondaryStorageUrl, templateUrl, template.getName()); Pair<String, String> templateInfo = VmwareStorageLayoutHelper.decodeTemplateRelativePathAndNameFromUrl(secondaryStorageUrl, templateUrl, template.getName());
VmwareContext context = hostService.getServiceContext(cmd); VmwareContext context = hostService.getServiceContext(cmd);
if (context == null) {
return new CopyCmdAnswer("Failed to create a Vmware context, check the management server logs or the ssvm log for details");
}
try { try {
VmwareHypervisorHost hyperHost = hostService.getHyperHost(context, cmd); VmwareHypervisorHost hyperHost = hostService.getHyperHost(context, cmd);