Skip to content

Commit

Permalink
Review comment fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sushanthakumar committed Dec 12, 2019
1 parent 406d293 commit 82b3afa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 29 deletions.
16 changes: 0 additions & 16 deletions cindercompatibleapi/converter/attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,19 +205,9 @@ func CreateAttachmentReq(cinderReq *CreateAttachmentReqSpec, client *client.Clie

attachment := model.VolumeAttachmentSpec{}
attachment.HostId = host.Id

/*attachment.Metadata = make(map[string]string)
attachment.Metadata["instance_uuid"] = cinderReq.Attachment.InstanceUuID
attachment.Initiator = cinderReq.Attachment.Connector.Initiator
attachment.HostInfo.Ip = cinderReq.Attachment.Connector.IP
attachment.HostInfo.Platform = cinderReq.Attachment.Connector.Platform
attachment.HostInfo.Host = cinderReq.Attachment.Connector.Host
attachment.HostInfo.OsType = cinderReq.Attachment.Connector.OsType */

attachment.Mountpoint = cinderReq.Attachment.Connector.Mountpoint
attachment.VolumeId = cinderReq.Attachment.VolumeUuID


return &attachment, nil
}

Expand Down Expand Up @@ -268,12 +258,6 @@ type UpdateRespAttachment struct {
func UpdateAttachmentReq(cinderReq *UpdateAttachmentReqSpec) *model.VolumeAttachmentSpec {
attachment := model.VolumeAttachmentSpec{}

/*attachment.HostInfo.Initiator = cinderReq.Attachment.Connector.Initiator
attachment.HostInfo.Ip = cinderReq.Attachment.Connector.IP
attachment.HostInfo.Platform = cinderReq.Attachment.Connector.Platform
attachment.HostInfo.Host = cinderReq.Attachment.Connector.Host
attachment.HostInfo.OsType = cinderReq.Attachment.Connector.OsType */

attachment.Mountpoint = cinderReq.Attachment.Connector.Mountpoint

return &attachment
Expand Down
19 changes: 6 additions & 13 deletions cindercompatibleapi/converter/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,12 +437,13 @@ func InitializeConnectionReq(initializeConnectionReq *InitializeConnectionReqSpe
// Host not found, create host with necessary input
var initiators []*model.Initiator

volDriverTypes := strings.Split(initializeConnectionReq.InitializeConnection.Connector.Initiator, ",")
//InitiatorList is comma seperated list of volume drivers supported
InitiatorList:= []string{connector.IscsiDriver}

for _, volDriverType := range volDriverTypes {
for _, volDriverType := range InitiatorList {
volDriver := connector.NewConnector(volDriverType)
if volDriver == nil {
glog.Errorf("unsupport volume driver: %s", volDriverType)
glog.Errorf("unsupported volume driver: %s", volDriverType)
continue
}

Expand All @@ -461,8 +462,9 @@ func InitializeConnectionReq(initializeConnectionReq *InitializeConnectionReqSpe
}

if len(initiators) == 0 {
msg := fmt.Sprintf("Creating host without any initiator for hostname %s", hostName)
msg := fmt.Sprintf("Failed to create host due to nil initiator for hostname %s", hostName)
glog.Error(msg)
return nil, status.Error(codes.FailedPrecondition, msg)
}

hostSpec := &model.HostSpec{
Expand All @@ -481,15 +483,6 @@ func InitializeConnectionReq(initializeConnectionReq *InitializeConnectionReqSpe
}
}

/* attachment.Metadata = make(map[string]string)
attachment.Metadata["instance_uuid"] = cinderReq.Attachment.InstanceUuID
attachment.HostInfo.Ip = initializeConnectionReq.InitializeConnection.Connector.IP
attachment.HostInfo.Platform = initializeConnectionReq.InitializeConnection.Connector.Platform
attachment.HostInfo.Host = initializeConnectionReq.InitializeConnection.Connector.Host
attachment.HostInfo.OsType = initializeConnectionReq.InitializeConnection.Connector.OsType
//attachment.Mountpoint = cinderReq.Attachment.Connector.Mountpoint */

//check volume is exist
volSpec, err := client.GetVolume(volumeID)
if err != nil || volSpec == nil {
Expand Down

0 comments on commit 82b3afa

Please sign in to comment.