Merge pull request #63322 from verult/pv-attach-repd

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

GCE PD plugin now prevents attaching a regional PD PV with pdName of …

…a regular PD



**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #63317 

/sig storage
/sig gcp
/assign @msau42 @saad-ali
This commit is contained in:
Kubernetes Submit Queue 2018-06-05 13:40:39 -07:00 committed by GitHub
commit 2bb6fdc675
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -535,14 +535,10 @@ func (gce *GCECloud) AttachDisk(diskName string, nodeName types.NodeName, readOn
if regional && utilfeature.DefaultFeatureGate.Enabled(features.GCERegionalPersistentDisk) {
disk, err = gce.getRegionalDiskByName(diskName)
if err != nil {
glog.V(5).Infof("Could not find regional PD named %q to Attach. Will look for a zonal PD", diskName)
err = nil
} else {
mc = newDiskMetricContextRegional("attach", gce.region)
return err
}
}
if disk == nil {
mc = newDiskMetricContextRegional("attach", gce.region)
} else {
disk, err = gce.getDiskByName(diskName, instance.Zone)
if err != nil {
return err