Merge "FalconStor: Restore option "san_secondary_ip""

This commit is contained in:
Jenkins
2017-01-24 14:19:02 +00:00
committed by Gerrit Code Review
4 changed files with 25 additions and 26 deletions

View File

@@ -237,10 +237,6 @@ class TestFSSISCSIDriver(FSSDriverTestCase):
def test_initialized_should_set_fss_info(self): def test_initialized_should_set_fss_info(self):
self.assertEqual(self.driver.proxy.fss_host, self.assertEqual(self.driver.proxy.fss_host,
self.driver.configuration.san_ip) self.driver.configuration.san_ip)
self.assertEqual(self.driver.proxy.fss_username,
self.driver.configuration.san_login)
self.assertEqual(self.driver.proxy.fss_password,
self.driver.configuration.san_password)
self.assertEqual(self.driver.proxy.fss_defined_pool, self.assertEqual(self.driver.proxy.fss_defined_pool,
self.driver.configuration.fss_pool) self.driver.configuration.fss_pool)
@@ -447,7 +443,7 @@ class TestFSSISCSIDriver(FSSDriverTestCase):
mock__check_multipath.retuen_value = True mock__check_multipath.retuen_value = True
self.mock_config.use_multipath_for_image_xfer = True self.mock_config.use_multipath_for_image_xfer = True
self.mock_config.san_secondary_ip = SECONDARY_IP self.mock_config.fss_san_secondary_ip = SECONDARY_IP
multipath_connector = deepcopy(ISCSI_CONNECTOR) multipath_connector = deepcopy(ISCSI_CONNECTOR)
multipath_connector["multipath"] = True multipath_connector["multipath"] = True
fss_hosts.append(SECONDARY_IP) fss_hosts.append(SECONDARY_IP)

View File

