VMware Cloud Director 10.5.x
VMware Cloud Director 10.6.x
To resolve the issue, any objects leveraging the storage policy needs to be identified and unlinked. Any stale vApps/vApp templates/media can be identified from the database and then verified in the UI with the steps below:
1. Note the name of the affected OVDC and the storage policy to-be-removed. The scripts listed in Step 3 and 4 will need these names and have to be replaced accordingly.
2. Connect to the VCD database via SSH or pgAdmin
sudo -u postgres psql vcloud3. To find the list of vApps or vApp templates referencing the storage policy available on the tenant
SELECTvapp_vm.name AS vapp_vm_name,vm_container.name as vapp_name,vm_container.sg_type as type,vm.moref as moref,vapp_vm_sclass_metrics.storage_used_mbFROM vapp_vm_sclass_metricsLEFT JOIN vapp_vm ON vapp_vm.id = vapp_vm_sclass_metrics.vapp_vm_idLEFT JOIN vm_container ON vm_container.sg_id = vapp_vm.vapp_idleft join vm on vm.id = vapp_vm.svm_idJOIN vdc_logical_resource ON vdc_logical_resource.id = vapp_vm_sclass_metrics.storage_class_lr_idJOIN org_prov_vdc ON org_prov_vdc.id = vdc_logical_resource.vdc_idWHERE org_prov_vdc.name = 'Organization VDC Name' AND vdc_logical_resource.name = 'Storage policy to-be-removed';
Note: type column with value 1 would mean it is a normal vApp and value 2 would mean it is a vApp template.
4. To find the list of media items that may still be present in the storage profile to be removed.
SELECTorg_prov_vdc.name AS org_vdc_name,logical_disk.id AS logical_disk_id,logical_disk.name AS logical_disk_name,logical_disk.logical_disk_type,logical_disk.creation_status AS logical_creation_status,COALESCE((logical_disk.size_bytes::numeric / 1048576.0), 0::numeric) AS storage_used_mbFROM logical_diskLEFT JOIN ldisk_storage_class_join ON logical_disk.id = ldisk_storage_class_join.logical_disk_idLEFT JOIN ldisk_fo_join ON logical_disk.id = ldisk_fo_join.logical_disk_idLEFT JOIN vm_disk ON vm_disk.disk_id = ldisk_fo_join.fo_idLEFT JOIN org_prov_vdc ON org_prov_vdc.id = logical_disk.org_vdc_idLEFT JOIN vdc_logical_resource ON vdc_logical_resource.id = ldisk_storage_class_join.storage_class_idwhere org_prov_vdc.name like '%Organization VDC Name%';
5. For the catalogs in the organizations, verify the Storage Policies settings as per the documentations below:
6. Migrate the VMs/vApps/media identified in Steps 3, 4 or change the storage policy on them.
Edit the Default Storage Policy of a vApp Template
Edit Virtual Machine Properties in the VMware Cloud Director Tenant Portal
If the UI method(s) does not work, contact VMware Cloud Director Support and note this Article ID (371259) in the problem description.For more information, see How to Submit a Support Request.
For environments involving VCDA,please check the article 390050 as well.