mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 13:55:41 +00:00
Merge pull request #127396 from olyazavr/no-dupe-mount-unmount
check if volume already has mount op in progress before mount/unmount
This commit is contained in:
commit
c95dd85823
@ -147,6 +147,9 @@ type reconciler struct {
|
|||||||
func (rc *reconciler) unmountVolumes() {
|
func (rc *reconciler) unmountVolumes() {
|
||||||
// Ensure volumes that should be unmounted are unmounted.
|
// Ensure volumes that should be unmounted are unmounted.
|
||||||
for _, mountedVolume := range rc.actualStateOfWorld.GetAllMountedVolumes() {
|
for _, mountedVolume := range rc.actualStateOfWorld.GetAllMountedVolumes() {
|
||||||
|
if rc.operationExecutor.IsOperationPending(mountedVolume.VolumeName, mountedVolume.PodName, nestedpendingoperations.EmptyNodeName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if !rc.desiredStateOfWorld.PodExistsInVolume(mountedVolume.PodName, mountedVolume.VolumeName, mountedVolume.SELinuxMountContext) {
|
if !rc.desiredStateOfWorld.PodExistsInVolume(mountedVolume.PodName, mountedVolume.VolumeName, mountedVolume.SELinuxMountContext) {
|
||||||
// Volume is mounted, unmount it
|
// Volume is mounted, unmount it
|
||||||
klog.V(5).InfoS(mountedVolume.GenerateMsgDetailed("Starting operationExecutor.UnmountVolume", ""))
|
klog.V(5).InfoS(mountedVolume.GenerateMsgDetailed("Starting operationExecutor.UnmountVolume", ""))
|
||||||
@ -165,6 +168,9 @@ func (rc *reconciler) unmountVolumes() {
|
|||||||
func (rc *reconciler) mountOrAttachVolumes() {
|
func (rc *reconciler) mountOrAttachVolumes() {
|
||||||
// Ensure volumes that should be attached/mounted are attached/mounted.
|
// Ensure volumes that should be attached/mounted are attached/mounted.
|
||||||
for _, volumeToMount := range rc.desiredStateOfWorld.GetVolumesToMount() {
|
for _, volumeToMount := range rc.desiredStateOfWorld.GetVolumesToMount() {
|
||||||
|
if rc.operationExecutor.IsOperationPending(volumeToMount.VolumeName, nestedpendingoperations.EmptyUniquePodName, nestedpendingoperations.EmptyNodeName) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
volMounted, devicePath, err := rc.actualStateOfWorld.PodExistsInVolume(volumeToMount.PodName, volumeToMount.VolumeName, volumeToMount.DesiredPersistentVolumeSize, volumeToMount.SELinuxLabel)
|
volMounted, devicePath, err := rc.actualStateOfWorld.PodExistsInVolume(volumeToMount.PodName, volumeToMount.VolumeName, volumeToMount.DesiredPersistentVolumeSize, volumeToMount.SELinuxLabel)
|
||||||
volumeToMount.DevicePath = devicePath
|
volumeToMount.DevicePath = devicePath
|
||||||
if cache.IsSELinuxMountMismatchError(err) {
|
if cache.IsSELinuxMountMismatchError(err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user