mirror of https://github.com/apache/cloudstack.git
fix NPE cases, throw exceptions early on
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
9658569f5a
commit
68b5440d44
|
|
@ -698,7 +698,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object unmarshallResultObject(AsyncJob job) {
|
public Object unmarshallResultObject(AsyncJob job) {
|
||||||
if(job.getResult() != null)
|
if(job != null && job.getResult() != null)
|
||||||
return JobSerializerHelper.fromObjectSerializedString(job.getResult());
|
return JobSerializerHelper.fromObjectSerializedString(job.getResult());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4027,6 +4027,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
||||||
diskdef.defBlockBasedDisk(device, devId, DiskDef.diskBus.VIRTIO);
|
diskdef.defBlockBasedDisk(device, devId, DiskDef.diskBus.VIRTIO);
|
||||||
diskdef.setQemuDriver(false);
|
diskdef.setQemuDriver(false);
|
||||||
vm.getDevices().addDevice(diskdef);
|
vm.getDevices().addDevice(diskdef);
|
||||||
|
} else {
|
||||||
|
throw new InternalErrorException("Error while mapping RBD device on host");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -363,6 +363,9 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
|
||||||
storage.create(0);
|
storage.create(0);
|
||||||
}
|
}
|
||||||
LibvirtStoragePoolDef spd = getStoragePoolDef(conn, storage);
|
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;
|
StoragePoolType type = null;
|
||||||
if (spd.getPoolType() == LibvirtStoragePoolDef.poolType.NETFS) {
|
if (spd.getPoolType() == LibvirtStoragePoolDef.poolType.NETFS) {
|
||||||
type = StoragePoolType.NetworkFilesystem;
|
type = StoragePoolType.NetworkFilesystem;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue