containers / virtcontainers

A Go package for building hardware virtualized container runtimes
Apache License 2.0
139 stars 43 forks source link

Storage Hotplug: Move from virtio-blk to virtio-scsi #492

Closed mcastelino closed 6 years ago

mcastelino commented 6 years ago

Storage Hotplug: Move from virtio-blk to virtio-scsi

This will potentially allow for a uniform scsi based hotplug vs PCIe/ACPI hotplug across PC and Q35. This will also result in a consumption of a single PCI B/D/F

devimc commented 6 years ago

This will potentially allow for a uniform scsi based hotplug vs PCIe/ACPI hotplug across PC and Q35

do you mean scsi devices are not hot plugged in the PCI? currently any device hot plugged in CC is ACPI based

from performance perspective, both have similar numbers [1] [2]

we should analyse all pros and cons of both storage backends before switching

[1] - https://mpolednik.github.io/2017/01/23/virtio-blk-vs-virtio-scsi/ [2] - http://events.linuxfoundation.org/sites/events/files/slides/CloudOpen2013_Khoa_Huynh_v3.pdf

egernst commented 6 years ago

@devimc -- SCSI controller handles hot plug itself

sboeuf commented 6 years ago

SCSI is our friend since we won't have to do anything regarding the VM :). We will still need to specify to the agent what device name the container should expose, meaning that we will indicate libcontainer which source/dest needs to be bind mounted into the container.

mcastelino commented 6 years ago

@devimc the performance difference is negligible and has been measured before by @amshinde. The key reason for doing this is that SCSI LUN can be hot plugged without adding more devices. Also we will be using vhost-scsi for accelerated storage. So we need to unify the paths. So even if the performance may be slightly lower the simplicity we get is needed.

so it would look like

-device "virtio-scsi-pci,id=foo"

which is cold plugged and attached to the root port if needed

And then the LUNs can be attached on the fly

 drive_add auto file=virtimg/fc18guest,if=none,id=bar
 device_add scsi-disk,bus=foo.0,drive=bar,unit=0

https://lists.nongnu.org/archive/html/qemu-devel/2013-06/msg01040.html

mcastelino commented 6 years ago

@sboeuf the unit=x will help identify the LUN inside AFAIK.

mcastelino commented 6 years ago

Related PR https://github.com/ciao-project/ciao/pull/1624

sboeuf commented 6 years ago

@mcastelino yes I think that using the unit ID is a good approach for SCSI. The agent can rely onto this to find the device on the guest.

sboeuf commented 6 years ago

Closing this as we have moved to virtio-scsi as the default block device driver.