Merge "FalconStor: Restore option "san_secondary_ip""
This commit is contained in:
@@ -237,10 +237,6 @@ class TestFSSISCSIDriver(FSSDriverTestCase):
|
||||
def test_initialized_should_set_fss_info(self):
|
||||
self.assertEqual(self.driver.proxy.fss_host,
|
||||
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.driver.configuration.fss_pool)
|
||||
|
||||
@@ -447,7 +443,7 @@ class TestFSSISCSIDriver(FSSDriverTestCase):
|
||||
mock__check_multipath.retuen_value = 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["multipath"] = True
|
||||
fss_hosts.append(SECONDARY_IP)
|
||||
|
||||
@@ -38,6 +38,10 @@ FSS_OPTS = [
|
||||
cfg.IntOpt('fss_pool',
|
||||
default='',
|
||||
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',
|
||||
default=False,
|
||||
help="Enable HTTP debugging to FSS"),
|
||||
@@ -60,7 +64,7 @@ class FalconstorBaseDriver(san.SanDriver):
|
||||
self.proxy = rest_proxy.RESTProxy(self.configuration)
|
||||
self._backend_name = (
|
||||
self.configuration.safe_get('volume_backend_name') or 'FalconStor')
|
||||
self._storage_protocol = 'iSCSI'
|
||||
self._storage_protocol = ''
|
||||
|
||||
def do_setup(self, context):
|
||||
self.proxy.do_setup()
|
||||
@@ -97,7 +101,7 @@ class FalconstorBaseDriver(san.SanDriver):
|
||||
|
||||
def _check_multipath(self):
|
||||
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.'))
|
||||
raise exception.VolumeBackendAPIException(data=msg)
|
||||
output = self.proxy._check_iocluster_state()
|
||||
@@ -191,7 +195,8 @@ class FalconstorBaseDriver(san.SanDriver):
|
||||
try:
|
||||
self.proxy.delete_vdev(volume)
|
||||
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"),
|
||||
err.reason)
|
||||
|
||||
@@ -207,7 +212,8 @@ class FalconstorBaseDriver(san.SanDriver):
|
||||
try:
|
||||
self.proxy.delete_snapshot(snapshot)
|
||||
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("Snapshot deletion failed with message: %s"),
|
||||
err.reason)
|
||||
@@ -224,7 +230,8 @@ class FalconstorBaseDriver(san.SanDriver):
|
||||
extend_volume_name = self.proxy._get_fss_volume_name(volume)
|
||||
self.proxy.extend_vdev(extend_volume_name, snap_size, vol_size)
|
||||
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(
|
||||
"Resizing %(id)s failed with message: %(msg)s. "
|
||||
"Cleaning volume."), {'id': volume["id"],
|
||||
|
||||
@@ -69,7 +69,7 @@ class FSSISCSIDriver(fss_common.FalconstorBaseDriver,
|
||||
|
||||
if multipath:
|
||||
if self._check_multipath():
|
||||
fss_hosts.append(self.configuration.san_secondary_ip)
|
||||
fss_hosts.append(self.configuration.fss_san_secondary_ip)
|
||||
else:
|
||||
multipath = False
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ from six.moves import http_client
|
||||
from cinder import exception
|
||||
from cinder.i18n import _, _LI, _LW
|
||||
|
||||
|
||||
FSS_BATCH = 'batch'
|
||||
FSS_PHYSICALRESOURCE = 'physicalresource'
|
||||
FSS_PHYSICALADAPTER = 'physicaladapter'
|
||||
@@ -56,7 +55,6 @@ FSS_AUTH = 'auth'
|
||||
FSS_LOGIN = 'login'
|
||||
FSS_SINGLE_TYPE = 'single'
|
||||
|
||||
|
||||
POST = 'POST'
|
||||
GET = 'GET'
|
||||
PUT = 'PUT'
|
||||
@@ -77,17 +75,11 @@ LOG = logging.getLogger(__name__)
|
||||
class RESTProxy(object):
|
||||
def __init__(self, config):
|
||||
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
|
||||
if config.additional_retry_list:
|
||||
RETRY_LIST.append(config.additional_retry_list)
|
||||
|
||||
self.FSS = FSSRestCommon(
|
||||
host=self.fss_host,
|
||||
username=self.fss_username,
|
||||
password=self.fss_password,
|
||||
fss_debug=config.fss_debug)
|
||||
self.FSS = FSSRestCommon(config)
|
||||
self.session_id = None
|
||||
|
||||
# naming
|
||||
@@ -127,7 +119,7 @@ class RESTProxy(object):
|
||||
poolinfo = {}
|
||||
try:
|
||||
output = self.list_pool_info()
|
||||
if "storagepools" in output['data']:
|
||||
if output and "storagepools" in output['data']:
|
||||
for item in output['data']['storagepools']:
|
||||
if item['name'].startswith(GROUP_PREFIX) and (
|
||||
self.fss_defined_pool == item['id']):
|
||||
@@ -359,6 +351,7 @@ class RESTProxy(object):
|
||||
volume_name = self._get_vol_name_from_snap(snapshot)
|
||||
snap_name = snapshot["display_name"]
|
||||
vid = self._get_fss_vid_from_name(volume_name, FSS_SINGLE_TYPE)
|
||||
|
||||
if not vid:
|
||||
msg = _('vid is null. FSS failed to delete snapshot')
|
||||
raise exception.VolumeBackendAPIException(data=msg)
|
||||
@@ -366,6 +359,7 @@ class RESTProxy(object):
|
||||
if ('metadata' in snapshot and 'fss_tm_comment' in
|
||||
snapshot['metadata']):
|
||||
snap_name = snapshot['metadata']['fss_tm_comment']
|
||||
|
||||
if len(snap_name) > 32:
|
||||
snap_name = self._encode_name(snapshot["id"])
|
||||
|
||||
@@ -404,6 +398,8 @@ class RESTProxy(object):
|
||||
if ('metadata' in snapshot) and ('fss_tm_comment'
|
||||
in snapshot['metadata']):
|
||||
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)
|
||||
rawtimestamp = self._get_timestamp(tm_info, snap_name)
|
||||
@@ -934,12 +930,12 @@ class RESTProxy(object):
|
||||
|
||||
|
||||
class FSSRestCommon(object):
|
||||
def __init__(self, host, username, password, fss_debug):
|
||||
self.hostip = host
|
||||
self.username = username
|
||||
self.password = password
|
||||
def __init__(self, config):
|
||||
self.hostip = config.san_ip
|
||||
self.username = config.san_login
|
||||
self.password = config.san_password
|
||||
self.session_id = None
|
||||
self.fss_debug = fss_debug
|
||||
self.fss_debug = config.fss_debug
|
||||
|
||||
def _fss_request(self, method, path, data=None):
|
||||
json_data = None
|
||||
|
||||
Reference in New Issue
Block a user