diff --git a/pkg/volume/rbd/rbd_test.go b/pkg/volume/rbd/rbd_test.go index 4ab32f6b5c..e5b6c162c9 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)