Issue: CSI volumeattachment is getting below error while attaching PV to k8s node.
Status:
Attach Error:
Message: rpc error: code = Internal desc = failed to attach disk: "1e10bd8c-4713-4731-95df-*******" with node: "420c5615-7b83-a52f-90b8-*******" err failed to attach cns volume: "1e10bd8c-4713-4731-95df-********" to node vm: "VirtualMachine:vm-**** [VirtualCenterHost: *********, UUID: ********-7b83-a52f-90b8-********, Datacenter: Datacenter [Datacenter: Datacenter:datacenter-****, VirtualCenterHost: *************]]". fault: "(*types.LocalizedMethodFault)(0xc000987360)({\n DynamicData: (types.DynamicData) {\n },\n Fault: (types.CnsFault) {\n BaseMethodFault: (types.BaseMethodFault) <nil>,\n Reason: (string) (len=88) \"The input volume 1e10bd8c-4713-4731-95df-******** is not registered as a CNS volume.\"\n },\n LocalizedMessage: (string) (len=35) \"fault.CnsNotRegisteredFault.summary\"\n})\n". opId: "dde210ec"
Time: YYYY:MM:DD
Attached: false
Detach Error:
Message: rpc error: code = Internal desc = volumeID "1e10bd8c-4713-4731-95df-********" not found in QueryVolume
Also, PV should not be listed on vCenter UI under "Container Volumes" . Refer below screenshot
It can be caused if storage migration takes place, due to sDRS being enabled on a datastore cluster. This is not supported with CSI driver.
vSphere Functionality Supported by vSphere Container Storage Plug-in
Can also be caused due to general discrepancies between datastore and database.
Rebuild FCD catalog and reconcile datastore.
/etc/init.d/hostd stop
NOTE: If the hosts are running vSAN, first run "esxcfg-advcfg -s 1 /VSAN/IgnoreClusterMemberListupdates" on ALL hosts in the vSAN cluster. This will prevent vCenter from removing any hosts from the cluster when they stop communicating (due to stopping hostd). Once the procedure in this KB is completed, re-enable vCenter member updates by running "esxcfg-advcfg -s 0 /VSAN/IgnoreClusterMemberListupdates".cd /vmfs/volumes/<datastore>/
mv catalog catalog_backup
/etc/init.d/hostd start
NOTE: If running vSAN, files cannot be moved ("mv"), as it is object based storage. Contents will need to be moved, rather than the catalog directory itself as outlined below.
cd catalog
mv * /tmp/catalog
If running vSAN, the reconcile task is to be run on the vCenter MOB rather than the ESXI host.
https://<vcsa- fqdn>/mob/?moid=VStorageObjectManager&method=reconcileDatastoreInventory
ds:///vmfs/volumes/<datastore-UUID>/
(Found on the summary page of the datastore in the VC vSphere client)https://<ESXI_host_fqdn/IP>/mob/?moid=ha-vstorage-object-manager&method=reconcileDatastoreInventory
ls /vmfs/volumes/<datastore-path>/catalog
ls /vmfs/volumes/<datastore-path>/catalog/vclock
ls /vmfs/volumes/<datastore-path>/catalog/tidy/v1
/etc/init.d/hostd start
/opt/vmware/vpostgres/current/bin/psql -d VCDB -U postgres
psql> select max(v_clock) from VPX_STORAGE_OBJECT_INFO;
psql> select volume_id, volume_name, datastore from cns.volume_info;
https://<VCIP>/vslm/mob//?moid=StorageLifecycleManager&method=VslmSyncDatastore
select key,value from VPX_STORAGE_OBJECT_MD where id='<Persistent_Volume_handle_ID>';