Skip to main content

krun_add_disk3

Function krun_add_disk3 

Source
pub unsafe extern "C" fn krun_add_disk3(
    ctx_id: u32,
    block_id: *const c_char,
    disk_path: *const c_char,
    disk_format: u32,
    read_only: bool,
    direct_io: bool,
    sync_mode: u32,
) -> i32
Expand description

Adds a disk image to be used as a general partition for the microVM.

This API is mutually exclusive with the deprecated krun_set_root_disk and krun_set_data_disk methods and must not be used together.

SECURITY NOTE: See the security note for krun_add_disk2.

Arguments: “ctx_id” - the configuration context ID. “block_id” - a null-terminated string representing the partition. “disk_path” - a null-terminated string representing the path leading to the disk image. “disk_format” - the disk image format (i.e. KRUN_DISK_FORMAT_{RAW, QCOW2}) “read_only” - whether the mount should be read-only. Required if the caller does not have write permissions (for disk images in /usr/share). “direct_io” - whether to bypass the host caches. “sync_mode” - whether to enable VIRTIO_BLK_F_FLUSH. On macOS, an additional relaxed sync mode is available, which is enabled by default, and will not ask the drive to flush its buffered data.

Returns: Zero on success or a negative error number on failure.