from cinder.volume import driver
from cinder.volume.drivers import nexenta
from cinder.volume.drivers.nexenta import jsonrpc
+ from cinder.volume.drivers.nexenta import options
-VERSION = '1.0'
LOG = logging.getLogger(__name__)
- NEXENTA_OPTS = [
- cfg.StrOpt('nexenta_host',
- default='',
- help='IP address of Nexenta SA'),
- cfg.IntOpt('nexenta_rest_port',
- default=2000,
- help='HTTP port to connect to Nexenta REST API server'),
- cfg.StrOpt('nexenta_rest_protocol',
- default='auto',
- help='Use http or https for REST connection (default auto)'),
- cfg.StrOpt('nexenta_user',
- default='admin',
- help='User name to connect to Nexenta SA'),
- cfg.StrOpt('nexenta_password',
- default='nexenta',
- help='Password to connect to Nexenta SA',
- secret=True),
- cfg.IntOpt('nexenta_iscsi_target_portal_port',
- default=3260,
- help='Nexenta target portal port'),
- cfg.StrOpt('nexenta_volume',
- default='cinder',
- help='pool on SA that will hold all volumes'),
- cfg.StrOpt('nexenta_target_prefix',
- default='iqn.1986-03.com.sun:02:cinder-',
- help='IQN prefix for iSCSI targets'),
- cfg.StrOpt('nexenta_target_group_prefix',
- default='cinder/',
- help='prefix for iSCSI target groups on SA'),
- cfg.StrOpt('nexenta_blocksize',
- default='',
- help='block size for volumes (blank=default,8KB)'),
- cfg.BoolOpt('nexenta_sparse',
- default=False,
- help='flag to create sparse volumes'),
- ]
-
CONF = cfg.CONF
- CONF.register_opts(NEXENTA_OPTS)
+ CONF.register_opts(options.NEXENTA_CONNECTION_OPTIONS)
+ CONF.register_opts(options.NEXENTA_ISCSI_OPTIONS)
+ CONF.register_opts(options.NEXENTA_VOLUME_OPTIONS)
class NexentaDriver(driver.ISCSIDriver): # pylint: disable=R0921
backend_name = self.configuration.safe_get('volume_backend_name')
data["volume_backend_name"] = backend_name or self.__class__.__name__
data["vendor_name"] = 'Nexenta'
- data["driver_version"] = VERSION
+ data["driver_version"] = self.VERSION
data["storage_protocol"] = 'iSCSI'
- stats = self.nms.volume.get_child_props(CONF.nexenta_volume,
- 'health|size|used|available')
+ stats = self.nms.volume.get_child_props(
+ self.configuration.nexenta_volume, 'health|size|used|available')
total_unit = stats['size'][-1]
total_amount = float(stats['size'][:-1])
free_unit = stats['available'][-1]