bug 6165: there is a possiblility of the root volume being null when we search for it, which may be causing a npe in this bug. enhancing the logic around this

status 6165: resolved fixed
This commit is contained in:
abhishek 2010-09-21 15:17:21 -07:00
parent 2727dc53eb
commit d07cac932a

View File

@ -290,10 +290,13 @@ public class ListVMsCmd extends BaseCmd {
//root device related
VolumeVO rootVolume = getManagementServer().findRootVolume(vmInstance.getId());
vmData.add(new Pair<String, Object>(BaseCmd.Properties.ROOT_DEVICE_ID.getName(), rootVolume.getDeviceId()));
if(rootVolume!=null)
{
vmData.add(new Pair<String, Object>(BaseCmd.Properties.ROOT_DEVICE_ID.getName(), rootVolume.getDeviceId()));
StoragePoolVO storagePool = getManagementServer().findPoolById(rootVolume.getPoolId());
vmData.add(new Pair<String, Object>(BaseCmd.Properties.ROOT_DEVICE_TYPE.getName(), storagePool.getPoolType().toString()));
StoragePoolVO storagePool = getManagementServer().findPoolById(rootVolume.getPoolId());
vmData.add(new Pair<String, Object>(BaseCmd.Properties.ROOT_DEVICE_TYPE.getName(), storagePool.getPoolType().toString()));
}
vmTag[i++] = vmData;
}