# ####### Interface methods for DataPath (Target Driver) ########
def ensure_export(self, context, volume):
- volume_name = volume['name']
volume_path = "/dev/%s/%s" % (self.configuration.volume_group,
- volume_name)
+ volume['name'])
model_update = \
- self.target_driver.ensure_export(context,
- volume,
- volume_path=volume_path)
+ self.target_driver.ensure_export(
+ context,
+ volume,
+ volume_path)
return model_update
def create_export(self, context, volume):
# ####### Interface methods for DataPath (Target Driver) ########
def ensure_export(self, context, volume):
+ volume_path = self.local_path(volume)
return self.target_driver.ensure_export(
context,
volume,
- volume_path=self.local_path(volume))
+ volume_path)
def create_export(self, context, volume):
+ volume_path = self.local_path(volume),
export_info = self.target_driver.create_export(
context,
- volume, volume_path=self.local_path(volume))
+ volume,
+ volume_path)
+
return {'provider_location': export_info['location'],
'provider_auth': export_info['auth'], }
# ####### Interface methods for DataPath (Target Driver) ########
def ensure_export(self, context, volume):
- volume_name = volume['name']
volume_path = "/dev/%s/%s" % (self.configuration.volume_group,
- volume_name)
+ volume['name'])
+
model_update = \
- self.target_driver.ensure_export(context,
- volume,
- volume_path=volume_path)
+ self.target_driver.ensure_export(context, volume, volume_path)
return model_update
def create_export(self, context, volume, vg=None):
vg = self.configuration.volume_group
volume_path = "/dev/%s/%s" % (vg, volume['name'])
- export_info = self.target_driver.create_export(context,
- volume,
- volume_path)
+
+ export_info = self.target_driver.create_export(
+ context,
+ volume,
+ volume_path)
return {'provider_location': export_info['location'],
'provider_auth': export_info['auth'], }
self.target_driver.set_execute(execute)
def ensure_export(self, context, volume):
- volume_name = volume['name']
- iscsi_name = "%s%s" % (self.configuration.iscsi_target_prefix,
- volume_name)
device_path = self._mapper_path(volume)
- # NOTE(jdg): For TgtAdm case iscsi_name is the ONLY param we need
- # should clean this all up at some point in the future
- model_update = self.target_driver.ensure_export(
- context, volume,
- iscsi_name,
- device_path,
- None,
- self.configuration)
+
+ model_update = self.target_driver.ensure_export(context,
+ volume,
+ device_path)
if model_update:
self.db.volume_update(context, volume['id'], model_update)
data = self.target_driver.create_export(context,
volume,
- volume_path,
- self.configuration)
+ volume_path)
return {
'provider_location': data['location'],
'provider_auth': data['auth'],
CONF.rootwrap_config)
@abc.abstractmethod
- def ensure_export(self, context, volume,
- iscsi_name, volume_path,
- volume_group, config):
+ def ensure_export(self, context, volume, volume_path):
"""Synchronously recreates an export for a volume."""
pass
def __init__(self, *args, **kwargs):
super(FakeTarget, self).__init__(*args, **kwargs)
- def ensure_export(self, context, volume,
- iscsi_name, volume_path,
- volume_group, config):
+ def ensure_export(self, context, volume, volume_path):
pass
def create_export(self, context, volume, volume_path):
def __init__(self, *args, **kwargs):
super(IetAdm, self).__init__(*args, **kwargs)
- def ensure_export(self, context, volume,
- iscsi_name, volume_path,
- volume_group, config):
+ def ensure_export(self, context, volume, volume_path):
pass
def create_export(self, context, volume, volume_path):
<target %s>
driver iser
backing-store %s
+ write_cache %s
</target>
"""
VOLUME_CONF_WITH_CHAP_AUTH = """
driver iser
backing-store %s
%s
+ write_cache %s
</target>
"""
self.remove_iscsi_target(iscsi_target, 0, volume['id'], volume['name'])
- def ensure_export(self, context, volume,
- iscsi_name, volume_path,
- volume_group, config):
+ def ensure_export(self, context, volume, volume_path):
try:
volume_info = self.db.volume_get(context, volume['id'])
(auth_method,
"provision for volume: %s"), volume['id'])
iscsi_target = 1
-
+ iscsi_name = "%s%s" % (self.configuration.iscsi_target_prefix,
+ volume['name'])
self.create_iscsi_target(iscsi_name, iscsi_target, 0, volume_path,
chap_auth, check_exit_code=False)
LOG.debug('Failed to find CHAP auth from config for %s' % vol_id)
return None
- def ensure_export(self, context, volume,
- iscsi_name, volume_path,
- volume_group, config):
+ def ensure_export(self, context, volume, volume_path):
chap_auth = None
old_name = None
iscsi_name = "%s%s" % (self.configuration.iscsi_target_prefix,
volume['name'])
+ iscsi_write_cache = self.configuration.get('iscsi_write_cache', 'on')
self.create_iscsi_target(
iscsi_name,
1, 0, volume_path,
chap_auth, check_exit_code=False,
- old_name=old_name)
+ old_name=old_name,
+ iscsi_write_cache=iscsi_write_cache)
def create_iscsi_target(self, name, tid, lun, path,
chap_auth=None, **kwargs):
fileutils.ensure_tree(self.volumes_dir)
vol_id = name.split(':')[1]
- write_cache = kwargs.get('write_cache', 'on')
+ write_cache = kwargs.get('iscsi_write_cache', 'on')
if chap_auth is None:
volume_conf = self.VOLUME_CONF % (name, path, write_cache)
else:
chap_password)
# NOTE(jdg): For TgtAdm case iscsi_name is the ONLY param we need
# should clean this all up at some point in the future
+ iscsi_write_cache = self.configuration.get('iscsi_write_cache', 'on')
tid = self.create_iscsi_target(iscsi_name,
iscsi_target,
0,
volume_path,
- chap_auth)
+ chap_auth,
+ iscsi_write_cache=iscsi_write_cache)
data = {}
data['location'] = self._iscsi_location(
self.configuration.iscsi_ip_address, tid, iscsi_name, lun)