Merge pull request #1274 from anshul1886/CLOUDSTACK-9196

CLOUDSTACK-9196: Fixing null pointer exception when vm meta data is synced on upgraded setuphttps://issues.apache.org/jira/browse/CLOUDSTACK-9196

NullPointerException can occur if XenServer reports non-existing VM in cloud DB.

* pr/1274:
  CLOUDSTACK-9196: Fixing null pointer exception when vm meta data is synced on upgraded setup.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2016-01-27 16:27:21 +01:00
commit b98a989e3d

View File

@ -2642,7 +2642,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
if(!found) {
VMInstanceVO vm = _vmDao.findVMByInstanceName(name);
if(vm.getType() == VirtualMachine.Type.User) {
if(vm != null && vm.getType() == VirtualMachine.Type.User) {
updateVmMetaData(vm.getId(), platform);
}
}