Re: Is it possible to pass-through a SATA port (not a controller and not a drive, but a single port)?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20.12.2017 15:37, Paolo Bonzini wrote:

> Passing through a port is not possible, but it's possible to hot-unplug
> the entire virtio-blk disk and add it back, like:
> 
>    -drive if=none,id=bupdisk,file=/dev/sda,format=raw,cache=none
>    -device virtio-blk-pci,drive=bupdisk
> 
> and then, to change the drive:
> 
>    in the guest: sync
>    in the QEMU monitor: device_del bupdisk
>    on the host: echo 1 > /sys/block/sda/device/delete
>    in the QEMU monitor:
>       drive_add 0 if=none,id=bupdisk,file=/dev/sda,format=raw,cache=none
>       device_add virtio-blk-pci,drive=bupdisk
> 
> This uses PCI hotplug.  An alternative is to use virtio-scsi; then you
> can keep always the same controller and do the hotplug at the SCSI level:
> 
>    -device virtio-scsi-pci,id=scsi
>    -drive if=none,id=bupdisk,file=/dev/sda,format=raw,cache=none
>    -device scsi-hd,drive=bupdisk,bus=scsi.0
> 
> and then, to change the drive:
> 
>    in the guest: sync
>    in the QEMU monitor: device_del bupdisk
>    on the host: echo 1 > /sys/block/sda/device/delete
>    in the QEMU monitor:
>       drive_add 0 if=none,id=bupdisk,file=/dev/sda,format=raw,cache=none
>       device_add scsi-hd,drive=bupdisk,bus=scsi.0
> 

Paolo,

this is just to report that both of your methods seem to work. In my
previous message, I have stated that the VM won't boot any more if I
change my command line as advised in your first proposal.

While this is true at the first place, it is not an essential problem.
By adding menu=on to the -boot option, I made the VM's BIOS show a boot
menu during startup. Selecting the right boot disk there helped.

Obviously, the VM (after the changes) treats the backup disk as first
disk and tries to boot from it, which of course fails. This is also true
with your second method.

So I now will have to find out how to make it boot from the right disk
without manually involving the boot menu every time.

Regarding the actual topic: Thank you very much again. Both solutions
you have proposed are viable. Their only disadvantage is that we have to
issue commands in the guest *and* in the host system in order to cleanly
remove the backup disk.

One method to automate this could be writing a script for the host which
issues the sync command in the guest via SSH (an SSH server is already
running there) and then issues the other commands on the host.

I will conduct some tests and then decide if I'd like to go that way or
if adding a separate PCIe SATA controller and passing that to the guest
as a whole would be better. The advantage would be that only the guest,
but not the host would be involved when the backup should be changed.

Once again, thank you and your colleagues very much for your support and
for your great work!

Regards,

Binarus



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux