mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-23 02:26:52 +00:00
Merge pull request #117079 from qingwave/sort-volumes
kubelet/volumemanager: sort unmounted volumes in error message
This commit is contained in:
commit
89bfdf0276
@ -504,6 +504,7 @@ func (vm *volumeManager) getUnattachedVolumes(uniquePodName types.UniquePodName)
|
|||||||
unattachedVolumes = append(unattachedVolumes, volumeToMount.OuterVolumeSpecName)
|
unattachedVolumes = append(unattachedVolumes, volumeToMount.OuterVolumeSpecName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sort.Strings(unattachedVolumes)
|
||||||
|
|
||||||
return unattachedVolumes
|
return unattachedVolumes
|
||||||
}
|
}
|
||||||
@ -551,6 +552,8 @@ func filterUnmountedVolumes(mountedVolumes sets.String, expectedVolumes []string
|
|||||||
unmountedVolumes = append(unmountedVolumes, expectedVolume)
|
unmountedVolumes = append(unmountedVolumes, expectedVolume)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sort.Strings(unmountedVolumes)
|
||||||
|
|
||||||
return unmountedVolumes
|
return unmountedVolumes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,10 +164,18 @@ func TestWaitForAttachAndMountError(t *testing.T) {
|
|||||||
Name: "vol2",
|
Name: "vol2",
|
||||||
MountPath: "/vol2",
|
MountPath: "/vol2",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "vol02",
|
||||||
|
MountPath: "/vol02",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "vol3",
|
Name: "vol3",
|
||||||
MountPath: "/vol3",
|
MountPath: "/vol3",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "vol03",
|
||||||
|
MountPath: "/vol03",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -184,12 +192,24 @@ func TestWaitForAttachAndMountError(t *testing.T) {
|
|||||||
RBD: &v1.RBDVolumeSource{},
|
RBD: &v1.RBDVolumeSource{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "vol02",
|
||||||
|
VolumeSource: v1.VolumeSource{
|
||||||
|
RBD: &v1.RBDVolumeSource{},
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "vol3",
|
Name: "vol3",
|
||||||
VolumeSource: v1.VolumeSource{
|
VolumeSource: v1.VolumeSource{
|
||||||
AzureDisk: &v1.AzureDiskVolumeSource{},
|
AzureDisk: &v1.AzureDiskVolumeSource{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "vol03",
|
||||||
|
VolumeSource: v1.VolumeSource{
|
||||||
|
AzureDisk: &v1.AzureDiskVolumeSource{},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -208,7 +228,7 @@ func TestWaitForAttachAndMountError(t *testing.T) {
|
|||||||
t.Errorf("Expected error, got none")
|
t.Errorf("Expected error, got none")
|
||||||
}
|
}
|
||||||
if !strings.Contains(err.Error(),
|
if !strings.Contains(err.Error(),
|
||||||
"unattached volumes=[vol2], failed to process volumes=[vol3]") {
|
"unattached volumes=[vol02 vol2], failed to process volumes=[vol03 vol3]") {
|
||||||
t.Errorf("Unexpected error info: %v", err)
|
t.Errorf("Unexpected error info: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user