Skip to content

Commit

Permalink
storage: Pass block device to qemu if found.
Browse files Browse the repository at this point in the history
We check for block storage for standalone container.
If block device is detected, we pass that to qemu.
Skip bind-mounting the rootfs in that case.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
  • Loading branch information
amshinde committed Jun 21, 2017
1 parent b95748f commit dd13e32
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
9 changes: 9 additions & 0 deletions src/hypervisor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
16 changes: 9 additions & 7 deletions src/oci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit dd13e32

Please sign in to comment.