mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
Fix issue #390
This commit is contained in:
parent
a5d2a025b7
commit
ecdb47a40b
@ -18,13 +18,14 @@ package vsphere
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"golang.org/x/net/context"
|
||||
"k8s.io/api/core/v1"
|
||||
k8stypes "k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/kubernetes/pkg/cloudprovider/providers/vsphere/vclib"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Stores info about the kubernetes node
|
||||
@ -241,6 +242,10 @@ func (nm *NodeManager) removeNode(node *v1.Node) {
|
||||
nm.registeredNodesLock.Lock()
|
||||
delete(nm.registeredNodes, node.ObjectMeta.Name)
|
||||
nm.registeredNodesLock.Unlock()
|
||||
|
||||
nm.nodeInfoLock.Lock()
|
||||
delete(nm.nodeInfoMap, node.ObjectMeta.Name)
|
||||
nm.nodeInfoLock.Unlock()
|
||||
}
|
||||
|
||||
// GetNodeInfo returns a NodeInfo which datacenter, vm and vc server ip address.
|
||||
|
@ -32,12 +32,13 @@ import (
|
||||
|
||||
"fmt"
|
||||
|
||||
"path/filepath"
|
||||
|
||||
"github.com/vmware/govmomi/vim25/mo"
|
||||
"k8s.io/api/core/v1"
|
||||
k8stypes "k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/kubernetes/pkg/cloudprovider/providers/vsphere/vclib"
|
||||
"k8s.io/kubernetes/pkg/cloudprovider/providers/vsphere/vclib/diskmanagers"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -194,13 +195,18 @@ func getSharedDatastoresInK8SCluster(ctx context.Context, dc *vclib.Datacenter,
|
||||
return nil, fmt.Errorf(msg)
|
||||
}
|
||||
var sharedDatastores []*vclib.DatastoreInfo
|
||||
for index, nodeVmDetail := range nodeVmDetails {
|
||||
for _, nodeVmDetail := range nodeVmDetails {
|
||||
glog.V(9).Infof("Getting accessible datastores for node %s", nodeVmDetail.NodeName)
|
||||
accessibleDatastores, err := getAccessibleDatastores(ctx, &nodeVmDetail, nodeManager)
|
||||
if err != nil {
|
||||
if err == vclib.ErrNoVMFound {
|
||||
glog.V(9).Infof("Got NoVMFound error for node %s", nodeVmDetail.NodeName)
|
||||
continue
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
if index == 0 {
|
||||
|
||||
if len(sharedDatastores) == 0 {
|
||||
sharedDatastores = accessibleDatastores
|
||||
} else {
|
||||
sharedDatastores = intersect(sharedDatastores, accessibleDatastores)
|
||||
|
Loading…
Reference in New Issue
Block a user