diff --git a/src/hypervisor.c b/src/hypervisor.c index c27eaa8a..6195e608 100644 --- a/src/hypervisor.c +++ b/src/hypervisor.c @@ -149,6 +149,15 @@ cc_oci_append_storage_args(struct cc_oci_config *config, return false; } + if (config->device_name) { + g_ptr_array_add(additional_args, g_strdup("-device")); + g_ptr_array_add(additional_args, g_strdup_printf("virtio-blk,drive=drive-%d,scsi=off,config-wce=off", + config->state.block_index)); + g_ptr_array_add(additional_args, g_strdup_printf("-drive\nid=drive-%d,file=%s,aio=threads,format=raw,if=none", + config->state.block_index, + config->device_name)); + } + workload_dir = cc_oci_get_workload_dir(config); if (! workload_dir) { g_critical ("No workload"); diff --git a/src/oci.c b/src/oci.c index 02a1788a..1603f3ef 100644 --- a/src/oci.c +++ b/src/oci.c @@ -703,14 +703,16 @@ cc_oci_create (struct cc_oci_config *config) * Bind mount container rootfs */ if (! config->pod) { - if (! cc_oci_add_rootfs_mount(config)) { - g_critical("failed to add container rootfs bind mount"); - return false; - } + if (! cc_oci_rootfs_is_block_device(config)) { + if (! cc_oci_add_rootfs_mount(config)) { + g_critical("failed to add container rootfs bind mount"); + return false; + } - if (! cc_handle_rootfs_mount(config)) { - g_critical("failed to mount container rootfs"); - return false; + if (! cc_handle_rootfs_mount(config)) { + g_critical("failed to mount container rootfs"); + return false; + } } }