From 6dcd56549af43cb2bc7537e920e44bdf595d9835 Mon Sep 17 00:00:00 2001 From: Pengfei Ni Date: Tue, 6 Feb 2018 17:05:39 +0800 Subject: [PATCH] Use full instanceID as lun lock key This is because the last part of VMSS instances are numbers, which may be same if there are multiple VMSS within same cluster. --- pkg/volume/azure_dd/attacher.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/pkg/volume/azure_dd/attacher.go b/pkg/volume/azure_dd/attacher.go index f4f9e5d4e97..6cfdc6b9e1f 100644 --- a/pkg/volume/azure_dd/attacher.go +++ b/pkg/volume/azure_dd/attacher.go @@ -24,7 +24,6 @@ import ( "path/filepath" "runtime" "strconv" - "strings" "time" "github.com/Azure/azure-sdk-for-go/arm/compute" @@ -70,9 +69,6 @@ func (a *azureDiskAttacher) Attach(spec *volume.Spec, nodeName types.NodeName) ( glog.Warningf("failed to get azure instance id (%v)", err) return "", fmt.Errorf("failed to get azure instance id for node %q (%v)", nodeName, err) } - if ind := strings.LastIndex(instanceid, "/"); ind >= 0 { - instanceid = instanceid[(ind + 1):] - } diskController, err := getDiskController(a.plugin.host) if err != nil { @@ -272,14 +268,11 @@ func (d *azureDiskDetacher) Detach(diskURI string, nodeName types.NodeName) erro return fmt.Errorf("invalid disk to detach: %q", diskURI) } - instanceid, err := d.cloud.InstanceID(context.TODO(), nodeName) + _, err := d.cloud.InstanceID(context.TODO(), nodeName) if err != nil { glog.Warningf("no instance id for node %q, skip detaching (%v)", nodeName, err) return nil } - if ind := strings.LastIndex(instanceid, "/"); ind >= 0 { - instanceid = instanceid[(ind + 1):] - } glog.V(4).Infof("detach %v from node %q", diskURI, nodeName)