Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some issues related to the fusionstorage iscsi mapping. #629

Merged
merged 1 commit into from
Mar 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions contrib/drivers/huawei/dorado/dorado.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ func (d *Driver) InitializeConnectionIscsi(opt *pb.CreateVolumeAttachmentOpts) (
DriverVolumeType: ISCSIProtocol,
ConnectionData: map[string]interface{}{
"targetDiscovered": true,
"targetIQN": tgtIqn,
"targetPortal": tgtIp + ":3260",
"targetIQN": []string{tgtIqn},
"targetPortal": []string{tgtIp + ":3260"},
"discard": false,
"targetLun": tgtLun,
},
Expand Down
8 changes: 4 additions & 4 deletions contrib/drivers/huawei/fusionstorage/fsclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,21 +314,21 @@ func (c *FsCli) queryHostLunInfo(hostName string) (*hostLunList, error) {
return lunList, nil
}

func (c *FsCli) queryIscsiPortal(initiator string) (string, error) {
func (c *FsCli) queryIscsiPortal(initiator string) ([]string, error) {
args := []string{
"--op", "queryIscsiPortalInfo", "--portName", initiator,
}
out, err := c.RunCmd(args...)
if err != nil {
log.Errorf("Query iscsi portal failed: %v", err)
return "", err
return nil, err
}

if len(out) > 0 {
return out[0], nil
return out, nil
}

return "", fmt.Errorf("The iscsi target portal is empty.")
return nil, fmt.Errorf("The iscsi target portal is empty.")
}

func (c *FsCli) queryHostFromVolume(lunId string) ([]host, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,14 @@ func (d *Driver) InitializeConnection(opt *pb.CreateVolumeAttachmentOpts) (*Conn
return nil, err
}

iscsiTarget := strings.Split(targetPortalInfo, ",")
var targetIQN []string
var targetPortal []string

for _, v := range targetPortalInfo {
iscsiTarget := strings.Split(v, ",")
targetIQN = append(targetIQN, iscsiTarget[1])
targetPortal = append(targetPortal, iscsiTarget[0])
}

connInfo := &ConnectionInfo{
DriverVolumeType: ISCSIProtocol,
Expand All @@ -270,8 +277,8 @@ func (d *Driver) InitializeConnection(opt *pb.CreateVolumeAttachmentOpts) (*Conn
"connect_type": FusionstorageIscsi,
"host": hostName,
"initiator": initiator,
"targetIQN": []string{iscsiTarget[1]},
"targetPortal": []string{iscsiTarget[0]},
"targetIQN": targetIQN,
"targetPortal": targetPortal,
},
}

Expand Down
4 changes: 2 additions & 2 deletions contrib/drivers/openstack/cinder/cinder.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ func (d *Driver) InitializeConnection(req *pb.CreateVolumeAttachmentOpts) (*mode
connData := map[string]interface{}{
"accessMode": data["access_mode"],
"targetDiscovered": data["target_discovered"],
"targetIQN": data["target_iqn"],
"targetPortal": data["target_portal"],
"targetIQN": []string{data["target_iqn"].(string)},
"targetPortal": []string{data["target_portal"].(string)},
"discard": false,
"targetLun": data["target_lun"],
}
Expand Down