RE: python-cephclient for Mgr/RESTful plugin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Boris,
     I've created key for admin user and could use the username:password to access to RESTful plugin now.
     There's some interface of ceph-rest-api doesn't exist on RESTful plugin, such as:
        ceph-rest-api: http://host-name:port/api/v0.1/df
     It's used to get df result on ceph.
     How to get the same/similar result in RESTful plugin? There's no "df" endpoint in RESTful plugin which only include below endpoints:
         /config/cluster: GET
         /config/osd: GET, PATCH
         /crush/rule: GET
         /mon: GET
         /osd: GET
        /pool: GET, POST
        /pool/<arg>: DELETE, GET, PATCH
         /request: DELETE, GET, POST
        /request/<arg>: DELETE, GET
        /server: GET
     How to set <arg> for pool & request endpoint? Is there any good reference?

B.R.
Changcheng
   

-----Original Message-----
From: Liu, Changcheng 
Sent: Wednesday, January 16, 2019 10:53 PM
To: Boris Ranto <branto@xxxxxxxxxx>
Cc: ceph-devel <ceph-devel@xxxxxxxxxxxxxxx>
Subject: RE: python-cephclient for Mgr/RESTful plugin

Thanks Boris. I'll use the (user, pwd) to do further work.

-----Original Message-----
From: Boris Ranto [mailto:branto@xxxxxxxxxx]
Sent: Wednesday, January 16, 2019 9:45 PM
To: Liu, Changcheng <changcheng.liu@xxxxxxxxx>
Cc: ceph-devel <ceph-devel@xxxxxxxxxxxxxxx>
Subject: Re: python-cephclient for Mgr/RESTful plugin

Most of the endpoints in the restful module are authenticated (the only exception being the root '/' endpoint). This is by design to forbid access to unauthorized personnel. That means that you always need to send an authenticated request.

You can simplify this by storing the (user, pwd) tuple in a tuple and passing the tuple to the request or writing a simple wrapper function that would do that for you.

Alternatively, you should be able to employ cookies (afaik, that is what a browser does when you authenticate) for this sort of thing but it is probably easier to achieve this by the wrapper or stored tuple in Python.

-boris

On Wed, Jan 16, 2019 at 1:20 PM Liu, Changcheng <changcheng.liu@xxxxxxxxx> wrote:
>
> Hi Boris,
>      I've read below file:
>          1) http://docs.ceph.com/docs/master/mgr/restful/#the-request-endpoint
>          2) https://github.com/ceph/ceph/blob/master/qa/workunits/rest/test_mgr_rest_api.py
>      Do you know how to avoid input password to RESTful plugin to execute monitor commands?
>      I must give user-“admin” and password "24b21975-640e-4880-9334-3fa22c3ab409" to access to RESTful plugin. I want to access to it directly without giving these info.
> [wrsroot@controller-0 usr(keystone_admin)]$ ceph mgr services {
>     "restful": "https://controller-0:5001/";
> }
> [wrsroot@controller-0 usr(keystone_admin)]$ ceph restful list-keys {
>   "admin": "24b21975-640e-4880-9334-3fa22c3ab409"
> }
>
> B.R.
> Changcheng
>
> -----Original Message-----
> From: ceph-devel-owner@xxxxxxxxxxxxxxx 
> [mailto:ceph-devel-owner@xxxxxxxxxxxxxxx] On Behalf Of Boris Ranto
> Sent: Wednesday, January 16, 2019 7:20 PM
> To: Liu, Changcheng <changcheng.liu@xxxxxxxxx>
> Cc: ceph-devel <ceph-devel@xxxxxxxxxxxxxxx>
> Subject: Re: python-cephclient for Mgr/RESTful plugin
>
> Glad to hear that :)
>
> Also, if you are looking into a higher coverage by the restful module, I recommend looking into the /request endpoint as documented, here:
>
> http://docs.ceph.com/docs/master/mgr/restful/#the-request-endpoint
>
> That should allow you to schedule any monitor command but you will need to parse everything yourself and the backwards compatibility is not guaranteed there.
>
> -boris
>
> On Wed, Jan 16, 2019 at 7:18 AM Liu, Changcheng <changcheng.liu@xxxxxxxxx> wrote:
> >
> > Thanks Boris. It's very helpful.
> >
> > -----Original Message-----
> > From: Boris Ranto [mailto:branto@xxxxxxxxxx]
> > Sent: Wednesday, January 16, 2019 12:16 AM
> > To: Liu, Changcheng <changcheng.liu@xxxxxxxxx>
> > Cc: ceph-devel <ceph-devel@xxxxxxxxxxxxxxx>
> > Subject: Re: python-cephclient for Mgr/RESTful plugin
> >
> > I am not aware of any such wrapper but you can look at the qa workunit for the restful module for the tips on how to use it from Python:
> >
> > https://github.com/ceph/ceph/blob/master/qa/workunits/rest/test_mgr_
> > re
> > st_api.py
> >
> > -boris
> >
> > On Mon, Jan 14, 2019 at 8:01 AM Liu, Changcheng <changcheng.liu@xxxxxxxxx> wrote:
> > >
> > > Hi all,
> > >    In Jewel version, there's python-cephclient as below to operate
> > >    ceph-rest-api:
> > >    https://github.com/dmsimard/python-cephclient
> > >
> > >    Does any one know whether there's some similar module to make it
> > >    convenient to call Mgr/RESTful plugin in Mimic version?
> > >
> > > B.R.
> > > Changcheng
>




[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux