]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Add a hash table for the shared disks
authorOsier Yang <jyang@redhat.com>
Wed, 2 Jan 2013 14:37:07 +0000 (22:37 +0800)
committerOsier Yang <jyang@redhat.com>
Mon, 7 Jan 2013 13:35:19 +0000 (21:35 +0800)
commitd7ead3e19a191ac83cf327724272a3e4dd5b2b4f
tree050de041d52beb7d201542eb0b122dc26587df00
parentba72cb12fa44e65bd5b89bb1a21831e13dceec0a
qemu: Add a hash table for the shared disks

This introduces a hash table for qemu driver, to store the shared
disk's info as (@major:minor, @ref_count). @ref_count is the number
of domains which shares the disk.

Since we only care about if the disk support unprivileged SG_IO
commands, and the SG_IO commands only make sense for block disk,
this patch only manages (add/remove hash entry) the shared disk for
block disk.

* src/qemu/qemu_conf.h: (Add member 'sharedDisks' of type
                         virHashTablePtr; Declare helpers
                         qemuGetSharedDiskKey, qemuAddSharedDisk
                         and qemuRemoveSharedDisk)
* src/qemu/qemu_conf.c (Implement the 3 helpers)
* src/qemu/qemu_process.c (Update 'sharedDisks' when domain
                           starting and shutdown)
* src/qemu/qemu_driver.c (Update 'sharedDisks' when attaching
                          or detaching disk).
src/qemu/qemu_conf.c
src/qemu/qemu_conf.h
src/qemu/qemu_driver.c
src/qemu/qemu_process.c