cephfs: createCephUser needs admin credentials

This commit is contained in:
gman 2018-06-12 17:08:14 +02:00
parent b260bff659
commit 0cc1e06beb

View File

@ -71,7 +71,20 @@ func handleUser(volOptions *volumeOptions, volUuid string, req *csi.NodePublishV
if volOptions.ProvisionVolume { if volOptions.ProvisionVolume {
// The volume is provisioned dynamically, create a dedicated user // The volume is provisioned dynamically, create a dedicated user
if ent, err := createCephUser(volOptions, volUuid, req.GetReadonly()); err != nil { // First, store admin credentials - those are needed for creating a user
adminCr, err := getAdminCredentials(req.GetNodePublishSecrets())
if err != nil {
return nil, err
}
if err = storeCephAdminCredentials(volUuid, adminCr); err != nil {
return nil, err
}
// Then create the user
if ent, err := createCephUser(volOptions, adminCr, volUuid); err != nil {
return nil, err return nil, err
} else { } else {
cr.id = ent.Entity[len(cephEntityClientPrefix):] cr.id = ent.Entity[len(cephEntityClientPrefix):]