From 56ae20990da1bced06fe00d218e199a1376d868d Mon Sep 17 00:00:00 2001 From: Bo Chen Date: Mon, 29 Jun 2020 20:54:39 -0700 Subject: [PATCH] kata_agent: Allow to use "VirtPath" as volume source for blk devices [ port from runtime commit aea29b64b66f75049cb045f9e41dff2becdbebdc ] 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. Signed-off-by: Bo Chen Signed-off-by: Peng Tao --- src/runtime/virtcontainers/kata_agent.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/runtime/virtcontainers/kata_agent.go b/src/runtime/virtcontainers/kata_agent.go index 6ce30c391c..0001fce4b9 100644 --- a/src/runtime/virtcontainers/kata_agent.go +++ b/src/runtime/virtcontainers/kata_agent.go @@ -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 - vol.Source = blockDrive.PCIAddr + 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