func (vsphereVolume *VsphereVolumeMap) RemoveUnverified() {
	vsphereVolume.lock.Lock()
	defer vsphereVolume.lock.Unlock()
	for k, v := range vsphereVolume.volumeNodeMap {
		if !v.verified {
			delete(vsphereVolume.volumeNodeMap, k)
			delete(vsphereVolume.nodeMap, v.nodeName)
		}
	}
}
RemoveUnverified will remove any device which we could not verify to be attached to a node.
package vsphere
import (
	"sync"
	"github.com/vmware/govmomi/object"
	"github.com/vmware/govmomi/vim25/types"
	k8stypes "k8s.io/apimachinery/pkg/types"
)
type volumePath string
type nodeVolumeStatus struct {
	nodeName k8stypes.NodeName
	verified bool
}
type VsphereVolumeMap struct {
	volumeNodeMap map[volumePath]nodeVolumeStatus
	nodeMap       map[k8stypes.NodeName]bool
	lock          sync.RWMutex
}
func NewVsphereVolumeMap() *VsphereVolumeMap {
	return &VsphereVolumeMap{
		volumeNodeMap: map[volumePath]nodeVolumeStatus{},
		nodeMap:       map[k8stypes.NodeName]bool{},
	}
}
func (vsphereVolume *VsphereVolumeMap) StartDiskVerification() {
	vsphereVolume.lock.Lock()
	defer vsphereVolume.lock.Unlock()
	for k, v := range vsphereVolume.volumeNodeMap {
		v.verified = false
		vsphereVolume.volumeNodeMap[k] = v
	}
	vsphereVolume.nodeMap = map[k8stypes.NodeName]bool{}
}
func (vsphereVolume *VsphereVolumeMap) CheckForVolume(path string) (k8stypes.NodeName, bool) {
	vsphereVolume.lock.RLock()
	defer vsphereVolume.lock.RUnlock()
	vPath := volumePath(path)
	ns, ok := vsphereVolume.volumeNodeMap[vPath]
	if ok {
		return ns.nodeName, true
	}
	return "", false
}
func (vsphereVolume *VsphereVolumeMap) CheckForNode(nodeName k8stypes.NodeName) bool {
	vsphereVolume.lock.RLock()
	defer vsphereVolume.lock.RUnlock()
	_, ok := vsphereVolume.nodeMap[nodeName]
	return ok
}
func (vsphereVolume *VsphereVolumeMap) Add(node k8stypes.NodeName, vmDevices object.VirtualDeviceList) {
	vsphereVolume.lock.Lock()
	defer vsphereVolume.lock.Unlock()
	for _, device := range vmDevices {
		if vmDevices.TypeName(device) == "VirtualDisk" {
			virtualDevice := device.GetVirtualDevice()
			if backing, ok := virtualDevice.Backing.(*types.VirtualDiskFlatVer2BackingInfo); ok {
				filename := volumePath(backing.FileName)
				vsphereVolume.volumeNodeMap[filename] = nodeVolumeStatus{node, true}
				vsphereVolume.nodeMap[node] = true
			}
		}
	}
}