@@ -581,6 +581,7 @@ func (og *operationGenerator) GenerateMountVolumeFunc(
581
581
devicePath ,
582
582
deviceMountPath )
583
583
if err != nil {
584
+ og .checkForFailedMount (volumeToMount , err )
584
585
og .markDeviceErrorState (volumeToMount , devicePath , deviceMountPath , err , actualStateOfWorld )
585
586
// On failure, return error. Caller will log and retry.
586
587
return volumeToMount .GenerateError ("MountVolume.MountDevice failed" , err )
@@ -635,6 +636,7 @@ func (og *operationGenerator) GenerateMountVolumeFunc(
635
636
VolumeMountState : VolumeMounted ,
636
637
}
637
638
if mountErr != nil {
639
+ og .checkForFailedMount (volumeToMount , mountErr )
638
640
og .markVolumeErrorState (volumeToMount , markOpts , mountErr , actualStateOfWorld )
639
641
// On failure, return error. Caller will log and retry.
640
642
return volumeToMount .GenerateError ("MountVolume.SetUp failed" , mountErr )
@@ -684,6 +686,18 @@ func (og *operationGenerator) GenerateMountVolumeFunc(
684
686
}
685
687
}
686
688
689
+ func (og * operationGenerator ) checkForFailedMount (volumeToMount VolumeToMount , mountError error ) {
690
+ pv := volumeToMount .VolumeSpec .PersistentVolume
691
+ if pv == nil {
692
+ return
693
+ }
694
+
695
+ if volumetypes .IsFilesystemMismatchError (mountError ) {
696
+ simpleMsg , _ := volumeToMount .GenerateMsg ("MountVolume failed" , mountError .Error ())
697
+ og .recorder .Eventf (pv , v1 .EventTypeWarning , kevents .FailedMountOnFilesystemMismatch , simpleMsg )
698
+ }
699
+ }
700
+
687
701
func (og * operationGenerator ) markDeviceErrorState (volumeToMount VolumeToMount , devicePath , deviceMountPath string , mountError error , actualStateOfWorld ActualStateOfWorldMounterUpdater ) {
688
702
if volumetypes .IsOperationFinishedError (mountError ) &&
689
703
actualStateOfWorld .GetDeviceMountState (volumeToMount .VolumeName ) == DeviceMountUncertain {
0 commit comments