diff --git a/pkg/cloudprovider/providers/vsphere/vsphere.go b/pkg/cloudprovider/providers/vsphere/vsphere.go index 5707dd3d06c..42400682cb7 100644 --- a/pkg/cloudprovider/providers/vsphere/vsphere.go +++ b/pkg/cloudprovider/providers/vsphere/vsphere.go @@ -375,14 +375,6 @@ func newControllerNode(cfg VSphereConfig) (*VSphere, error) { if cfg.Global.VCenterPort == "" { cfg.Global.VCenterPort = "443" } - if cfg.Global.VMUUID == "" { - // This needs root privileges on the host, and will fail otherwise. - cfg.Global.VMUUID, err = getvmUUID() - if err != nil { - glog.Errorf("Failed to get VM UUID. err: %+v", err) - return nil, err - } - } vsphereInstanceMap, err := populateVsphereInstanceMap(&cfg) if err != nil { return nil, err diff --git a/pkg/cloudprovider/providers/vsphere/vsphere_util.go b/pkg/cloudprovider/providers/vsphere/vsphere_util.go index 0f4edb155ae..45a35c71d41 100644 --- a/pkg/cloudprovider/providers/vsphere/vsphere_util.go +++ b/pkg/cloudprovider/providers/vsphere/vsphere_util.go @@ -19,7 +19,6 @@ package vsphere import ( "context" "errors" - "io/ioutil" "os" "regexp" "runtime" @@ -128,30 +127,6 @@ func GetgovmomiClient(conn *vclib.VSphereConnection) (*govmomi.Client, error) { return client, err } -// getvmUUID gets the BIOS UUID via the sys interface. This UUID is known by vsphere -func getvmUUID() (string, error) { - id, err := ioutil.ReadFile(UUIDPath) - if err != nil { - return "", fmt.Errorf("error retrieving vm uuid: %s", err) - } - uuidFromFile := string(id[:]) - //strip leading and trailing white space and new line char - uuid := strings.TrimSpace(uuidFromFile) - // check the uuid starts with "VMware-" - if !strings.HasPrefix(uuid, UUIDPrefix) { - return "", fmt.Errorf("Failed to match Prefix, UUID read from the file is %v", uuidFromFile) - } - // Strip the prefix and while spaces and - - uuid = strings.Replace(uuid[len(UUIDPrefix):(len(uuid))], " ", "", -1) - uuid = strings.Replace(uuid, "-", "", -1) - if len(uuid) != 32 { - return "", fmt.Errorf("Length check failed, UUID read from the file is %v", uuidFromFile) - } - // need to add dashes, e.g. "564d395e-d807-e18a-cb25-b79f65eb2b9f" - uuid = fmt.Sprintf("%s-%s-%s-%s-%s", uuid[0:8], uuid[8:12], uuid[12:16], uuid[16:20], uuid[20:32]) - return uuid, nil -} - // Returns the accessible datastores for the given node VM. func getAccessibleDatastores(ctx context.Context, nodeVmDetail *NodeDetails, nodeManager *NodeManager) ([]*vclib.DatastoreInfo, error) { accessibleDatastores, err := nodeVmDetail.vm.GetAllAccessibleDatastores(ctx)