Update SolidFire to use target driver model

A while back we broke the inheritance chain of transport and backend
by moving the target drivers outside of the drivers.

This means you can instantiate and use any target (data transport)
method that your device supports without requiring a separate
driver (again, if your device can support it).  This was
particularly important for the LVM ref driver and the 5 iSCSI
options that go with it.

This patch converts the SolidFire driver to use the same model.  For
the most part it's pretty simple:
* Create an internal class for the target driver
* Instantiate the target driver that you want to use
* wrap the old transport calls that come to the driver to call
  the new target driver objects

This exposed some issues with the abc work that was being done.
There are a number of items that are marked as required but are
really only necessary for LVM based drivers.  So this also
creates a san/3'rd party iSCSI subclass as well that has the
more appropriate abc settings for such devices.

Change-Id: I02ceaac58d0e4176ccad423763ae0101cfb8446b
This commit is contained in:
John Griffith
2015-06-11 08:52:38 -06:00
parent 27b6169869
commit 857f475920
2 changed files with 123 additions and 25 deletions

View File

@@ -354,3 +354,56 @@ class ISCSITarget(driver.Target):
@abc.abstractmethod
def _get_target(self, iqn):
pass
class SanISCSITarget(ISCSITarget):
"""iSCSI target for san devices.
San devices are slightly different, they don't need to implement
all of the same things that we need to implement locally fro LVM
and local block devices when we create and manage our own targets.
"""
def __init__(self, *args, **kwargs):
super(SanISCSITarget, self).__init__(*args, **kwargs)
@abc.abstractmethod
def create_export(self, context, volume, volume_path):
pass
@abc.abstractmethod
def remove_export(self, context, volume):
pass
@abc.abstractmethod
def ensure_export(self, context, volume, volume_path):
pass
@abc.abstractmethod
def terminate_connection(self, volume, connector, **kwargs):
pass
# NOTE(jdg): Items needed for local iSCSI target drivers,
# but NOT sans Stub them out here to make abc happy
# Use care when looking at these to make sure something
# that's inheritted isn't dependent on one of
# these.
def _get_target_and_lun(self, context, volume):
pass
def _get_target_chap_auth(self, context, iscsi_name):
pass
def create_iscsi_target(self, name, tid, lun, path,
chap_auth, **kwargs):
pass
def remove_iscsi_target(self, tid, lun, vol_id, vol_name, **kwargs):
pass
def _get_iscsi_target(self, context, vol_id):
pass
def _get_target(self, iqn):
pass