fix NPE cases, throw exceptions early on

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2015-02-05 17:30:27 +05:30
parent 9658569f5a
commit 68b5440d44
3 changed files with 6 additions and 1 deletions

View File

@ -698,7 +698,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
@Override
public Object unmarshallResultObject(AsyncJob job) {
if(job.getResult() != null)
if(job != null && job.getResult() != null)
return JobSerializerHelper.fromObjectSerializedString(job.getResult());
return null;
}

View File

@ -4027,6 +4027,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
diskdef.defBlockBasedDisk(device, devId, DiskDef.diskBus.VIRTIO);
diskdef.setQemuDriver(false);
vm.getDevices().addDevice(diskdef);
} else {
throw new InternalErrorException("Error while mapping RBD device on host");
}
}
}

View File

@ -363,6 +363,9 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
storage.create(0);
}
LibvirtStoragePoolDef spd = getStoragePoolDef(conn, storage);
if (spd == null) {
throw new CloudRuntimeException("Unable to parse the storage pool definition for storage pool " + uuid);
}
StoragePoolType type = null;
if (spd.getPoolType() == LibvirtStoragePoolDef.poolType.NETFS) {
type = StoragePoolType.NetworkFilesystem;