from cinder.openstack.common import excutils
from cinder.openstack.common import log as logging
from cinder import utils
-from cinder.volume.driver import ISCSIDriver
+from cinder.volume import driver
LOG = logging.getLogger(__name__)
CONF.register_opts(san_opts)
-class SanISCSIDriver(ISCSIDriver):
+class SanDriver(driver.VolumeDriver):
"""Base class for SAN-style storage volumes
A SAN-style storage value is 'different' because the volume controller
"""
def __init__(self, *args, **kwargs):
- super(SanISCSIDriver, self).__init__(*args, **kwargs)
+ execute = kwargs.pop('execute', self.san_execute)
+ super(SanDriver, self).__init__(execute=execute,
+ *args, **kwargs)
self.configuration.append_config_values(san_opts)
self.run_local = self.configuration.san_is_local
self.sshpool = None
- def _build_iscsi_target_name(self, volume):
- return "%s%s" % (self.configuration.iscsi_target_prefix,
- volume['name'])
-
- def _execute(self, *cmd, **kwargs):
+ def san_execute(self, *cmd, **kwargs):
if self.run_local:
return utils.execute(*cmd, **kwargs)
else:
if not self.configuration.san_ip:
raise exception.InvalidInput(reason=_("san_ip must be set"))
- def create_cloned_volume(self, volume, src_vref):
- """Create a cloen of the specified volume."""
- raise NotImplementedError()
+
+class SanISCSIDriver(SanDriver, driver.ISCSIDriver):
+ def __init__(self, *args, **kwargs):
+ super(SanISCSIDriver, self).__init__(*args, **kwargs)
+
+ def _build_iscsi_target_name(self, volume):
+ return "%s%s" % (self.configuration.iscsi_target_prefix,
+ volume['name'])
Also make sure you can login using san_login & san_password/san_private_key
"""
def __init__(self, *cmd, **kwargs):
- super(SolarisISCSIDriver, self).__init__(*cmd,
- execute=self._execute,
- **kwargs)
+ super(SolarisISCSIDriver, self).__init__(execute=self.solaris_execute,
+ *cmd, **kwargs)
self.configuration.append_config_values(solaris_opts)
- def _execute(self, *cmd, **kwargs):
+ def solaris_execute(self, *cmd, **kwargs):
new_cmd = ['pfexec']
new_cmd.extend(cmd)
return super(SolarisISCSIDriver, self)._execute(*new_cmd,
CONF.register_opts(storwize_svc_opts)
-class StorwizeSVCDriver(san.SanISCSIDriver):
+class StorwizeSVCDriver(san.SanDriver):
"""IBM Storwize V7000 and SVC iSCSI/FC volume driver.
Version history:
src_id=src_volume['id'],
from_vol=True)
- def copy_image_to_volume(self, context, volume, image_service, image_id):
- opts = self._get_vdisk_params(volume['volume_type_id'])
- if opts['protocol'] == 'iSCSI':
- # Implemented in base iSCSI class
- return super(StorwizeSVCDriver, self).copy_image_to_volume(
- context, volume, image_service, image_id)
- else:
- raise NotImplementedError()
-
- def copy_volume_to_image(self, context, volume, image_service, image_meta):
- opts = self._get_vdisk_params(volume['volume_type_id'])
- if opts['protocol'] == 'iSCSI':
- # Implemented in base iSCSI class
- return super(StorwizeSVCDriver, self).copy_volume_to_image(
- context, volume, image_service, image_meta)
- else:
- raise NotImplementedError()
-
def extend_volume(self, volume, new_size):
LOG.debug(_('enter: extend_volume: volume %s') % volume['id'])
ret = self._ensure_vdisk_no_fc_mappings(volume['name'],