From 56289ef3f8e69470811a513c6290a271e1a5e0f7 Mon Sep 17 00:00:00 2001 From: Tardis Xu Date: Thu, 24 May 2018 23:48:19 +0800 Subject: [PATCH 1/2] Fix issue 64119. --- pkg/volume/rbd/rbd_test.go | 1 + pkg/volume/rbd/rbd_util.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/pkg/volume/rbd/rbd_test.go b/pkg/volume/rbd/rbd_test.go index 4ab32f6b5c..27bd7e9563 100644 --- a/pkg/volume/rbd/rbd_test.go +++ b/pkg/volume/rbd/rbd_test.go @@ -329,6 +329,7 @@ func TestPlugin(t *testing.T) { RBDPool: "pool1", RBDImage: "image1", FSType: "ext4", + ReadOnly: true, }, }, }), diff --git a/pkg/volume/rbd/rbd_util.go b/pkg/volume/rbd/rbd_util.go index 1860886777..0470b7a298 100644 --- a/pkg/volume/rbd/rbd_util.go +++ b/pkg/volume/rbd/rbd_util.go @@ -399,6 +399,10 @@ func (util *RBDUtil) AttachDisk(b rbdMounter) (string, error) { break } } + } else { + // ReadOnly rbd volume should not check rbd status of being used to + // support mounted as read-only by multiple consumers simultaneously. + needValidUsed = !b.rbd.ReadOnly } err := wait.ExponentialBackoff(backoff, func() (bool, error) { used, rbdOutput, err := util.rbdStatus(&b) From 015871bf57e7e688ac36518eadceb2de6561abcb Mon Sep 17 00:00:00 2001 From: Tardis Xu Date: Fri, 25 May 2018 00:07:41 +0800 Subject: [PATCH 2/2] Format --- pkg/volume/rbd/rbd_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/volume/rbd/rbd_test.go b/pkg/volume/rbd/rbd_test.go index 27bd7e9563..e5b6c162c9 100644 --- a/pkg/volume/rbd/rbd_test.go +++ b/pkg/volume/rbd/rbd_test.go @@ -329,7 +329,7 @@ func TestPlugin(t *testing.T) { RBDPool: "pool1", RBDImage: "image1", FSType: "ext4", - ReadOnly: true, + ReadOnly: true, }, }, }),