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 <chen.bo@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
Bo Chen 2020-06-29 20:54:39 -07:00 committed by Peng Tao
parent bdd386ba14
commit 56ae20990d

View File

@ -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