Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
external-storage
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IT Services
external-storage
Commits
349d0acc
Commit
349d0acc
authored
7 years ago
by
Matthew Wong
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #287 from humblec/block-2
Remove explicit dereferencing.
parents
8e89ec1e
cefade2d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gluster/block/cmd/glusterblock-provisioner/glusterblock-provisioner.go
+19
-19
19 additions, 19 deletions
.../cmd/glusterblock-provisioner/glusterblock-provisioner.go
with
19 additions
and
19 deletions
gluster/block/cmd/glusterblock-provisioner/glusterblock-provisioner.go
+
19
−
19
View file @
349d0acc
...
@@ -175,7 +175,7 @@ func (p *glusterBlockProvisioner) Provision(options controller.VolumeOptions) (*
...
@@ -175,7 +175,7 @@ func (p *glusterBlockProvisioner) Provision(options controller.VolumeOptions) (*
// Create Volume
// Create Volume
blockVolName
:=
""
blockVolName
:=
""
if
(
*
cfg
)
.
opMode
==
glusterBlockOpmode
{
if
cfg
.
opMode
==
glusterBlockOpmode
{
blockVolName
=
blockVolPrefix
+
string
(
uuid
.
NewUUID
())
blockVolName
=
blockVolPrefix
+
string
(
uuid
.
NewUUID
())
}
}
blockVol
,
createErr
:=
p
.
createVolume
(
volszInt
,
blockVolName
,
cfg
)
blockVol
,
createErr
:=
p
.
createVolume
(
volszInt
,
blockVolName
,
cfg
)
...
@@ -189,17 +189,17 @@ func (p *glusterBlockProvisioner) Provision(options controller.VolumeOptions) (*
...
@@ -189,17 +189,17 @@ func (p *glusterBlockProvisioner) Provision(options controller.VolumeOptions) (*
}
}
//Store fields from response to iscsiSpec struct
//Store fields from response to iscsiSpec struct
if
(
*
cfg
)
.
opMode
==
heketiOpmode
&&
(
*
blockVol
)
.
heketiBlockVolRes
!=
nil
{
if
cfg
.
opMode
==
heketiOpmode
&&
blockVol
.
heketiBlockVolRes
!=
nil
{
iscsiVol
.
Portals
=
(
*
blockVol
)
.
heketiBlockVolRes
.
Portals
iscsiVol
.
Portals
=
blockVol
.
heketiBlockVolRes
.
Portals
iscsiVol
.
Iqn
=
(
*
blockVol
)
.
heketiBlockVolRes
.
Iqn
iscsiVol
.
Iqn
=
blockVol
.
heketiBlockVolRes
.
Iqn
iscsiVol
.
User
=
(
*
blockVol
)
.
heketiBlockVolRes
.
User
iscsiVol
.
User
=
blockVol
.
heketiBlockVolRes
.
User
iscsiVol
.
AuthKey
=
(
*
blockVol
)
.
heketiBlockVolRes
.
AuthKey
iscsiVol
.
AuthKey
=
blockVol
.
heketiBlockVolRes
.
AuthKey
iscsiVol
.
BlockVolName
=
blockVolPrefix
+
(
*
blockVol
)
.
heketiBlockVolRes
.
ID
iscsiVol
.
BlockVolName
=
blockVolPrefix
+
blockVol
.
heketiBlockVolRes
.
ID
}
else
if
(
*
cfg
)
.
opMode
==
glusterBlockOpmode
&&
(
*
blockVol
)
.
glusterBlockExecVolRes
!=
nil
{
}
else
if
cfg
.
opMode
==
glusterBlockOpmode
&&
blockVol
.
glusterBlockExecVolRes
!=
nil
{
iscsiVol
.
Portals
=
(
*
blockVol
)
.
glusterBlockExecVolRes
.
Portals
iscsiVol
.
Portals
=
blockVol
.
glusterBlockExecVolRes
.
Portals
iscsiVol
.
Iqn
=
(
*
blockVol
)
.
glusterBlockExecVolRes
.
Iqn
iscsiVol
.
Iqn
=
blockVol
.
glusterBlockExecVolRes
.
Iqn
iscsiVol
.
User
=
(
*
blockVol
)
.
glusterBlockExecVolRes
.
User
iscsiVol
.
User
=
blockVol
.
glusterBlockExecVolRes
.
User
iscsiVol
.
AuthKey
=
(
*
blockVol
)
.
glusterBlockExecVolRes
.
AuthKey
iscsiVol
.
AuthKey
=
blockVol
.
glusterBlockExecVolRes
.
AuthKey
iscsiVol
.
BlockVolName
=
blockVolName
iscsiVol
.
BlockVolName
=
blockVolName
}
else
{
}
else
{
return
nil
,
fmt
.
Errorf
(
"glusterblock: failed to parse blockvol : [%v]"
,
*
blockVol
)
return
nil
,
fmt
.
Errorf
(
"glusterblock: failed to parse blockvol : [%v]"
,
*
blockVol
)
...
@@ -223,16 +223,16 @@ func (p *glusterBlockProvisioner) Provision(options controller.VolumeOptions) (*
...
@@ -223,16 +223,16 @@ func (p *glusterBlockProvisioner) Provision(options controller.VolumeOptions) (*
secretName
:=
"glusterblk-"
+
user
+
"-secret"
secretName
:=
"glusterblk-"
+
user
+
"-secret"
secretRef
:=
&
v1
.
LocalObjectReference
{}
secretRef
:=
&
v1
.
LocalObjectReference
{}
if
(
*
cfg
)
.
chapAuthEnabled
&&
user
!=
""
&&
password
!=
""
{
if
cfg
.
chapAuthEnabled
&&
user
!=
""
&&
password
!=
""
{
secretRef
,
err
=
p
.
createSecretRef
(
nameSpace
,
secretName
,
user
,
password
)
secretRef
,
err
=
p
.
createSecretRef
(
nameSpace
,
secretName
,
user
,
password
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Errorf
(
"glusterblock: failed to create credentials for pv"
)
glog
.
Errorf
(
"glusterblock: failed to create credentials for pv"
)
return
nil
,
fmt
.
Errorf
(
"glusterblock: failed to create credentials for pv"
)
return
nil
,
fmt
.
Errorf
(
"glusterblock: failed to create credentials for pv"
)
}
}
iscsiVol
.
SessionCHAPAuth
=
(
*
cfg
)
.
chapAuthEnabled
iscsiVol
.
SessionCHAPAuth
=
cfg
.
chapAuthEnabled
iscsiVol
.
BlockSecret
=
secretName
iscsiVol
.
BlockSecret
=
secretName
iscsiVol
.
BlockSecretNs
=
nameSpace
iscsiVol
.
BlockSecretNs
=
nameSpace
}
else
if
!
(
(
*
cfg
)
.
chapAuthEnabled
)
{
}
else
if
!
(
cfg
.
chapAuthEnabled
)
{
glog
.
V
(
1
)
.
Infof
(
"glusterblock: authentication requested is nil"
)
glog
.
V
(
1
)
.
Infof
(
"glusterblock: authentication requested is nil"
)
iscsiVol
.
SessionCHAPAuth
=
false
iscsiVol
.
SessionCHAPAuth
=
false
secretRef
=
nil
secretRef
=
nil
...
@@ -240,14 +240,14 @@ func (p *glusterBlockProvisioner) Provision(options controller.VolumeOptions) (*
...
@@ -240,14 +240,14 @@ func (p *glusterBlockProvisioner) Provision(options controller.VolumeOptions) (*
var
blockString
[]
string
var
blockString
[]
string
modeAnn
:=
""
modeAnn
:=
""
if
(
*
cfg
)
.
opMode
==
glusterBlockOpmode
{
if
cfg
.
opMode
==
glusterBlockOpmode
{
for
k
,
v
:=
range
(
*
cfg
)
.
blockModeArgs
{
for
k
,
v
:=
range
cfg
.
blockModeArgs
{
blockString
=
append
(
blockString
,
k
+
":"
+
v
)
blockString
=
append
(
blockString
,
k
+
":"
+
v
)
modeAnn
=
dstrings
.
Join
(
blockString
,
","
)
modeAnn
=
dstrings
.
Join
(
blockString
,
","
)
}
}
}
else
{
}
else
{
blockString
=
nil
blockString
=
nil
modeAnn
=
"url:"
+
(
*
cfg
)
.
url
+
","
+
"user:"
+
(
*
cfg
)
.
user
+
","
+
"secret:"
+
(
*
cfg
)
.
restSecretName
+
","
+
"secretnamespace:"
+
(
*
cfg
)
.
restSecretNamespace
modeAnn
=
"url:"
+
cfg
.
url
+
","
+
"user:"
+
cfg
.
user
+
","
+
"secret:"
+
cfg
.
restSecretName
+
","
+
"secretnamespace:"
+
cfg
.
restSecretNamespace
}
}
pv
:=
&
v1
.
PersistentVolume
{
pv
:=
&
v1
.
PersistentVolume
{
...
@@ -257,7 +257,7 @@ func (p *glusterBlockProvisioner) Provision(options controller.VolumeOptions) (*
...
@@ -257,7 +257,7 @@ func (p *glusterBlockProvisioner) Provision(options controller.VolumeOptions) (*
provisionerIDAnn
:
p
.
identity
,
provisionerIDAnn
:
p
.
identity
,
provisionerVersion
:
provisionerVersion
,
provisionerVersion
:
provisionerVersion
,
shareIDAnn
:
iscsiVol
.
BlockVolName
,
shareIDAnn
:
iscsiVol
.
BlockVolName
,
creatorAnn
:
(
*
cfg
)
.
opMode
,
creatorAnn
:
cfg
.
opMode
,
volumeTypeAnn
:
"block"
,
volumeTypeAnn
:
"block"
,
"Description"
:
descAnn
,
"Description"
:
descAnn
,
"Blockstring"
:
modeAnn
,
"Blockstring"
:
modeAnn
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment