Commit 562e5c6f authored by wenjgao's avatar wenjgao

add lun info when construct iscsi volumeSpec from mountPath

parent 07f68ea8
......@@ -231,6 +231,14 @@ func (plugin *iscsiPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*v
if err != nil {
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)
iscsiVolume := &v1.Volume{
Name: volumeName,
......@@ -238,6 +246,7 @@ func (plugin *iscsiPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*v
ISCSI: &v1.ISCSIVolumeSource{
TargetPortal: bkpPortal,
IQN: iqn,
Lun: int32(lun),
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