From 044f10d8e7cf3321730ec299513e6d7150e85818 Mon Sep 17 00:00:00 2001 From: keystone Date: Mon, 26 Aug 2013 12:38:32 -0700 Subject: [PATCH] Remove deprecated code from Nexenta Exception class Change-Id: I4242fce8b3f10c863d38cd2f81c2aab9fea77e24 --- cinder/volume/drivers/nexenta/__init__.py | 9 ++------- cinder/volume/drivers/nexenta/volume.py | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/cinder/volume/drivers/nexenta/__init__.py b/cinder/volume/drivers/nexenta/__init__.py index 3050df8f6..edf2d8f31 100644 --- a/cinder/volume/drivers/nexenta/__init__.py +++ b/cinder/volume/drivers/nexenta/__init__.py @@ -20,14 +20,9 @@ .. automodule:: nexenta .. moduleauthor:: Yuriy Taraday +.. moduleauthor:: Mikhaik Khodos """ class NexentaException(Exception): - MESSAGE = _('Nexenta SA returned the error') - - def __init__(self, error=None): - super(NexentaException, self).__init__(self.message, error) - - def __str__(self): - return '%s: %s' % self.args + pass diff --git a/cinder/volume/drivers/nexenta/volume.py b/cinder/volume/drivers/nexenta/volume.py index bff9754f6..5d86841d3 100644 --- a/cinder/volume/drivers/nexenta/volume.py +++ b/cinder/volume/drivers/nexenta/volume.py @@ -126,11 +126,11 @@ class NexentaDriver(driver.ISCSIDriver): # pylint: disable=R0921 try: self.nms.zvol.destroy(self._get_zvol_name(volume['name']), '') except nexenta.NexentaException as exc: - if "does not exist" in exc.args[1]: + if "does not exist" in exc.args[0]: LOG.info(_('Volume %s does not exist, it seems it was already ' 'deleted'), volume['name']) return - if "zvol has children" in exc.args[1]: + if "zvol has children" in exc.args[0]: raise exception.VolumeIsBusy(volume_name=volume['name']) raise @@ -205,7 +205,7 @@ class NexentaDriver(driver.ISCSIDriver): # pylint: disable=R0921 snapshot['name']), '') except nexenta.NexentaException as exc: - if "snapshot has dependent clones" in exc.args[1]: + if "snapshot has dependent clones" in exc.args[0]: raise exception.SnapshotIsBusy(snapshot_name=snapshot['name']) else: raise @@ -235,7 +235,7 @@ class NexentaDriver(driver.ISCSIDriver): # pylint: disable=R0921 try: self.nms.iscsitarget.create_target({'target_name': target_name}) except nexenta.NexentaException as exc: - if ensure and 'already configured' in exc.args[1]: + if ensure and 'already configured' in exc.args[0]: target_already_configured = True LOG.exception(_('Ignored target creation error while ensuring ' 'export')) @@ -244,9 +244,9 @@ class NexentaDriver(driver.ISCSIDriver): # pylint: disable=R0921 try: self.nms.stmf.create_targetgroup(target_group_name) except nexenta.NexentaException as exc: - if ((ensure and 'already exists' in exc.args[1]) or + if ((ensure and 'already exists' in exc.args[0]) or (target_already_configured and - 'target must be offline' in exc.args[1])): + 'target must be offline' in exc.args[0])): LOG.exception(_('Ignored target group creation error while ' 'ensuring export')) else: @@ -255,8 +255,8 @@ class NexentaDriver(driver.ISCSIDriver): # pylint: disable=R0921 self.nms.stmf.add_targetgroup_member(target_group_name, target_name) except nexenta.NexentaException as exc: - if ensure and ('already exists' in exc.args[1] or - 'target must be offline' in exc.args[1]): + if ensure and ('already exists' in exc.args[0] or + 'target must be offline' in exc.args[0]): LOG.exception(_('Ignored target group member addition error ' 'while ensuring export')) else: @@ -264,7 +264,7 @@ class NexentaDriver(driver.ISCSIDriver): # pylint: disable=R0921 try: self.nms.scsidisk.create_lu(zvol_name, {}) except nexenta.NexentaException as exc: - if not ensure or 'in use' not in exc.args[1]: + if not ensure or 'in use' not in exc.args[0]: raise LOG.exception(_('Ignored LU creation error while ensuring export')) try: @@ -273,7 +273,7 @@ class NexentaDriver(driver.ISCSIDriver): # pylint: disable=R0921 'lun': '0' }) except nexenta.NexentaException as exc: - if not ensure or 'view entry exists' not in exc.args[1]: + if not ensure or 'view entry exists' not in exc.args[0]: raise LOG.exception(_('Ignored LUN mapping entry addition error while ' 'ensuring export')) -- 2.45.2