Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
clh: Set 'virtio-blk' as the default block device driver
Browse files Browse the repository at this point in the history
The block device driver defaults to 'virtio-scsi' when it is not set in
the hypervisor configuration file, while cloud-hypervisor supports only
'virtio-blk' for its block devices.

Fixes: #2570

Signed-off-by: Bo Chen <[email protected]>
  • Loading branch information
likebreath committed May 13, 2020
1 parent c5f97b2 commit 5e55272
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cli/config/configuration-clh.toml.in
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions virtcontainers/clh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 5e55272

Please sign in to comment.