All of lore.kernel.org
 help / color / mirror / Atom feed
From: Noah Watkins <noahwatkins@gmail.com>
To: Nick Fisk <nick@fisk.me.uk>
Cc: ceph-devel <ceph-devel@vger.kernel.org>
Subject: Re: Passing LUA script via python rados execute
Date: Thu, 16 Feb 2017 13:00:53 -0800	[thread overview]
Message-ID: <CAB2gnbVXVUiCgBFK2Q4+8N=RVf6KLGjH=_oibb+BJxx0B_FmtA@mail.gmail.com> (raw)
In-Reply-To: <3177d648.AEQAH1DOmSwAAAAAAAAAAF3gdzcAADNJBWwAAAAAAACRXwBYphEb@mailjet.com>

It looks like you might be using a script / example that was written
before the code was merged into Ceph and might be a little out of
date. Use `objclass.register` instead of `cls.register`. There is a
test script at the top of
https://github.com/ceph/ceph/blob/master/src/test/cls_lua/test_cls_lua.cc
that you can use as a reference. If the test programs are installed
you should also have the executable `ceph_test_cls_lua` which will run
the cls_lua unit tests.

On Thu, Feb 16, 2017 at 12:52 PM, Nick Fisk <nick@fisk.me.uk> wrote:
> Hi Noah,
>
> Thanks for the response.
>
> You were right about the need to enable the class in the ceph.conf. I did see that note in the Kraken release notes, but assumed that as the LUA class is in the Ceph source tree now, that it would have been included with all the others in that directory. Anyway slap on the wrist for me not checking that.
>
> However, although that got me a bit further, I'm now getting a read error
>
> rados.IOError: Ioctx.read(rbd): failed to read test
>
> Which is a bit puzzling. As there is definitely an object called test on the rbd pool and if I issue a ioctx.read right before the execute call, it returns successfully with the objects contents. So I'm guessing this is actually the lua class/script bombing out and not a read error?
>
> I also get this error in the OSD log
>
> 2017-02-16 20:41:45.065617 7f08da336700  0 <cls> /tmp/buildd/ceph-11.2.0/src/cls/lua/cls_lua.cc:1004: error: [string "..."]:7: attempt to index a nil value (global 'cls')
>
> Don't know if that rings any bells?
>
> Nick
>
>> -----Original Message-----
>> From: Noah Watkins [mailto:noahwatkins@gmail.com]
>> Sent: 15 February 2017 23:43
>> To: nick@fisk.me.uk
>> Cc: ceph-devel <ceph-devel@vger.kernel.org>
>> Subject: Re: Passing LUA script via python rados execute
>>
>> Hi Nick,
>>
>> First thing to note is that in Kraken that object classes not whitelisted need to
>> be enabled explicitly. This is in the Kraken release notes
>> (http://docs.ceph.com/docs/master/release-notes/):
>>
>> tldr: add 'osd class load list = *' and 'osd class default list = *'
>> to ceph.conf.
>>
>> - The ‘osd class load list’ config option is a list of object class names that the
>> OSD is permitted to load (or ‘*’ for all classes). By default it contains all
>> existing in-tree classes for backwards compatibility.
>>
>> - The ‘osd class default list’ config option is a list of object class names (or ‘*’
>> for all classes) that clients may invoke having only the ‘*’, ‘x’, ‘class-read’, or
>> ‘class-write’ capabilities. By default it contains all existing in-tree classes for
>> backwards compatibility.
>> Invoking classes not listed in ‘osd class default list’ requires a capability
>> naming the class (e.g. ‘allow class foo’).
>>
>> I suspect that will resolve the issue.
>>
>> If you've done that and it still doesn't work then the next thing I'd suggest is
>> creating the target object before running the command.
>> Operations on objects that don't exist sometimes seem non-intuitive to me.
>>
>> Let me know if that doesn't work and we can look at debugging further.
>>
>> Thanks,
>> - Noah
>>
>> On Wed, Feb 15, 2017 at 1:11 PM, Nick Fisk <nick@fisk.me.uk> wrote:
>> > Hi Noah,
>> >
>> > I'm trying to follow your example where you can pass a LUA script as
>> > json when calling the rados execute function in Python. However I'm
>> > getting a rados permission denied error saying its failed to read the
>> > test object I have placed on the pool.
>> >
>> > I have also tried calling the cls_hello object class and this works,
>> > so I believe its something to do with the LUA functionality that's
>> > causing it to bomb out. This is running on Kraken.
>> >
>> > Any ideas would be gratefully received.
>> >
>> > Nick
>> >
>> > Ie
>> > print json.dumps(cmd)
>> > ret, data = ioctx.execute('test', 'lua', 'eval_json', json.dumps(cmd))
>> >
>> > Outputs
>> > python radoslua.py --object-name=test --pool=rbd
>> > {"handler": "upper", "script": "\n      function upper(input, output)\n
>> > input_str = input:str()\n        upper_str = string.upper(input_str)\n
>> > output:append(upper_str)\n      end\n      cls.register(upper)\n  "}
>> > Traceback (most recent call last):
>> >   File "radoslua.py", line 47, in <module>
>> >     ret, data = ioctx.execute('test', 'lua', 'eval_json', json.dumps(cmd))
>> >   File "rados.pyx", line 451, in rados.requires.wrapper.validate_func
>> > (/tmp/buildd/ceph-11.2.0/obj-x86_64-linux-gnu/src/pybind/rados/pyrex/r
>> > ados.c
>> > :4439)
>> >   File "rados.pyx", line 2657, in rados.Ioctx.execute
>> > (/tmp/buildd/ceph-11.2.0/obj-x86_64-linux-gnu/src/pybind/rados/pyrex/r
>> > ados.c
>> > :34056)
>> > rados.PermissionError: Ioctx.read(rbd): failed to read test
>> >
>

  parent reply	other threads:[~2017-02-16 21:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1fa1fa7d.AEEAIBzI4F8AAAAAAAAAAF3gdzcAADNJBWwAAAAAAACRXwBYpMPz@mailjet.com>
     [not found] ` <1fa1fa7d.AEEAIBzI4F8AAAAAAAAAAF3gdzcAADNJBWwAAAAAAACRXwBYpMPz-ImYt9qTNe79BDgjK7y7TUQ@public.gmane.org>
2017-02-15 23:41   ` Passing LUA script via python rados execute Noah Watkins
2017-02-15 23:42 ` Noah Watkins
     [not found]   ` <3177d648.AEQAH1DOmSwAAAAAAAAAAF3gdzcAADNJBWwAAAAAAACRXwBYphEb@mailjet.com>
2017-02-16 21:00     ` Noah Watkins [this message]
     [not found]       ` <1cadb44c.ADsAAGb8C0gAAAAAAAAAAF3gdzcAADNJBWwAAAAAAACRXwBYphQY@mailjet.com>
2017-02-16 22:17         ` Noah Watkins
     [not found]           ` <3a5eb209.AEEAIECau6cAAAAAAAAAAF3gdzcAADNJBWwAAAAAAACRXwBYp3rL@mailjet.com>
     [not found]             ` <3a5eb209.AEEAIECau6cAAAAAAAAAAF3gdzcAADNJBWwAAAAAAACRXwBYp3rL-ImYt9qTNe79BDgjK7y7TUQ@public.gmane.org>
2017-02-18 19:55               ` Noah Watkins
     [not found]                 ` <CAB2gnbWXWcj=O1LKKMGCn2X6h_T46x9Ypaupy2u7wQHdBV2CJA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-18 22:39                   ` Nick Fisk
     [not found]                 ` <5ad9bb93.AEQAH3DlQ6gAAAAAAAAAAF3gdzcAADNJBWwAAAAAAACRXwBYqM0y@mailjet.com>
2017-02-18 23:58                   ` Noah Watkins
2017-02-19 20:15                 ` Patrick Donnelly
2017-02-20  8:43                   ` Josh Durgin
     [not found]                     ` <10499347-8c11-83fb-9778-e95049668c6c-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-02-21 21:45                       ` Nick Fisk
     [not found]                     ` <c36e222c.AEEAIIaNAn4AAAAAAAAAAF3gdzkAADNJBWwAAAAAAACRXwBYrLT9@mailjet.com>
2017-02-21 21:59                       ` Patrick Donnelly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAB2gnbVXVUiCgBFK2Q4+8N=RVf6KLGjH=_oibb+BJxx0B_FmtA@mail.gmail.com' \
    --to=noahwatkins@gmail.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=nick@fisk.me.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.