mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 03:33:56 +00:00
Merge pull request #116746 from AxeZhan/csi_translate
Return name instead whole volume when error occurred in csi-translation
This commit is contained in:
commit
1193ab62e2
@ -150,14 +150,14 @@ func (CSITranslator) GetInTreePluginNameFromSpec(pv *v1.PersistentVolume, vol *v
|
||||
return curPlugin.GetInTreePluginName(), nil
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf("could not find in-tree plugin name from persistent volume %v", pv)
|
||||
return "", fmt.Errorf("could not find in-tree plugin name from persistent volume %s", pv.Name)
|
||||
} else if vol != nil {
|
||||
for _, curPlugin := range inTreePlugins {
|
||||
if curPlugin.CanSupportInline(vol) {
|
||||
return curPlugin.GetInTreePluginName(), nil
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf("could not find in-tree plugin name from volume %v", vol)
|
||||
return "", fmt.Errorf("could not find in-tree plugin name from volume %s", vol.Name)
|
||||
} else {
|
||||
return "", errors.New("both persistent volume and volume are nil")
|
||||
}
|
||||
@ -171,7 +171,7 @@ func (CSITranslator) GetCSINameFromInTreeName(pluginName string) (string, error)
|
||||
return csiDriverName, nil
|
||||
}
|
||||
}
|
||||
return "", fmt.Errorf("could not find CSI Driver name for plugin %v", pluginName)
|
||||
return "", fmt.Errorf("could not find CSI Driver name for plugin %s", pluginName)
|
||||
}
|
||||
|
||||
// GetInTreeNameFromCSIName returns the name of the in-tree plugin superseded by
|
||||
@ -180,7 +180,7 @@ func (CSITranslator) GetInTreeNameFromCSIName(pluginName string) (string, error)
|
||||
if plugin, ok := inTreePlugins[pluginName]; ok {
|
||||
return plugin.GetInTreePluginName(), nil
|
||||
}
|
||||
return "", fmt.Errorf("could not find In-Tree driver name for CSI plugin %v", pluginName)
|
||||
return "", fmt.Errorf("could not find In-Tree driver name for CSI plugin %s", pluginName)
|
||||
}
|
||||
|
||||
// IsPVMigratable tests whether there is migration logic for the given Persistent Volume
|
||||
@ -208,5 +208,5 @@ func (CSITranslator) RepairVolumeHandle(driverName, volumeHandle, nodeID string)
|
||||
if plugin, ok := inTreePlugins[driverName]; ok {
|
||||
return plugin.RepairVolumeHandle(volumeHandle, nodeID)
|
||||
}
|
||||
return "", fmt.Errorf("could not find In-Tree driver name for CSI plugin %v", driverName)
|
||||
return "", fmt.Errorf("could not find In-Tree driver name for CSI plugin %s", driverName)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user