Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
d3d3f94e
Commit
d3d3f94e
authored
Nov 26, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #17711 from anish/iqn_format
Auto commit by PR queue bot
parents
4ce6a168
18c82f74
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
iscsi_util.go
pkg/volume/iscsi/iscsi_util.go
+3
-0
iscsi_util_test.go
pkg/volume/iscsi/iscsi_util_test.go
+5
-0
No files found.
pkg/volume/iscsi/iscsi_util.go
View file @
d3d3f94e
...
@@ -180,6 +180,9 @@ func extractPortalAndIqn(device string) (string, string, error) {
...
@@ -180,6 +180,9 @@ func extractPortalAndIqn(device string) (string, string, error) {
portal
:=
device
[
0
:
ind1
]
portal
:=
device
[
0
:
ind1
]
ind2
:=
strings
.
Index
(
device
,
"iqn."
)
ind2
:=
strings
.
Index
(
device
,
"iqn."
)
if
ind2
<
0
{
if
ind2
<
0
{
ind2
=
strings
.
Index
(
device
,
"eui."
)
}
if
ind2
<
0
{
return
""
,
""
,
fmt
.
Errorf
(
"iscsi detach disk: no iqn in %s"
,
device
)
return
""
,
""
,
fmt
.
Errorf
(
"iscsi detach disk: no iqn in %s"
,
device
)
}
}
ind
:=
strings
.
LastIndex
(
device
,
"-lun-"
)
ind
:=
strings
.
LastIndex
(
device
,
"-lun-"
)
...
...
pkg/volume/iscsi/iscsi_util_test.go
View file @
d3d3f94e
...
@@ -68,4 +68,9 @@ func TestExtractPortalAndIqn(t *testing.T) {
...
@@ -68,4 +68,9 @@ func TestExtractPortalAndIqn(t *testing.T) {
if
err
!=
nil
||
portal
!=
"127.0.0.1:3260"
||
iqn
!=
"iqn.2014-12.com.example:test.tgt00"
{
if
err
!=
nil
||
portal
!=
"127.0.0.1:3260"
||
iqn
!=
"iqn.2014-12.com.example:test.tgt00"
{
t
.
Errorf
(
"extractPortalAndIqn: got %v %s %s"
,
err
,
portal
,
iqn
)
t
.
Errorf
(
"extractPortalAndIqn: got %v %s %s"
,
err
,
portal
,
iqn
)
}
}
devicePath
=
"127.0.0.1:3260-eui.02004567A425678D-lun-0"
portal
,
iqn
,
err
=
extractPortalAndIqn
(
devicePath
)
if
err
!=
nil
||
portal
!=
"127.0.0.1:3260"
||
iqn
!=
"eui.02004567A425678D"
{
t
.
Errorf
(
"extractPortalAndIqn: got %v %s %s"
,
err
,
portal
,
iqn
)
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment