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

Re: [libvirt] [PATCH v3] qemu: Don't fail if the SCSI host device is shareable between domains

On 23/01/14 23:04, Osier Yang wrote:
It doesn't make sense to fail if the SCSI host device is specified
as "shareable" explicitly between domains (NB, it works if and only
if the device is specified as "shareable" for *all* domains,
otherwise it fails).

To fix the problem, this patch introduces an array for virSCSIDevice
struct, which records all the names of domain which are using the
device (note that the recorded domains must specifiy the device as
shareable).  And the change on the data struct brings on many
subsequent changes in the code.

Since prior to this patch, the "shareable" tag didn't work as expected,
it actually work like "non-shareable".  If there was a live domain using
the SCSI device with "shareable" specified, then after upgrading
(assuming the live domain keep running during upgrading) the older
libvirt (without this patch) to newer libvirt (with this patch), it may
cause some confusion when user tries to start later domains as
"shareable". So this patch also added notes in formatdomain.html to
declare the fact.

* src/util/virscsi.h:
   - Remove virSCSIDeviceGetUsedBy
   - Change definition of virSCSIDeviceGetUsedBy and virSCSIDeviceListDel
   - Add virSCSIDeviceIsAvailable

* src/util/virscsi.c:
   - struct virSCSIDevice: Change "used_by" to be an array; Add
     "n_used_by" as the array count
   - virSCSIDeviceGetUsedBy: Removed
   - virSCSIDeviceFree: frees the "used_by" array
   - virSCSIDeviceSetUsedBy: Copy the domain name to avoid potential
     memory corruption
   - virSCSIDeviceIsAvailable: New
   - virSCSIDeviceListDel: Change the logic, for device which is already
     in the list, just remove the corresponding entry in "used_by". And
     since it's only used in one place, we can safely removing the code
     to find out the dev in the list first.
   - Copyright updating

* src/libvirt_private.sys:
   - virSCSIDeviceGetUsedBy: Remove
   - virSCSIDeviceIsAvailable: New

* src/qemu/qemu_hostdev.c:
   - qemuUpdateActiveScsiHostdevs: Check if the device existing before
     adding it to the list;
   - qemuPrepareHostdevSCSIDevices: Error out if the not all domains
     use the device as "shareable"; Also don't try to add the device
     to the activeScsiHostdevs list if it already there; And make
     more sensible error w.r.t the current "shareable" value in
   - qemuDomainReAttachHostScsiDevices: Change the logic according
     to the changes on helpers.
  docs/formatdomain.html.in |  6 ++++
  src/libvirt_private.syms  |  2 +-
  src/qemu/qemu_hostdev.c   | 77 ++++++++++++++++++++++++++---------------------
  src/util/virscsi.c        | 45 +++++++++++++++++++++------
  src/util/virscsi.h        |  7 +++--
  5 files changed, 90 insertions(+), 47 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index ff50214..18bfad1 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2798,6 +2798,12 @@
          between domains (assuming the hypervisor and OS support this).
          Only supported by SCSI host device.
          <span class="since">Since 1.0.6</span>
+        <p>
+          Note: though <code>shareable</shareable> was introduced

s/shareable/code/,  :(

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