@@ -38,6 +38,10 @@ FSS_OPTS = [
cfg.IntOpt('fss_pool', cfg.IntOpt('fss_pool',
default='', default='',
help='FSS pool id in which FalconStor volumes are stored.'), help='FSS pool id in which FalconStor volumes are stored.'),
cfg.StrOpt('fss_san_secondary_ip',
default='',
help='Specifies FSS secondary management IP to be used '
'if san_ip is invalid or becomes inaccessible.'),
cfg.BoolOpt('fss_debug', cfg.BoolOpt('fss_debug',
default=False, default=False,
help="Enable HTTP debugging to FSS"), help="Enable HTTP debugging to FSS"),
@@ -60,7 +64,7 @@ class FalconstorBaseDriver(san.SanDriver):
self.proxy = rest_proxy.RESTProxy(self.configuration) self.proxy = rest_proxy.RESTProxy(self.configuration)
self._backend_name = ( self._backend_name = (
self.configuration.safe_get('volume_backend_name') or 'FalconStor') self.configuration.safe_get('volume_backend_name') or 'FalconStor')
self._storage_protocol = 'iSCSI' self._storage_protocol = ''
def do_setup(self, context): def do_setup(self, context):
self.proxy.do_setup() self.proxy.do_setup()
@@ -97,7 +101,7 @@ class FalconstorBaseDriver(san.SanDriver):
def _check_multipath(self): def _check_multipath(self):
if self.configuration.use_multipath_for_image_xfer: if self.configuration.use_multipath_for_image_xfer:
if not self.configuration.san_secondary_ip: if not self.configuration.fss_san_secondary_ip:
msg = (_('The san_secondary_ip param is null.')) msg = (_('The san_secondary_ip param is null.'))
raise exception.VolumeBackendAPIException(data=msg) raise exception.VolumeBackendAPIException(data=msg)
output = self.proxy._check_iocluster_state() output = self.proxy._check_iocluster_state()
@@ -191,7 +195,8 @@ class FalconstorBaseDriver(san.SanDriver):
try: try:
self.proxy.delete_vdev(volume) self.proxy.delete_vdev(volume)
except rest_proxy.FSSHTTPError as err: except rest_proxy.FSSHTTPError as err:
with excutils.save_and_reraise_exception(reraise=False): with excutils.save_and_reraise_exception() as ctxt:
ctxt.reraise = False
LOG.warning(_LW("Volume deletion failed with message: %s"), LOG.warning(_LW("Volume deletion failed with message: %s"),
err.reason) err.reason)
@@ -207,7 +212,8 @@ class FalconstorBaseDriver(san.SanDriver):
try: try:
self.proxy.delete_snapshot(snapshot) self.proxy.delete_snapshot(snapshot)
except rest_proxy.FSSHTTPError as err: except rest_proxy.FSSHTTPError as err:
with excutils.save_and_reraise_exception(reraise=False): with excutils.save_and_reraise_exception() as ctxt:
ctxt.reraise = False
LOG.error( LOG.error(
_LE("Snapshot deletion failed with message: %s"), _LE("Snapshot deletion failed with message: %s"),
err.reason) err.reason)
@@ -224,7 +230,8 @@ class FalconstorBaseDriver(san.SanDriver):
extend_volume_name = self.proxy._get_fss_volume_name(volume) extend_volume_name = self.proxy._get_fss_volume_name(volume)
self.proxy.extend_vdev(extend_volume_name, snap_size, vol_size) self.proxy.extend_vdev(extend_volume_name, snap_size, vol_size)
except rest_proxy.FSSHTTPError as err: except rest_proxy.FSSHTTPError as err:
with excutils.save_and_reraise_exception(reraise=False): with excutils.save_and_reraise_exception() as ctxt:
ctxt.reraise = False
LOG.error(_LE( LOG.error(_LE(
"Resizing %(id)s failed with message: %(msg)s. " "Resizing %(id)s failed with message: %(msg)s. "
"Cleaning volume."), {'id': volume["id"], "Cleaning volume."), {'id': volume["id"],

View File

@@ -69,7 +69,7 @@ class FSSISCSIDriver(fss_common.FalconstorBaseDriver,
if multipath: if multipath:
if self._check_multipath(): if self._check_multipath():
fss_hosts.append(self.configuration.san_secondary_ip) fss_hosts.append(self.configuration.fss_san_secondary_ip)
else: else:
multipath = False multipath = False

View File

@@ -27,7 +27,6 @@ from six.moves import http_client
from cinder import exception from cinder import exception
from cinder.i18n import _, _LI, _LW from cinder.i18n import _, _LI, _LW
FSS_BATCH = 'batch' FSS_BATCH = 'batch'
FSS_PHYSICALRESOURCE = 'physicalresource' FSS_PHYSICALRESOURCE = 'physicalresource'
FSS_PHYSICALADAPTER = 'physicaladapter' FSS_PHYSICALADAPTER = 'physicaladapter'
@@ -56,7 +55,6 @@ FSS_AUTH = 'auth'
FSS_LOGIN = 'login' FSS_LOGIN = 'login'
FSS_SINGLE_TYPE = 'single' FSS_SINGLE_TYPE = 'single'
POST = 'POST' POST = 'POST'
GET = 'GET' GET = 'GET'
PUT = 'PUT' PUT = 'PUT'
@@ -77,17 +75,11 @@ LOG = logging.getLogger(__name__)
class RESTProxy(object): class RESTProxy(object):
def __init__(self, config): def __init__(self, config):
self.fss_host = config.san_ip self.fss_host = config.san_ip
self.fss_username = config.san_login
self.fss_password = config.san_password
self.fss_defined_pool = config.fss_pool self.fss_defined_pool = config.fss_pool
if config.additional_retry_list: if config.additional_retry_list:
RETRY_LIST.append(config.additional_retry_list) RETRY_LIST.append(config.additional_retry_list)
self.FSS = FSSRestCommon( self.FSS = FSSRestCommon(config)
host=self.fss_host,
username=self.fss_username,
password=self.fss_password,
fss_debug=config.fss_debug)
self.session_id = None self.session_id = None
# naming # naming
@@ -127,7 +119,7 @@ class RESTProxy(object):
poolinfo = {} poolinfo = {}
try: try:
output = self.list_pool_info() output = self.list_pool_info()
if "storagepools" in output['data']: if output and "storagepools" in output['data']:
for item in output['data']['storagepools']: for item in output['data']['storagepools']:
if item['name'].startswith(GROUP_PREFIX) and ( if item['name'].startswith(GROUP_PREFIX) and (
self.fss_defined_pool == item['id']): self.fss_defined_pool == item['id']):
@@ -359,6 +351,7 @@ class RESTProxy(object):
volume_name = self._get_vol_name_from_snap(snapshot) volume_name = self._get_vol_name_from_snap(snapshot)
snap_name = snapshot["display_name"] snap_name = snapshot["display_name"]
vid = self._get_fss_vid_from_name(volume_name, FSS_SINGLE_TYPE) vid = self._get_fss_vid_from_name(volume_name, FSS_SINGLE_TYPE)
if not vid: if not vid:
msg = _('vid is null. FSS failed to delete snapshot') msg = _('vid is null. FSS failed to delete snapshot')
raise exception.VolumeBackendAPIException(data=msg) raise exception.VolumeBackendAPIException(data=msg)
@@ -366,6 +359,7 @@ class RESTProxy(object):
if ('metadata' in snapshot and 'fss_tm_comment' in if ('metadata' in snapshot and 'fss_tm_comment' in
snapshot['metadata']): snapshot['metadata']):
snap_name = snapshot['metadata']['fss_tm_comment'] snap_name = snapshot['metadata']['fss_tm_comment']
if len(snap_name) > 32: if len(snap_name) > 32:
snap_name = self._encode_name(snapshot["id"]) snap_name = self._encode_name(snapshot["id"])
@@ -404,6 +398,8 @@ class RESTProxy(object):
if ('metadata' in snapshot) and ('fss_tm_comment' if ('metadata' in snapshot) and ('fss_tm_comment'
in snapshot['metadata']): in snapshot['metadata']):
snap_name = snapshot['metadata']['fss_tm_comment'] snap_name = snapshot['metadata']['fss_tm_comment']
if len(snap_name) > 32:
snap_name = self._encode_name(snapshot["id"])
tm_info = self.FSS.get_timemark(vid) tm_info = self.FSS.get_timemark(vid)
rawtimestamp = self._get_timestamp(tm_info, snap_name) rawtimestamp = self._get_timestamp(tm_info, snap_name)
@@ -934,12 +930,12 @@ class RESTProxy(object):
class FSSRestCommon(object): class FSSRestCommon(object):
def __init__(self, host, username, password, fss_debug): def __init__(self, config):
self.hostip = host self.hostip = config.san_ip
self.username = username self.username = config.san_login
self.password = password self.password = config.san_password
self.session_id = None self.session_id = None
self.fss_debug = fss_debug self.fss_debug = config.fss_debug
def _fss_request(self, method, path, data=None): def _fss_request(self, method, path, data=None):
json_data = None json_data = None