func (shared *sharedDatastore) isIncluded(dataStoreHosts []hostInfo, nodeHosts map[string]hostInfo) bool {
	result := true
	for _, host := range nodeHosts {
		hostFound := false
		for _, targetHost := range dataStoreHosts {
			if host.hostUUID == targetHost.hostUUID && host.hostMOID == targetHost.hostMOID {
				hostFound = true
			}
		}
		if !hostFound {
			result = false
		}
	}
	return result
}
check if all of the nodeHosts are included in the dataStoreHosts
package vsphere
import (
	"context"
	"fmt"
	"github.com/vmware/govmomi/property"
	"github.com/vmware/govmomi/vim25/mo"
	"github.com/vmware/govmomi/vim25/types"
	"k8s.io/klog/v2"
	"k8s.io/legacy-cloud-providers/vsphere/vclib"
)
type sharedDatastore struct {
	nodeManager         *NodeManager
	candidateDatastores []*vclib.DatastoreInfo
}
type hostInfo struct {
	hostUUID   string
	hostMOID   string
	datacenter string
}
const (
	summary       = "summary"
	runtimeHost   = "summary.runtime.host"
	hostsProperty = "host"
	nameProperty  = "name"
)
func (shared *sharedDatastore) getSharedDatastore(ctcx context.Context) (*vclib.DatastoreInfo, error) {
	nodes := shared.nodeManager.getNodes()
	dcNodes := make(map[string][]NodeInfo)
	nodeHosts := make(map[string]hostInfo)
	for nodeName, node := range nodes {
		nodeInfo, err := shared.nodeManager.GetNodeInfoWithNodeObject(node)
		if err != nil {
			return nil, fmt.Errorf("unable to find node %s: %v", nodeName, err)
		}
		vcDC := nodeInfo.vcServer + nodeInfo.dataCenter.String()
		dcNodes[vcDC] = append(dcNodes[vcDC], nodeInfo)
	}
	for vcDC, nodes := range dcNodes {
		var hostInfos []hostInfo
		var err error
		hostInfos, err = shared.getNodeHosts(ctcx, nodes, vcDC)
		if err != nil {
			if vclib.IsManagedObjectNotFoundError(err) {
				klog.Warningf("SharedHost.getSharedDatastore: batch fetching of hosts failed - switching to fetching them individually.")
				hostInfos, err = shared.getEachNodeHost(ctcx, nodes, vcDC)
				if err != nil {
					klog.Errorf("SharedHost.getSharedDatastore: error fetching node hosts individually: %v", err)
					return nil, err
				}
			} else {
				return nil, err
			}
		}
		for _, host := range hostInfos {
			hostDCName := fmt.Sprintf("%s/%s", host.datacenter, host.hostMOID)
			nodeHosts[hostDCName] = host
		}
	}
	if len(nodeHosts) < 1 {
		msg := fmt.Sprintf("SharedHost.getSharedDatastore unable to find hosts associated with nodes")
		klog.Error(msg)
		return nil, fmt.Errorf("")
	}
	for _, datastoreInfo := range shared.candidateDatastores {
		dataStoreHosts, err := shared.getAttachedHosts(ctcx, datastoreInfo.Datastore)
		if err != nil {
			msg := fmt.Sprintf("error finding attached hosts to datastore %s: %v", datastoreInfo.Name(), err)
			klog.Error(msg)
			return nil, fmt.Errorf(msg)
		}
		if shared.isIncluded(dataStoreHosts, nodeHosts) {
			return datastoreInfo, nil
		}
	}
	return nil, fmt.Errorf("SharedHost.getSharedDatastore: unable to find any shared datastores")
}