CNS is returning the error "not registered as a CNS volume" for volumes that were not synchronised properly between the CNS DB and the CNS cache on creation.
vCenter 7.x
vCenter 8.0
The
1. Volume is created and added to CNS DB.
2. Periodic Sync syncs the volume and does not find the volume in the datastore. So it removes the volume from CNS in-memory cache but does not remove it from CNS DB. It is likely there was a vSAN partition which caused the volume to be NotFound from certain hosts the datastore is mounted on.
3. CNS periodically retries syncing the volume. During the retry, the volume is found in the datastore (the vSAN partition would have recovered). Retry sync adds the volume (just the volume id and datastore url) to the CNS cache but fails to insert the volume into CNS DB as it is already present in the DB. Since the DB insert failed, it does not update the cache with the rest of the volume's information such as vclock or is_cns_volume flag. So, the cache has incorrect vclock value of -1 and is_cns_volume flag set to false.
4. UpdateVStorageObjectMetadata or any CNS workflow looks up the volume from the cache and finds that the volume is present with is_cns_volume flag to false. This means the volume is not registered with CNS and hence the error.
The resolution will be released in vSphere 8.0u3 P05.
Prior to this, the workaround is to restart the "vsan-health" service on the vCenter.