Skip to content

Commit 4073bec

Browse files
committed
Issue #410, Issue #424
1 parent 9d8444e commit 4073bec

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

core/src/main/java/org/openstack4j/model/compute/builder/BlockDeviceMappingBuilder.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,20 @@ public interface BlockDeviceMappingBuilder extends Buildable.Builder<BlockDevice
6767

6868
/**
6969
* Set to create a volume from a volume id
70+
*
7071
* @param volumeId
7172
* @return BlockDeviceMappingBuilder
7273
*/
7374
BlockDeviceMappingBuilder volumeId(String volumeId);
75+
76+
/**
77+
* Used to set the volume size of the destination volume (typically needed when source type is image)
78+
*
79+
* @param size the size of the volume
80+
* @return BlockDeviceMappingBuilder
81+
*/
82+
BlockDeviceMappingBuilder volumeSize(Integer size);
83+
84+
7485

7586
}

core/src/main/java/org/openstack4j/openstack/compute/domain/NovaBlockDeviceMappingCreate.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,13 @@
99
1010
*/
1111
public class NovaBlockDeviceMappingCreate implements BlockDeviceMappingCreate {
12-
// {
13-
// "device_name": "/dev/sda1",
14-
// "source_type": "volume",
15-
// "destination_type": "volume",
16-
// "uuid": "fake-volume-id-1",
17-
// "boot_index": "0"
18-
// }
1912

2013
public String device_name;
2114
public String source_type = "volume";
2215
public String destination_type = "volume";
2316
public String uuid;
2417
public String boot_index;
18+
public Integer volume_size;
2519
public boolean delete_on_termination = false;
2620

2721
@JsonProperty("snapshot_id")
@@ -95,15 +89,18 @@ public BlockDeviceMappingBuilder volumeId(String volumeId) {
9589
create.volumeId = volumeId;
9690
return this;
9791
}
92+
93+
@Override
94+
public BlockDeviceMappingBuilder volumeSize(Integer volumeSize) {
95+
create.volume_size = volumeSize;
96+
return this;
97+
}
9898

9999
@Override
100100
public BlockDeviceMappingCreate build() {
101101
return create;
102102
}
103103

104-
105-
106-
107104
@Override
108105
public BlockDeviceMappingBuilder from(BlockDeviceMappingCreate in) {
109106
return new NovaBlockDeviceMappingBuilder((NovaBlockDeviceMappingCreate) in);

0 commit comments

Comments
 (0)