diff --git a/src/runtime/cli/config/configuration-clh.toml.in b/src/runtime/cli/config/configuration-clh.toml.in index 00185ea2e4..c9d0f5f086 100644 --- a/src/runtime/cli/config/configuration-clh.toml.in +++ b/src/runtime/cli/config/configuration-clh.toml.in @@ -68,6 +68,11 @@ virtio_fs_cache_size = @DEFVIRTIOFSCACHESIZE@ # cloud-hypervisor prefers virtiofs caching (dax) for performance reasons virtio_fs_cache = "always" +# Block storage driver to be used for the hypervisor in case the container +# rootfs is backed by a block device. This is virtio-scsi, virtio-blk +# or nvdimm. +block_device_driver = "virtio-blk" + # This option changes the default hypervisor and kernel parameters # to enable debug output where available. This extra output is added # to the proxy logs, but only when proxy debug is also enabled. diff --git a/src/runtime/virtcontainers/clh.go b/src/runtime/virtcontainers/clh.go index 4ef64f9820..598cba19c4 100644 --- a/src/runtime/virtcontainers/clh.go +++ b/src/runtime/virtcontainers/clh.go @@ -413,6 +413,11 @@ func (clh *cloudHypervisor) getThreadIDs() (vcpuThreadIDs, error) { } func (clh *cloudHypervisor) hotplugBlockDevice(drive *config.BlockDrive) error { + if clh.config.BlockDeviceDriver != config.VirtioBlock { + return fmt.Errorf("incorrect hypervisor configuration on 'block_device_driver':"+ + " using '%v' but only support '%v'", clh.config.BlockDeviceDriver, config.VirtioBlock) + } + cl := clh.client() ctx, cancel := context.WithTimeout(context.Background(), clhHotPlugAPITimeout*time.Second) defer cancel()