code: func (dc *Datacenter) CheckDisksAttached(ctx context.Context, nodeVolumes map[string][]string) (map[string]map[string]bool, error) {
  	attached := make(map[string]map[string]bool)
  	var vmList []*VirtualMachine
  	for nodeName, volPaths := range nodeVolumes {
  		for _, volPath := range volPaths {
  			setNodeVolumeMap(attached, volPath, nodeName, false)
  		}
  		vm, err := dc.GetVMByPath(ctx, nodeName)
  		if err != nil {
  			if IsNotFound(err) {
  				klog.Warningf("Node %q does not exist, vSphere CP will assume disks %v are not attached to it.", nodeName, volPaths)
  			}
  			continue
  		}
  		vmList = append(vmList, vm)
  	}
  	if len(vmList) == 0 {
  		klog.V(2).Infof("vSphere CP will assume no disks are attached to any node.")
  		return attached, nil
  	}
  	vmMoList, err := dc.GetVMMoList(ctx, vmList, []string{"config.hardware.device", "name"})
  	if err != nil {
  		// When there is an error fetching instance information
  		// it is safer to return nil and let volume information not be touched.
  		klog.Errorf("Failed to get VM Managed object for nodes: %+v. err: +%v", vmList, err)
  		return nil, err
  	}
  
  	for _, vmMo := range vmMoList {
  		if vmMo.Config == nil {
  			klog.Errorf("Config is not available for VM: %q", vmMo.Name)
  			continue
  		}
  		for nodeName, volPaths := range nodeVolumes {
  			if nodeName == vmMo.Name {
  				verifyVolumePathsForVM(vmMo, volPaths, attached)
  			}
  		}
  	}
  	return attached, nil
  }
docs: // CheckDisksAttached checks if the disk is attached to node.
  // This is done by comparing the volume path with the backing.FilePath on the VM Virtual disk devices.