mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 12:32:03 +00:00
Merge pull request #117488 from mborsz/point
Avoid volume copy in checkAttachableInlineVolume
This commit is contained in:
commit
6662b2921a
@ -172,7 +172,7 @@ func (pl *CSILimits) filterAttachableVolumes(
|
|||||||
// - If the volume is migratable and CSI migration is enabled, need to count it
|
// - If the volume is migratable and CSI migration is enabled, need to count it
|
||||||
// as well.
|
// as well.
|
||||||
// - If the volume is not migratable, it will be count in non_csi filter.
|
// - If the volume is not migratable, it will be count in non_csi filter.
|
||||||
if err := pl.checkAttachableInlineVolume(vol, csiNode, pod, result); err != nil {
|
if err := pl.checkAttachableInlineVolume(&vol, csiNode, pod, result); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,15 +220,15 @@ func (pl *CSILimits) filterAttachableVolumes(
|
|||||||
|
|
||||||
// checkAttachableInlineVolume takes an inline volume and add to the result map if the
|
// checkAttachableInlineVolume takes an inline volume and add to the result map if the
|
||||||
// volume is migratable and CSI migration for this plugin has been enabled.
|
// volume is migratable and CSI migration for this plugin has been enabled.
|
||||||
func (pl *CSILimits) checkAttachableInlineVolume(vol v1.Volume, csiNode *storagev1.CSINode,
|
func (pl *CSILimits) checkAttachableInlineVolume(vol *v1.Volume, csiNode *storagev1.CSINode,
|
||||||
pod *v1.Pod, result map[string]string) error {
|
pod *v1.Pod, result map[string]string) error {
|
||||||
if !pl.translator.IsInlineMigratable(&vol) {
|
if !pl.translator.IsInlineMigratable(vol) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// Check if the intree provisioner CSI migration has been enabled.
|
// Check if the intree provisioner CSI migration has been enabled.
|
||||||
inTreeProvisionerName, err := pl.translator.GetInTreePluginNameFromSpec(nil, &vol)
|
inTreeProvisionerName, err := pl.translator.GetInTreePluginNameFromSpec(nil, vol)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("looking up provisioner name for volume %v: %w", vol, err)
|
return fmt.Errorf("looking up provisioner name for volume %s: %w", vol.Name, err)
|
||||||
}
|
}
|
||||||
if !isCSIMigrationOn(csiNode, inTreeProvisionerName) {
|
if !isCSIMigrationOn(csiNode, inTreeProvisionerName) {
|
||||||
csiNodeName := ""
|
csiNodeName := ""
|
||||||
@ -240,9 +240,9 @@ func (pl *CSILimits) checkAttachableInlineVolume(vol v1.Volume, csiNode *storage
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// Do translation for the in-tree volume.
|
// Do translation for the in-tree volume.
|
||||||
translatedPV, err := pl.translator.TranslateInTreeInlineVolumeToCSI(&vol, pod.Namespace)
|
translatedPV, err := pl.translator.TranslateInTreeInlineVolumeToCSI(vol, pod.Namespace)
|
||||||
if err != nil || translatedPV == nil {
|
if err != nil || translatedPV == nil {
|
||||||
return fmt.Errorf("converting volume(%v) from inline to csi: %w", vol, err)
|
return fmt.Errorf("converting volume(%s) from inline to csi: %w", vol.Name, err)
|
||||||
}
|
}
|
||||||
driverName, err := pl.translator.GetCSINameFromInTreeName(inTreeProvisionerName)
|
driverName, err := pl.translator.GetCSINameFromInTreeName(inTreeProvisionerName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user