]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Refactor the helpers to track shared scsi host device
authorOsier Yang <jyang@redhat.com>
Fri, 3 May 2013 18:07:37 +0000 (02:07 +0800)
committerOsier Yang <jyang@redhat.com>
Thu, 16 May 2013 16:32:09 +0000 (00:32 +0800)
commitaeda1ff12df520a62c2102411b9aca931c2be8d7
tree38705a9b48b1bed939892033496b5f6af5bde2d6
parent28d3ad952fb0fae83b347ace99150cbcbc0dcba1
qemu: Refactor the helpers to track shared scsi host device

This changes the helpers qemu{Add,Remove}SharedDisk into
qemu{Add,Remove}SharedDevice, as most of the code in the helpers
can be reused for scsi host device.

To track the shared scsi host device, first it finds out the
device path (e.g. /dev/s[dr]*) which is mapped to the sg device,
and use device ID of the found device path (/dev/s[dr]*) as the
hash key. This is because of the device ID is not unique between
between /dev/s[dr]* and /dev/sg*, e.g.

% sg_map
/dev/sg0  /dev/sda
/dev/sg1  /dev/sr0

% ls -l /dev/sda
brw-rw----. 1 root disk 8, 0 May  2 19:26 /dev/sda

%ls -l /dev/sg0
crw-rw----. 1 root disk 21, 0 May  2 19:26 /dev/sg0
src/qemu/qemu_conf.c
src/qemu/qemu_conf.h
src/qemu/qemu_driver.c
src/qemu/qemu_process.c