Skip to content

Commit

Permalink
Merge pull request #629 from jackhaibo/fusionstorage
Browse files Browse the repository at this point in the history
Fix some issues related to the fusionstorage iscsi mapping.
  • Loading branch information
leonwanghui authored Mar 19, 2019
2 parents b796c7a + 512c413 commit c39ff25
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
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

0 comments on commit c39ff25

Please sign in to comment.