Unverified Commit 3d4124f2 authored by Kubernetes Prow Robot's avatar Kubernetes Prow Robot Committed by GitHub

Merge pull request #68108 from wenjun93/iscsiVol

add lun info when construct iscsi volumeSpec from mountPath
parents 5fe91019 562e5c6f
...@@ -235,6 +235,14 @@ func (plugin *iscsiPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*v ...@@ -235,6 +235,14 @@ func (plugin *iscsiPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*v
if err != nil { if err != nil {
return nil, err return nil, err
} }
arr := strings.Split(device, "-lun-")
if len(arr) < 2 {
return nil, fmt.Errorf("failed to retrieve lun from globalPDPath: %v", globalPDPath)
}
lun, err := strconv.Atoi(arr[1])
if err != nil {
return nil, err
}
iface, _ := extractIface(globalPDPath) iface, _ := extractIface(globalPDPath)
iscsiVolume := &v1.Volume{ iscsiVolume := &v1.Volume{
Name: volumeName, Name: volumeName,
...@@ -242,6 +250,7 @@ func (plugin *iscsiPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*v ...@@ -242,6 +250,7 @@ func (plugin *iscsiPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*v
ISCSI: &v1.ISCSIVolumeSource{ ISCSI: &v1.ISCSIVolumeSource{
TargetPortal: bkpPortal, TargetPortal: bkpPortal,
IQN: iqn, IQN: iqn,
Lun: int32(lun),
ISCSIInterface: iface, ISCSIInterface: iface,
}, },
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment