'Get extra specs from a volume.'

def _get_volume_extra_specs(self, volume):

    extra_specs = {}
    type_id = volume.get('volume_type_id', None)
    if (type_id is not None):
        ctxt = context.get_admin_context()
        volume_type = volume_types.get_volume_type(ctxt, type_id)
        extra_specs = volume_type.get('extra_specs')
    return extra_specs
