Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Support cinder volume create multiattach option #595

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 5 additions & 0 deletions openstack/blockstorage/v1/volumes/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ type CreateOpts struct {
SnapshotID, SourceVolID, ImageID string
// OPTIONAL
VolumeType string
// OPTIONAL
Multiattach bool
}

// ToVolumeCreateMap assembles a request body based on the contents of a
Expand Down Expand Up @@ -67,6 +69,9 @@ func (opts CreateOpts) ToVolumeCreateMap() (map[string]interface{}, error) {
if opts.VolumeType != "" {
v["volume_type"] = opts.VolumeType
}
if opts.Multiattach {
v["multiattach"] = "1"
}

return map[string]interface{}{"volume": v}, nil
}
Expand Down
3 changes: 3 additions & 0 deletions openstack/blockstorage/v1/volumes/results.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ type Volume struct {
// Arbitrary key-value pairs defined by the user.
Metadata map[string]string `mapstructure:"metadata"`

// Multiattach denotes if the volume is multi-attach capable.
Multiattach bool `mapstructure:"multiattach"`

// Unique identifier for the volume.
ID string `mapstructure:"id"`

Expand Down
5 changes: 5 additions & 0 deletions openstack/blockstorage/v2/volumes/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ type CreateOpts struct {
ImageID string
// The associated volume type [OPTIONAL]
VolumeType string
// OPTIONAL
Multiattach bool
}

// ToVolumeCreateMap assembles a request body based on the contents of a
Expand Down Expand Up @@ -82,6 +84,9 @@ func (opts CreateOpts) ToVolumeCreateMap() (map[string]interface{}, error) {
if opts.VolumeType != "" {
v["volume_type"] = opts.VolumeType
}
if opts.Multiattach {
v["multiattach"] = "1"
}

return map[string]interface{}{"volume": v}, nil
}
Expand Down