Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

Commit

Permalink
Handle case correction for Windows plugin (#2022)
Browse files Browse the repository at this point in the history
  • Loading branch information
govint authored and shuklanirdesh82 committed Dec 11, 2017
1 parent 9cd12b5 commit ee64c1a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions client_plugin/utils/plugin_utils/plugin_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package plugin_utils
// This file holds utility/helper methods required in plugin module

import (
"runtime"
"strings"

log "github.com/Sirupsen/logrus"
Expand Down Expand Up @@ -68,9 +69,14 @@ func IsFullVolName(volName string) bool {
// Optionally returns datastore and volume metadata if retrieved from ESX.
// If Volume Metadata is nil then caller can use getVolume()
func GetVolumeInfo(name string, datastoreName string, d drivers.VolumeDriver) (*VolumeInfo, error) {
// if fullname already, return
// If fullname already, return for Linux, convert to short name for Windows
// so, the correct datastore name is used here.
if IsFullVolName(name) {
return &VolumeInfo{name, "", nil}, nil
if runtime.GOOS == "windows" {
name = strings.Split(name, "@")[0]
} else {
return &VolumeInfo{name, "", nil}, nil
}
}

// if datastore name is provided, append and return
Expand Down

0 comments on commit ee64c1a

Please sign in to comment.