**** CubicPower OpenStack Study ****
def make_pretty_name(method):
    """Makes a pretty name for a function/method."""
    meth_pieces = [method.__name__]
    # If its an instance method attempt to tack on the class name
    if hasattr(method, '__self__') and method.__self__ is not None:
        try:
            meth_pieces.insert(0, method.__self__.__class__.__name__)
        except AttributeError:
            pass
    return ".".join(meth_pieces)
**** CubicPower OpenStack Study ****
def restore_source_status(context, db, volume_spec):
    # NOTE(harlowja): Only if the type of the volume that was being created is
    # the source volume type should we try to reset the source volume status
    # back to its original value.
    if not volume_spec or volume_spec.get('type') != 'source_vol':
        return
    source_volid = volume_spec['source_volid']
    source_status = volume_spec['source_volstatus']
    try:
        LOG.debug(_('Restoring source %(source_volid)s status to %(status)s') %
                  {'status': source_status, 'source_volid': source_volid})
        db.volume_update(context, source_volid, {'status': source_status})
    except exception.CinderException:
        # NOTE(harlowja): Don't let this cause further exceptions since this is
        # a non-critical failure.
        LOG.exception(_("Failed setting source volume %(source_volid)s back to"
                        " its initial %(source_status)s status") %
                      {'source_status': source_status,
                       'source_volid': source_volid})
**** CubicPower OpenStack Study ****
def error_out_volume(context, db, volume_id, reason=None):
    def _clean_reason(reason):
        if reason is None:
            return '???'
        reason = six.text_type(reason)
        if len(reason) <= REASON_LENGTH:
            return reason
        else:
            return reason[0:REASON_LENGTH] + '...'
    update = {
        'status': 'error',
    }
    reason = _clean_reason(reason)
    # TODO(harlowja): re-enable when we can support this in the database.
    # if reason:
    #     status['details'] = reason
    try:
        LOG.debug(_('Updating volume: %(volume_id)s with %(update)s'
                    ' due to: %(reason)s') % {'volume_id': volume_id,
                                              'reason': reason,
                                              'update': update})
        db.volume_update(context, volume_id, update)
    except exception.CinderException:
        # Don't let this cause further exceptions.
        LOG.exception(_("Failed updating volume %(volume_id)s with"
                        " %(update)s") % {'volume_id': volume_id,
                                          'update': update})