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

Commit 985a863

Browse files
authored
Merge pull request #598 from jtopjian/bfv-volume-size-fix
[rfr] Only pass volume_size if it is greater than zero
2 parents f28452d + b7fea37 commit 985a863

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

openstack/compute/v2/extensions/bootfromvolume/requests.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ func (opts CreateOptsExt) ToServerCreateMap() (map[string]interface{}, error) {
7979
blockDevice[i]["source_type"] = bd.SourceType
8080
blockDevice[i]["boot_index"] = strconv.Itoa(bd.BootIndex)
8181
blockDevice[i]["delete_on_termination"] = strconv.FormatBool(bd.DeleteOnTermination)
82-
blockDevice[i]["volume_size"] = strconv.Itoa(bd.VolumeSize)
82+
if bd.VolumeSize > 0 {
83+
blockDevice[i]["volume_size"] = strconv.Itoa(bd.VolumeSize)
84+
}
8385
if bd.UUID != "" {
8486
blockDevice[i]["uuid"] = bd.UUID
8587
}

openstack/compute/v2/extensions/bootfromvolume/requests_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ func TestCreateMultiEphemeralOpts(t *testing.T) {
102102
"delete_on_termination": "true",
103103
"destination_type":"local",
104104
"source_type":"image",
105-
"uuid":"123456",
106-
"volume_size": "0"
105+
"uuid":"123456"
107106
},
108107
{
109108
"boot_index": "-1",

0 commit comments

Comments
 (0)