class ISERTargetRemoveFailed(BrickException):
message = _("Failed to remove iser target for volume %(volume_id)s.")
+
+
+class VolumeGroupNotFound(BrickException):
+ message = _('Unable to find Volume Group: %(vg_name)s')
+
+
+class VolumeGroupCreationFailed(BrickException):
+ message = _('Failed to create Volume Group: %(vg_name)s')
+
+
+class ISCSITargetCreateFailed(BrickException):
+ message = _("Failed to create iscsi target for volume %(volume_id)s.")
+
+
+class ISCSITargetRemoveFailed(BrickException):
+ message = _("Failed to remove iscsi target for volume %(volume_id)s.")
+
+
+class ISCSITargetAttachFailed(BrickException):
+ message = _("Failed to attach iSCSI target for volume %(volume_id)s.")
from oslo.config import cfg
-from cinder import exception
+from cinder.brick import exception
from cinder.openstack.common import fileutils
from cinder.openstack.common import log as logging
from cinder.openstack.common import processutils as putils
'--update',
name,
run_as_root=True)
- except exception.ProcessExecutionError as e:
+ except putils.ProcessExecutionError as e:
LOG.error(_("Failed to create iscsi target for volume "
"id:%(vol_id)s: %(e)s")
% {'vol_id': vol_id, 'e': str(e)})
'--delete',
iqn,
run_as_root=True)
- except exception.ProcessExecutionError as e:
+ except putils.ProcessExecutionError as e:
LOG.error(_("Failed to remove iscsi target for volume "
"id:%(vol_id)s: %(e)s")
% {'vol_id': vol_id, 'e': str(e)})
f = open(conf_file, 'a+')
f.write(volume_conf)
f.close()
- except exception.ProcessExecutionError as e:
+ except putils.ProcessExecutionError as e:
vol_id = name.split(':')[1]
LOG.error(_("Failed to create iscsi target for volume "
"id:%(vol_id)s: %(e)s")
try:
self._execute('rtstool', 'verify')
- except (OSError, exception.ProcessExecutionError):
+ except (OSError, putils.ProcessExecutionError):
LOG.error(_('rtstool is not installed correctly'))
raise
if extra_args != []:
command_args += extra_args
self._execute(*command_args, run_as_root=True)
- except exception.ProcessExecutionError as e:
+ except putils.ProcessExecutionError as e:
LOG.error(_("Failed to create iscsi target for volume "
"id:%s.") % vol_id)
LOG.error("%s" % str(e))
'delete',
iqn,
run_as_root=True)
- except exception.ProcessExecutionError as e:
+ except putils.ProcessExecutionError as e:
LOG.error(_("Failed to remove iscsi target for volume "
"id:%s.") % vol_id)
LOG.error("%s" % str(e))
auth_pass,
connector['initiator'],
run_as_root=True)
- except exception.ProcessExecutionError as e:
+ except putils.ProcessExecutionError as e:
LOG.error(_("Failed to add initiator iqn %s to target") %
connector['initiator'])
raise exception.ISCSITargetAttachFailed(volume_id=volume['id'])
from itertools import izip
+from cinder.brick import exception
from cinder.openstack.common.gettextutils import _
from cinder.openstack.common import log as logging
from cinder.openstack.common import processutils as putils
LOG = logging.getLogger(__name__)
-class VolumeGroupNotFound(Exception):
- def __init__(self, vg_name):
- message = (_('Unable to find Volume Group: %s') % vg_name)
- super(VolumeGroupNotFound, self).__init__(message)
-
-
-class VolumeGroupCreationFailed(Exception):
- def __init__(self, vg_name):
- message = (_('Failed to create Volume Group: %s') % vg_name)
- super(VolumeGroupCreationFailed, self).__init__(message)
-
-
class LVM(object):
"""LVM object to enable various LVM related operations."""
LOG.error(_('Cmd :%s') % err.cmd)
LOG.error(_('StdOut :%s') % err.stdout)
LOG.error(_('StdErr :%s') % err.stderr)
- raise VolumeGroupCreationFailed(vg_name=self.vg_name)
+ raise exception.VolumeGroupCreationFailed(vg_name=self.vg_name)
if self._vg_exists() is False:
LOG.error(_('Unable to locate Volume Group %s') % vg_name)
- raise VolumeGroupNotFound(vg_name=vg_name)
+ raise exception.VolumeGroupNotFound(vg_name=vg_name)
if lvm_type == 'thin':
pool_name = "%s-pool" % self.vg_name
if len(vg_list) != 1:
LOG.error(_('Unable to find VG: %s') % self.vg_name)
- raise VolumeGroupNotFound(vg_name=self.vg_name)
+ raise exception.VolumeGroupNotFound(vg_name=self.vg_name)
self.vg_size = vg_list[0]['size']
self.vg_free_space = vg_list[0]['available']
message = _("No target id found for volume %(volume_id)s.")
-class ISCSITargetCreateFailed(CinderException):
- message = _("Failed to create iscsi target for volume %(volume_id)s.")
-
-
-class ISCSITargetAttachFailed(CinderException):
- message = _("Failed to attach iSCSI target for volume %(volume_id)s.")
-
-
-class ISCSITargetRemoveFailed(CinderException):
- message = _("Failed to remove iscsi target for volume %(volume_id)s.")
-
-
class DiskNotFound(NotFound):
message = _("No disk at %(location)s")