VMware Cloud Director VM Provisioning Error
search cancel

VMware Cloud Director VM Provisioning Error

book

Article ID: 325618

calendar_today

Updated On: 04-24-2025

Products

VMware Cloud Director

Issue/Introduction

  • The purpose of this KB is to restore VCD functionality when an end user is suddenly unable to provision any VMs


Symptoms:

  • Unable to provision VMs
  • Receiving an error similar to the following when trying to provision VMs:
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0 at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248) at java.base/java.util.Objects.checkIndex(Objects.java:372) at java.base/java.util.ArrayList.get(ArrayList.java:459) at com.vmware.ssdc.backend.dao.impl.VAppVirtualMachineDaoImpl.getStorageContainerValRefForVappVm(VAppVirtualMachineDaoImpl.java:150) at jdk.internal.reflect.GeneratedMethodAccessor13762.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.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215) at com.sun.proxy.$Proxy314.getStorageContainerValRefForVappVm(Unknown Source) at com.vmware.ssdc.backend.services.impl.VmManagerImpl.updateVmStorageClassAndVdcComputePolicy(VmManagerImpl.java:3112) at jdk.internal.reflect.GeneratedMethodAccessor13760.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:208) at com.sun.proxy.$Proxy325.updateVmStorageClassAndVdcComputePolicy(Unknown Source) at com.vmware.ssdc.backend.services.impl.VAppManagerImpl.updateVAppVm(VAppManagerImpl.java:4424) at jdk.internal.reflect.GeneratedMethodAccessor13759.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:208) at com.sun.proxy.$Proxy324.updateVAppVm(Unknown Source) at com.vmware.vcloud.vapp.impl.VAppServiceImpl.executeTask(VAppServiceImpl.java:712) at com.vmware.vcloud.backendbase.management.system.TaskActivity$ExecutePhase$1.doInSecurityContext(TaskActivity.java:828) at com.vmware.vcloud.backendbase.management.system.TaskActivity$ExecutePhase$1.doInSecurityContext(TaskActivity.java:823) at com.vmware.vcloud.backendbase.management.system.SecurityContextTemplate.executeForOrgAndUser(SecurityContextTemplate.java:46) at com.vmware.vcloud.backendbase.management.system.TaskActivity$ExecutePhase.execute(TaskActivity.java:830) at com.vmware.vcloud.backendbase.management.system.TaskActivity$ExecutePhase.invokeInner(TaskActivity.java:726) at com.vmware.vcloud.backendbase.management.system.TaskActivity$TaskActivityBasePhase.invoke(TaskActivity.java:342) at com.vmware.vcloud.activity.executors.ActivityRunner.runPhase(ActivityRunner.java:175) at com.vmware.vcloud.activity.executors.ActivityRunner.run(ActivityRunner.java:112) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)



Environment

VMware Cloud Director 10.x
VMware Cloud Director for Service Provider 10.x

Cause

This issue occurs when the VMs being provisioned have null datastore moref values in the VCD database

Resolution

This issue is resolved by performing the following steps:

1. Take the snapshot for all VCD cell

2. Take the DB backup before proceeding with the below steps

3. SSH to the Primary Cell using Putty or other SSH Client

4. Login to the Postgres database: sudo -u postgres psql vcloud

5. Execute the query below:

***NOTE: This only impacts VMs with NULL dstore_moref values and has no impact on functional VMs***

select 'update vm set dstore_moref = ' || '''' || datastore_inv.moref || '''' || ' where id = ' || '''' || vm.id || '''' || ';' from vm

inner join vapp_vm on vapp_vm.svm_id = vm.id

inner join vm_inv on vm_inv.moref = vm.moref

inner join datastore_inv on datastore_inv.vc_display_name = (substring(vm.location_path,2,(POSITION(']' in vm.location_path))-2))

where vm.dstore_moref is NULL and vm_inv.is_deleted is false;


6. The above query will generate a series of "update" statements that can be executed to update all VMs with a null dstore_moref. An example output is shown below:

update vm set dstore_moref = 'datastore-123' where id = '########-####-####-####-#############';
update vm set dstore_moref = 'datastore-456' where id = '########-####-####-####-#############';


7. Execute the "update" statements generated in step #3
8. Verify that all VMs can now be provisioned


Workaround:

  • There is no other workaround for this issue



Additional Information

Impact/Risks:
  • This issue prevents the provisioning of VMs that have null datastore moref values