Struct openstack::compute::BlockDevice
source · #[non_exhaustive]pub struct BlockDevice {
pub boot_index: Option<u16>,
pub delete_on_termination: bool,
pub destination_type: BlockDeviceDestinationType,
pub guest_format: Option<String>,
pub size_gib: Option<u32>,
pub source: Option<BlockDeviceSource>,
}
Expand description
A block device to attach to a server.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.boot_index: Option<u16>
Boot index of the device if it’s intended to be bootable.
Note
Not all backends support values other than None
and Some(0)
.
delete_on_termination: bool
Whether to delete the created volume on termination (defaults to false
).
destination_type: BlockDeviceDestinationType
A type of the destination: local disk or persistent volume.
guest_format: Option<String>
Format of the target device if it needs to be formatted.
size_gib: Option<u32>
The size (in GiB) of the created volume (if any).
Note
This is only mandatory when creating source
is None
.
source: Option<BlockDeviceSource>
A source for this block device (if any).
Implementations§
source§impl BlockDevice
impl BlockDevice
sourcepub fn new(
source: BlockDeviceSource,
destination_type: BlockDeviceDestinationType
) -> BlockDevice
pub fn new( source: BlockDeviceSource, destination_type: BlockDeviceDestinationType ) -> BlockDevice
Create a block device from the specified source.
sourcepub fn swap(size_gib: u32) -> BlockDevice
pub fn swap(size_gib: u32) -> BlockDevice
Create a swap device.
sourcepub fn from_image<I>(image: I) -> BlockDevicewhere
I: Into<ImageRef>,
pub fn from_image<I>(image: I) -> BlockDevicewhere I: Into<ImageRef>,
Attach an image.
This is used for the entry referring to the image that the instance is being booted with. Boot index 0 is used for it.
Use from_new_volume
to create a volume from any image.
sourcepub fn from_volume<V>(volume: V, is_boot_device: bool) -> BlockDevicewhere
V: Into<VolumeRef>,
pub fn from_volume<V>(volume: V, is_boot_device: bool) -> BlockDevicewhere V: Into<VolumeRef>,
Attach a remote volume.
The volume will be the first bootable device if is_boot_device
is true
.
sourcepub fn from_empty_volume(size_gib: u32) -> BlockDevice
pub fn from_empty_volume(size_gib: u32) -> BlockDevice
Create a new empty volume.
sourcepub fn from_new_volume<I>(
image: I,
size_gib: u32,
is_boot_device: bool
) -> BlockDevicewhere
I: Into<ImageRef>,
pub fn from_new_volume<I>( image: I, size_gib: u32, is_boot_device: bool ) -> BlockDevicewhere I: Into<ImageRef>,
Create a volume from an image.
The volume will be the first bootable device if is_boot_device
is true
.
Trait Implementations§
source§impl Clone for BlockDevice
impl Clone for BlockDevice
source§fn clone(&self) -> BlockDevice
fn clone(&self) -> BlockDevice
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more