Update API names and references

Signed-off-by: Deep Debroy <ddebroy@docker.com>
pull/564/head
Deep Debroy 2019-03-04 19:13:05 -08:00
parent 1da91ad39a
commit 1fb4290c4e
3 changed files with 13 additions and 11 deletions

View File

@ -440,7 +440,7 @@ func (og *operationGenerator) GenerateDetachVolumeFunc(
// TODO(dyzz): This case can't distinguish between PV and In-line which is necessary because
// if it was PV it may have been migrated, but the same plugin with in-line may not have been.
// Suggestions welcome...
if csilib.IsMigratableByName(pluginName) && utilfeature.DefaultFeatureGate.Enabled(features.CSIMigration) {
if csilib.IsMigratableIntreePluginByName(pluginName) && utilfeature.DefaultFeatureGate.Enabled(features.CSIMigration) {
// The volume represented by this spec is CSI and thus should be migrated
attachableVolumePlugin, err = og.volumePluginMgr.FindAttachablePluginByName(csi.CSIPluginName)
if err != nil || attachableVolumePlugin == nil {

View File

@ -75,9 +75,9 @@ func TranslateCSIPVToInTree(pv *v1.PersistentVolume) (*v1.PersistentVolume, erro
return nil, fmt.Errorf("could not find in-tree plugin translation logic for %s", copiedPV.Spec.CSI.Driver)
}
// IsMigratableByName tests whether there is Migration logic for the in-tree plugin
// whose name matches the given inTreePluginName
func IsMigratableByName(inTreePluginName string) bool {
// IsMigratableIntreePluginByName tests whether there is migration logic for the in-tree plugin
// whose name matches the given name
func IsMigratableIntreePluginByName(inTreePluginName string) bool {
for _, curPlugin := range inTreePlugins {
if curPlugin.GetInTreePluginName() == inTreePluginName {
return true
@ -86,16 +86,17 @@ func IsMigratableByName(inTreePluginName string) bool {
return false
}
// SupersedesInTreePlugin tests whether there exists an in-tree plugin with logic
// to migrate to the CSI plugin with given name
func SupersedesInTreePlugin(csiPluginName string) bool {
// IsMigratedCSIDriverByName tests whether there exists an in-tree plugin with logic
// to migrate to the CSI driver with given name
func IsMigratedCSIDriverByName(csiPluginName string) bool {
if _, ok := inTreePlugins[csiPluginName]; ok {
return true
}
return false
}
// GetCSINameFromInTreeName returns the name of a CSI driver that supersedes the in-tree plugin with the given name
// GetCSINameFromInTreeName returns the name of a CSI driver that supersedes the
// in-tree plugin with the given name
func GetCSINameFromInTreeName(pluginName string) (string, error) {
for csiDriverName, curPlugin := range inTreePlugins {
if curPlugin.GetInTreePluginName() == pluginName {
@ -105,7 +106,8 @@ func GetCSINameFromInTreeName(pluginName string) (string, error) {
return "", fmt.Errorf("Could not find CSI Driver name for plugin %v", pluginName)
}
// GetInTreeNameFromCSIName returns the name of the in-tree plugin superseded by a CSI driver with the given name
// GetInTreeNameFromCSIName returns the name of the in-tree plugin superseded by
// a CSI driver with the given name
func GetInTreeNameFromCSIName(pluginName string) (string, error) {
if plugin, ok := inTreePlugins[pluginName]; ok {
return plugin.GetInTreePluginName(), nil

View File

@ -99,14 +99,14 @@ func TestPluginNameMappings(t *testing.T) {
if err != nil {
t.Errorf("Error when mapping In-tree plugin name to CSI plugin name %s", err)
}
if !SupersedesInTreePlugin(csiPluginName) {
if !IsMigratedCSIDriverByName(csiPluginName) {
t.Errorf("%s expected to supersede an In-tree plugin", csiPluginName)
}
inTreePluginName, err := GetInTreeNameFromCSIName(csiPluginName)
if err != nil {
t.Errorf("Error when mapping CSI plugin name to In-tree plugin name %s", err)
}
if !IsMigratableByName(inTreePluginName) {
if !IsMigratableIntreePluginByName(inTreePluginName) {
t.Errorf("%s expected to be migratable to a CSI name", inTreePluginName)
}
if inTreePluginName != test.inTreePluginName || csiPluginName != test.csiPluginName {