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

return extra lun info and allow create with direct_io_pattern #48

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
32 changes: 18 additions & 14 deletions pkg/dsm/webapi/iscsi.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ import (
)

type LunInfo struct {
Name string `json:"name"`
Uuid string `json:"uuid"`
LunType int `json:"type"`
Location string `json:"location"`
Size uint64 `json:"size"`
Used uint64 `json:"allocated_size"`
Status string `json:"status"`
FlashcacheStatus string `json:"flashcache_status"`
IsActionLocked bool `json:"is_action_locked"`
Name string `json:"name"`
Uuid string `json:"uuid"`
LunType int `json:"type"`
Location string `json:"location"`
Size uint64 `json:"size"`
Used uint64 `json:"allocated_size"`
Status string `json:"status"`
FlashcacheStatus string `json:"flashcache_status"`
IsActionLocked bool `json:"is_action_locked"`
DirectIOPattern int `json:"direct_io_pattern"`
DevAttribs []LunDevAttrib `json:"dev_attribs"`
}

type MappedLun struct {
Expand Down Expand Up @@ -67,11 +69,12 @@ type LunDevAttrib struct {
}

type LunCreateSpec struct {
Name string
Location string
Size int64
Type string
DevAttribs []LunDevAttrib
Name string
Location string
Size int64
Type string
DirectIOPattern int
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this field is backwards compatible since the default value for an int is 0, which maps to the default I/O pattern (Buffered I/O) when creating a new LUN.

DevAttribs []LunDevAttrib
}

type LunUpdateSpec struct {
Expand Down Expand Up @@ -165,6 +168,7 @@ func (dsm *DSM) LunCreate(spec LunCreateSpec) (string, error) {
params.Add("size", strconv.FormatInt(int64(spec.Size), 10))
params.Add("type", spec.Type)
params.Add("location", spec.Location)
params.Add("direct_io_pattern", strconv.FormatInt(int64(spec.DirectIOPattern), 10))

js, err := json.Marshal(spec.DevAttribs)
if err != nil {
Expand Down