import mox
from oslo.config import cfg
+from cinder.brick.initiator import connector as brick_conn
from cinder.brick.iscsi import iscsi
+ from cinder.brick.iser import iser
from cinder import context
from cinder import db
from cinder import exception
self.assertEquals(stats['total_capacity_gb'], float('5.52'))
self.assertEquals(stats['free_capacity_gb'], float('0.52'))
+ def test_validate_connector(self):
+ iscsi_driver = driver.ISCSIDriver()
+ # Validate a valid connector
+ connector = {'ip': '10.0.0.2',
+ 'host': 'fakehost',
+ 'initiator': 'iqn.2012-07.org.fake:01'}
+ iscsi_driver.validate_connector(connector)
+
+ # Validate a connector without the initiator
+ connector = {'ip': '10.0.0.2', 'host': 'fakehost'}
+ self.assertRaises(exception.VolumeBackendAPIException,
+ iscsi_driver.validate_connector, connector)
+
+ class ISERTestCase(ISCSITestCase):
+ """Test Case for ISERDriver."""
+ driver_name = "cinder.volume.drivers.lvm.LVMISERDriver"
+
+ def test_do_iscsi_discovery(self):
+ configuration = mox.MockObject(conf.Configuration)
+ configuration.iser_ip_address = '0.0.0.0'
+ configuration.append_config_values(mox.IgnoreArg())
+
+ iser_driver = driver.ISERDriver(configuration=configuration)
+ iser_driver._execute = lambda *a, **kw: \
+ ("%s dummy" % CONF.iser_ip_address, '')
+ volume = {"name": "dummy",
+ "host": "0.0.0.0"}
+ iser_driver._do_iser_discovery(volume)
+
+ def test_get_iscsi_properties(self):
+ volume = {"provider_location": '',
+ "id": "0",
+ "provider_auth": "a b c"}
+ iser_driver = driver.ISERDriver()
+ iser_driver._do_iser_discovery = lambda v: "0.0.0.0:0000,0 iqn:iqn 0"
+ result = iser_driver._get_iser_properties(volume)
+ self.assertEquals(result["target_portal"], "0.0.0.0:0000")
+ self.assertEquals(result["target_iqn"], "iqn:iqn")
+ self.assertEquals(result["target_lun"], 0)
+
+
class FibreChannelTestCase(DriverTestCase):
- """Test Case for FibreChannelDriver"""
+ """Test Case for FibreChannelDriver."""
driver_name = "cinder.volume.driver.FibreChannelDriver"
def test_initialize_connection(self):
cfg.IntOpt('iscsi_port',
default=3260,
help='The port that the iSCSI daemon is listening on'),
+ cfg.IntOpt('num_iser_scan_tries',
+ default=3,
+ help='The maximum number of times to rescan iSER target'
+ 'to find volume'),
+ cfg.IntOpt('iser_num_targets',
+ default=100,
+ help='The maximum number of iser target ids per host'),
+ cfg.StrOpt('iser_target_prefix',
+ default='iqn.2010-10.org.iser.openstack:',
+ help='prefix for iser volumes'),
+ cfg.StrOpt('iser_ip_address',
+ default='$my_ip',
+ help='The IP address that the iSER daemon is listening on'),
+ cfg.IntOpt('iser_port',
+ default=3260,
+ help='The port that the iSER daemon is listening on'),
cfg.StrOpt('volume_backend_name',
default=None,
- help='The backend name for a given driver implementation'), ]
+ help='The backend name for a given driver implementation'),
+ cfg.BoolOpt('use_multipath_for_image_xfer',
+ default=False,
+ help='Do we attach/detach volumes in cinder using multipath '
+ 'for volume to image and image to volume transfers?'), ]
CONF = cfg.CONF
CONF.register_opts(volume_opts)
#
# Driver to use for volume creation (string value)
- #volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver
+ #volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver,cinder.volume.drivers.lvm.LVMISERDriver
-# Total option count: 300
+#
+# Options defined in cinder.volume.drivers.gpfs
+#
+
+# Path to the directory on GPFS mount point where
+# volumes are stored (string value)
+# gpfs_mount_point_base=$state_path/mnt
+
+# Path to GPFS Glance repository as mounted on
+# Nova nodes (string value)
+# gpfs_images_dir=None
+
+# Set this if Glance image repo is on GPFS as well
+# so that the image bits can be transferred efficiently
+# between Glance and Cinder. Valid values are copy or
+# copy_on_write. copy performs a full copy of the image,
+# copy_on_write efficiently shares unmodified blocks of
+# the image. (string value)
+# gpfs_images_share_mode=None
+
+# A lengthy chain of copy-on-write snapshots or clones
+# could have impact on performance. This option limits
+# the number of indirections required to reach a specific
+# block. 0 indicates unlimited. (integer value)
+# gpfs_max_clone_depth=0
+
+# Create volumes as sparse files which take no space.
+# If set to False volume is created as regular file.
+# In this case volume creation may take a significantly
+# longer time. (boolean value)
+# gpfs_sparse_volumes=True
+
+# Total option count: 305