Skip to content

Commit

Permalink
HACK: The VmPath is not getting properly populated
Browse files Browse the repository at this point in the history
This does not fix it. But still does some things right

Signed-off-by: Manohar Castelino <manohar.r.castelino@intel.com>
  • Loading branch information
mcastelino committed Dec 6, 2018
1 parent b9706aa commit ec07e0f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
9 changes: 7 additions & 2 deletions virtcontainers/device/drivers/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,13 @@ func (device *BlockDevice) Attach(devReceiver api.DeviceReceiver) (err error) {
}

customOptions := device.DeviceInfo.DriverOptions
if customOptions != nil && customOptions["block-driver"] == "virtio-blk" {
drive.VirtPath = filepath.Join("/dev", driveName)
if customOptions != nil {
if customOptions["block-driver"] == "virtio-blk" {
drive.VirtPath = filepath.Join("/dev", driveName)
}
if customOptions["block-driver"] == "virtio-mmio" {
drive.VirtPath = filepath.Join("/dev", driveName)
}
} else {
scsiAddr, err := utils.GetSCSIAddress(index)
if err != nil {
Expand Down
8 changes: 7 additions & 1 deletion virtcontainers/kata_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,10 @@ func (k *kataAgent) appendDevices(deviceList []*grpc.Device, c *Container) []*gr
ContainerPath: dev.ContainerPath,
}

if d.SCSIAddr == "" {
if d.VirtPath != "" {
kataDevice.Type = kataMmioBlkDevType
kataDevice.Id = d.VirtPath
} else if d.SCSIAddr == "" {
kataDevice.Type = kataBlkDevType
kataDevice.Id = d.PCIAddr
} else {
Expand Down Expand Up @@ -1277,6 +1280,9 @@ func (k *kataAgent) handleBlockVolumes(c *Container) []*grpc.Storage {
if c.sandbox.config.HypervisorConfig.BlockDeviceDriver == VirtioBlock {
vol.Driver = kataBlkDevType
vol.Source = blockDrive.PCIAddr
} else if c.sandbox.config.HypervisorConfig.BlockDeviceDriver == VirtioMmio {
vol.Driver = kataMmioBlkDevType
vol.Source = blockDrive.VirtPath
} else {
vol.Driver = kataSCSIDevType
vol.Source = blockDrive.SCSIAddr
Expand Down

0 comments on commit ec07e0f

Please sign in to comment.