VMware Cloud Director VM details are inaccessible with java.lang.NullPointerException due to Named Disk Inconsistency
search cancel

VMware Cloud Director VM details are inaccessible with java.lang.NullPointerException due to Named Disk Inconsistency

book

Article ID: 450727

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

In VMware Cloud Director, this error is encountered when attempting to view or manage a specific Virtual Machine through the Tenant UI.

  • Searching for the VM in the VCD Tenant UI fails.

  • The UI displays a java.lang.NullPointerException error similar to: [ ########-####-####-####-############ ] class java.lang.NullPointerException.



  • Reference from the logs: /opt/vmware/vcloud-director/logs/vcloud-container-debug.log

    java.lang.NullPointerException
    at com.vmware.ssdc.backend.services.impl.DiskManagerImpl.getDiskByFabricObjectId(DiskManagerImpl.java:1936)
    at jdk.internal.reflect.GeneratedMethodAccessor2531.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:234)
    at com.sun.proxy.$Proxy529.getDiskByFabricObjectId(Unknown Source)
    at com.vmware.ssdc.backend.services.impl.VmManagerImpl.annotateNamedDisksInVm(VmManagerImpl.java:2535)
    at com.vmware.ssdc.backend.services.impl.VmManagerImpl.getStoredVmDisks(VmManagerImpl.java:1555)
    at com.vmware.ssdc.backend.services.impl.VmManagerImpl.populateVmSpecFromStoredVmConfig(VmManagerImpl.java:1512)
    at com.vmware.ssdc.backend.services.impl.VmManagerImpl.populateVmSpec(VmManagerImpl.java:1326)
    at com.vmware.ssdc.backend.services.impl.VmManagerImpl.loadVmSpec(VmManagerImpl.java:1032)
    at com.vmware.ssdc.backend.services.impl.VmManagerImpl.loadVmSpecs(VmManagerImpl.java:1100)

Environment

VMware Cloud Director 10.6.x

Cause

The issue is caused by a synchronization inconsistency between the VMware Cloud Director database and the underlying vCenter Server inventory. Specifically, a Named Disk have been detached/deleted from the VCD UI or database (via automated internal processes or external APIs), but the device entry remains attached to the VM configuration within vCenter.

When VCD attempts to load the VM specification, it cannot find the referenced disk in its own database, leading to a NullPointerException.

Resolution

Follow these steps to identify and remove the inconsistent disk device.

Prerequisites

  • Identify the affected VM and its parent vCenter Server.
  • Ensure you have administrative access to the vCenter Server and the VCD Database.
  • Recommendation: Take a snapshot of the vCenter Server and the VCD including the Database backup before making manual changes.

Procedure

  1. Power off the VM: Log in to the vCenter Server and power off the affected VM.

  2. Identify the problematic disk:

    • Right-click the VM and select Edit Settings.
    • Review the list of Hard Disks. Look for a disk that shows a capacity of 0 MB or has a name corresponding to a detached Named Disk.
    • Capture the exact name or ID of the disk device (e.g., pvc-########-####-####-####-############).
  3. Verify Disk Status in VCD:

    • In the VCD Provider/Tenant UI, navigate to Storage > Named Disks and verify if the disk is present.
    • Connect to the VCD Database and run the following query to check if the disk exists in the logical_disk table (replace the name with your disk ID):
      vcloud=# select id, name, logical_disk_type, creation_status from logical_disk where name ='<disk_id_from_step_2>';
    • If the query returns (0 rows), the disk does not exist in VCD.
  4. Remove the device from vCenter:

    • Go back to the VM Edit Settings in vCenter.
    • Locate the problematic disk identified in Step 2.
    • Click the X to remove the device.
    • Note: Ensure you only remove the device entry from the VM configuration; do not delete the underlying files if they are still required elsewhere.
  5. Synchronize and Verify:

    • Refresh the vCenter connection within the VCD UI.
    • Navigate back to the VCD Tenant UI. The VM should now be accessible.
    • Power on the VM from the VCD interface to confirm the synchronization is restored.

Additional Information

This inconsistency is frequently observed when automation scripts or third-party backup solutions delete Named Disks without properly updating the VM configuration at the hypervisor level.