def _update_volume_from_src(self, context, vol, update, group=None):
    try:
        snapshot_id = vol.get('snapshot_id')
        if snapshot_id:
            snapshot = objects.Snapshot.get_by_id(context, snapshot_id)
            orig_vref = self.db.volume_get(context, snapshot.volume_id)
            if orig_vref.bootable:
                update['bootable'] = True
                self.db.volume_glance_metadata_copy_to_volume(context, vol['id'], snapshot_id)
    except exception.SnapshotNotFound:
        LOG.error(_LE('Source snapshot %(snapshot_id)s cannot be found.'), {'snapshot_id': vol['snapshot_id']})
        self.db.volume_update(context, vol['id'], {'status': 'error'})
        if group:
            group.status = 'error'
            group.save()
        raise
    except exception.VolumeNotFound:
        LOG.error(_LE('The source volume %(volume_id)s cannot be found.'), {'volume_id': snapshot.volume_id})
        self.db.volume_update(context, vol['id'], {'status': 'error'})
        if group:
            group.status = 'error'
            group.save()
        raise
    except exception.CinderException as ex:
        LOG.error(_LE('Failed to update %(volume_id)s metadata using the provided snapshot %(snapshot_id)s metadata.'), {'volume_id': vol['id'], 'snapshot_id': vol['snapshot_id']})
        self.db.volume_update(context, vol['id'], {'status': 'error'})
        if group:
            group.status = 'error'
            group.save()
        raise exception.MetadataCopyFailure(reason=six.text_type(ex))
    self.db.volume_update(context, vol['id'], update)
def _update_volume_from_src(self, context, vol, update, group=None):
    try:
        snapshot_id = vol.get('snapshot_id')
        if snapshot_id:
            snapshot = objects.Snapshot.get_by_id(context, snapshot_id)
            orig_vref = self.db.volume_get(context, snapshot.volume_id)
            if orig_vref.bootable:
                update['bootable'] = True
                self.db.volume_glance_metadata_copy_to_volume(context, vol['id'], snapshot_id)
    except exception.SnapshotNotFound:
        LOG.error(_LE('Source snapshot %(snapshot_id)s cannot be found.'), {'snapshot_id': vol['snapshot_id']})
        self.db.volume_update(context, vol['id'], {'status': 'error'})
        if group:
            group.status = 'error'
            group.save()
        raise
    except exception.VolumeNotFound:
        LOG.error(_LE('The source volume %(volume_id)s cannot be found.'), {'volume_id': snapshot.volume_id})
        self.db.volume_update(context, vol['id'], {'status': 'error'})
        if group:
            group.status = 'error'
            group.save()
        raise
    except exception.CinderException as ex:
        LOG.error(_LE('Failed to update %(volume_id)s metadata using the provided snapshot %(snapshot_id)s metadata.'), {'volume_id': vol['id'], 'snapshot_id': vol['snapshot_id']})
        self.db.volume_update(context, vol['id'], {'status': 'error'})
        if group:
            group.status = 'error'
            group.save()
        raise exception.MetadataCopyFailure(reason=six.text_type(ex))
    self.db.volume_update(context, vol['id'], update)