Skip to content

Commit

Permalink
ceph: initialize rbd block pool after creation
Browse files Browse the repository at this point in the history
This is done in order to prevent deadlock when parallel
PVC create requests are issued on a new uninitialized
rbd block pool due to https://tracker.ceph.com/issues/52537.

Fixes: #8696

Signed-off-by: Rakshith R <rar@redhat.com>
  • Loading branch information
Rakshith-R committed Oct 6, 2021
1 parent 00cef45 commit f9a479b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/operator/ceph/pool/controller.go
Expand Up @@ -356,6 +356,14 @@ func createPool(context *clusterd.Context, clusterInfo *cephclient.ClusterInfo,
return errors.Wrapf(err, "failed to create pool %q", p.Name)
}

logger.Infof("initializing rbd pool %q", p.Name)
args := []string{"pool", "init", p.Name}
output, err := cephclient.NewRBDCommand(context, clusterInfo, args).Run()
if err != nil {
return errors.Wrapf(err, "failed to initialize replicated pool %q. %s", p.Name, string(output))
}
logger.Infof("successfully initialized rbd pool %q", p.Name)

return nil
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/operator/ceph/pool/controller_test.go
Expand Up @@ -51,6 +51,9 @@ func TestCreatePool(t *testing.T) {
if command == "ceph" && args[1] == "erasure-code-profile" {
return `{"k":"2","m":"1","plugin":"jerasure","technique":"reed_sol_van"}`, nil
}
if command == "rbd" {
assert.Equal(t, []string{"pool", "init", "mypool"}, args[0:3])
}
return "", nil
},
}
Expand Down

0 comments on commit f9a479b

Please sign in to comment.