kata_agent: Allow to use "VirtPath" as volume source for blk devices
[ port from runtime commit ]
When the "PCIAddr" of block device is not available (e.g. cloud-hypervisor), we
allow to use the "VirtPath" as the volume source for creating containers.
@@ -1587,7 +1587,11 @@ func (k *kataAgent) handleDeviceBlockVolume(c *Container, device api.Device) (*g
vol.Source = blockDrive.DevNo
case c.sandbox.config.HypervisorConfig.BlockDeviceDriver == config.VirtioBlock:
vol.Driver = kataBlkDevType
+ if blockDrive.PCIAddr == "" {
+ vol.Source = blockDrive.VirtPath
+ } else {
vol.Source = blockDrive.PCIAddr
+ }
case c.sandbox.config.HypervisorConfig.BlockDeviceDriver == config.VirtioMmio:
vol.Driver = kataMmioBlkDevType
vol.Source = blockDrive.VirtPath
