From a32228ea85affd3fe811df83d6c63fb578cfec84 Mon Sep 17 00:00:00 2001 From: katarzynakulpa Date: Thu, 11 Jul 2024 15:44:00 +0200 Subject: [PATCH] [issue-1198] missing volume --- pkg/node/node.go | 3 +++ pkg/node/node_test.go | 1 + 2 files changed, 4 insertions(+) diff --git a/pkg/node/node.go b/pkg/node/node.go index 0f30f6576..4f88176f7 100644 --- a/pkg/node/node.go +++ b/pkg/node/node.go @@ -171,6 +171,9 @@ func (s *CSINodeService) processFakeAttachInNodeStageVolume(ll *logrus.Entry, vo return status.Error(codes.Internal, fmt.Sprintf("failed to mount device in stage volume: %s", err.Error())) } } + if volumeCR.Spec.OperationalStatus != apiV1.OperationalStatusMissing { + volumeCR.Spec.OperationalStatus = apiV1.OperationalStatusMissing + } } else if volumeCR.Annotations[fakeAttachVolumeAnnotation] == fakeAttachVolumeKey { delete(volumeCR.Annotations, fakeAttachVolumeAnnotation) ll.Warningf("Removing fake-attach annotation for volume %s", volumeID) diff --git a/pkg/node/node_test.go b/pkg/node/node_test.go index ad4e6e7cb..346bcb2a4 100644 --- a/pkg/node/node_test.go +++ b/pkg/node/node_test.go @@ -874,6 +874,7 @@ var _ = Describe("CSINodeService Fake-Attach", func() { err = node.k8sClient.ReadCR(testCtx, testV1ID, "", vol1) Expect(err).To(BeNil()) Expect(vol1.Spec.CSIStatus).To(Equal(apiV1.VolumeReady)) + Expect(vol1.Spec.OperationalStatus).To(Equal(apiV1.OperationalStatusMissing)) Expect(vol1.Annotations[fakeDeviceVolumeAnnotation]).To(Equal(newFakeDevice)) }) It("Should publish unhealthy fs-mode volume with fake-attach annotation", func() {