https://bugzilla.redhat.com/show_bug.cgi?id=1159180
Currently libvirt only detects duplicate fc_host & scsi_host adapter sources
when the incoming source type definition is the same as the pool type. This
misses the even more oddball cases where a scsi_host/fc_host definition is
using a scsi_hostN where the type of the definition isn't the same as the
type of the pool. It's a fairly twisted and perhaps edge kind of case.
A 'fc_host' has two scsi_hostN values that need to be compared against
existing 'scsi_host' pools - first the fc_host "parent" scsi_hostN (if
it exists or was provided) and second the vHBA scsi_hostN as determined
from the wwnn/wwpn. If a 'fc_host' has a 'parent' attribute of a
scsi_hostN
that's already in use by some 'scsi_host' pool or if it's vHBA (as
created
via nodedev-create) was (for some unknown reason) used by someone for a
'scsi_host' pool, then we have a duplicate.
A 'scsi_host' conversely needs to check against using either the fc_host
'parent' or vHBA. If a 'scsi_host' is using a scsi_hostN of some
existing
fc_host 'parent' attribute or vHBA, then we have a duplicate.
To make matters more complex, the 'fc_host' 'parent' attribute
doesn't have
to be provided in the fc_host XML. If not provided, then it can be determined
if the vHBA already exists (either via nodedev-create or a running fc_host
pool). This means moving the code that was created for fc_host startup to
find the vHBA parent into the storage_backend_scsi code in order for it to
be used there instead. I did try moving into virutil with no success since
that code wasn't very happy to be calling the virNodeDevice* API's.
The only oddball case that cannot be tested for in this scenario is if
the incoming fc_host definition isn't using a nodedev-create'd vHBA and
it doesn't provide a 'parent' attribute, then it is possible that the
vportCreate startup code will find "an available" scsi_hostN that was
(again for some strange reason) already being used by some 'scsi_host' pool.
Added some more verbiage to the documentation to dissuade usage of a
'scsi_host' for an FC capable scsi_hostN as well as to encourage usage
of the 'parent' attribute in a mixed environment
John Ferlan (2):
storage: Move and rename getVhbaSCSIHostParent
storage: Add mixed fc_host/scsi_host duplicate adapter source checks
docs/formatstorage.html.in | 26 +++++-
src/conf/storage_conf.c | 178 ++++++++++++++++++++++++++++++++++++-
src/conf/storage_conf.h | 8 +-
src/libvirt_private.syms | 1 +
src/parallels/parallels_storage.c | 2 +-
src/storage/storage_backend_scsi.c | 66 +-------------
src/storage/storage_driver.c | 4 +-
7 files changed, 215 insertions(+), 70 deletions(-)