Skip to content

Commit 0e9d6b9

Browse files
authored
Merge pull request #989 from baseman79/master
Add additional properties of block device mapping api v2
2 parents 76c50bd + b440996 commit 0e9d6b9

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

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

+25-1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,30 @@ public interface BlockDeviceMappingBuilder extends Buildable.Builder<BlockDevice
8383
*/
8484
BlockDeviceMappingBuilder volumeSize(Integer size);
8585

86-
86+
/**
87+
* Used to set the disk_bus, low level detail that some hypervisors
88+
* (currently only libvirt) may support.
89+
*
90+
* @see <a href=
91+
* "https://docs.openstack.org/developer/nova/block_device_mapping.html#block-device-mapping-v2">https://docs.openstack.org/developer/nova/block_device_mapping.html#block-device-mapping-v2</a>
92+
*
93+
* @param disk_bus
94+
* type, e.g ide, usb, virtio, scsi
95+
* @return BlockDeviceMappingBuilder
96+
*/
97+
BlockDeviceMappingBuilder diskBus(String diskBus);
98+
99+
/**
100+
* Used to set the device_type, low level detail that some hypervisors
101+
* (currently only libvirt) may support.
102+
*
103+
* @see <a href=
104+
* "https://docs.openstack.org/developer/nova/block_device_mapping.html#block-device-mapping-v2">https://docs.openstack.org/developer/nova/block_device_mapping.html#block-device-mapping-v2</a>
105+
*
106+
* @param device_type,
107+
* disk, cdrom, floppy, lun
108+
* @return BlockDeviceMappingBuilder
109+
*/
110+
BlockDeviceMappingBuilder deviceType(String deviceType);
87111

88112
}

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

+22
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import org.openstack4j.model.compute.BlockDeviceMappingCreate;
66
import org.openstack4j.model.compute.builder.BlockDeviceMappingBuilder;
77

8+
import com.fasterxml.jackson.annotation.JsonInclude;
9+
import com.fasterxml.jackson.annotation.JsonInclude.Include;
810
import com.fasterxml.jackson.annotation.JsonProperty;
911

1012
/**
@@ -27,6 +29,14 @@ public class NovaBlockDeviceMappingCreate implements BlockDeviceMappingCreate {
2729
@JsonProperty("volume_id")
2830
public String volumeId;
2931

32+
@JsonInclude(Include.NON_NULL)
33+
@JsonProperty("disk_bus")
34+
public String diskBus;
35+
36+
@JsonInclude(Include.NON_NULL)
37+
@JsonProperty("device_type")
38+
public String deviceType;
39+
3040
public static NovaBlockDeviceMappingBuilder builder() {
3141
return new NovaBlockDeviceMappingBuilder(new NovaBlockDeviceMappingCreate());
3242
}
@@ -99,6 +109,18 @@ public BlockDeviceMappingBuilder volumeSize(Integer volumeSize) {
99109
return this;
100110
}
101111

112+
@Override
113+
public BlockDeviceMappingBuilder diskBus(String diskBus) {
114+
create.diskBus = diskBus;
115+
return this;
116+
}
117+
118+
@Override
119+
public BlockDeviceMappingBuilder deviceType(String deviceType) {
120+
create.deviceType = deviceType;
121+
return this;
122+
}
123+
102124
@Override
103125
public BlockDeviceMappingCreate build() {
104126
return create;

0 commit comments

Comments
 (0)