@require_admin_context
def volume_attached(context, volume_id, instance_uuid, mountpoint):
if not uuidutils.is_uuid_like(instance_uuid):
- raise exception.InvalidUUID(instance_uuid)
+ raise exception.InvalidUUID(uuid=instance_uuid)
session = get_session()
with session.begin():
location = self._do_iscsi_discovery(volume)
if not location:
- raise exception.InvalidVolume(_("Could not find iSCSI export "
- " for volume %s") %
- (volume['name']))
+ msg = (_("Could not find iSCSI export for volume %s") %
+ (volume['name']))
+ raise exception.InvalidVolume(reason=msg)
LOG.debug(_("ISCSI Discovery: Found %s") % (location))
properties['target_discovered'] = True
self.nms.zvol.destroy(self._get_zvol_name(volume['name']), '')
except nexenta.NexentaException as exc:
if "zvol has children" in exc.args[1]:
- raise exception.VolumeIsBusy
+ raise exception.VolumeIsBusy(volume_name=volume['name'])
else:
raise
'')
except nexenta.NexentaException as exc:
if "snapshot has dependent clones" in exc.args[1]:
- raise exception.SnapshotIsBusy
+ raise exception.SnapshotIsBusy(snapshot_name=snapshot['name'])
else:
raise
def _parse_location(self, location):
prefix = 'rbd://'
if not location.startswith(prefix):
- reason = _('Image %s is not stored in rbd') % location
- raise exception.ImageUnacceptable(reason)
+ reason = _('Not stored in rbd')
+ raise exception.ImageUnacceptable(image_id=location, reason=reason)
pieces = map(urllib.unquote, location[len(prefix):].split('/'))
if any(map(lambda p: p == '', pieces)):
- reason = _('Image %s has blank components') % location
- raise exception.ImageUnacceptable(reason)
+ reason = _('Blank components')
+ raise exception.ImageUnacceptable(image_id=location, reason=reason)
if len(pieces) != 4:
- reason = _('Image %s is not an rbd snapshot') % location
- raise exception.ImageUnacceptable(reason)
+ reason = _('Not an rbd snapshot')
+ raise exception.ImageUnacceptable(image_id=location, reason=reason)
return pieces
def _get_fsid(self):
# TODO(vish): refactor this into a more general "reserve"
# TODO(sleepsonthefloor): Is this 'elevated' appropriate?
if not uuidutils.is_uuid_like(instance_uuid):
- raise exception.InvalidUUID(instance_uuid)
+ raise exception.InvalidUUID(uuid=instance_uuid)
try:
self.driver.attach_volume(context,