Re: LibCephFS Python Mount Failure

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

 



It looks like you’re setting environment variables that force your new
keyring,  it you aren’t telling the library to use your new CephX user. So
it opens your new keyring and looks for the default (client.admin) user and
doesn’t get anything.
-Greg

On Tue, Jul 26, 2022 at 7:54 AM Adam Carrgilson (NBI) <
Adam.Carrgilson@xxxxxxxxx> wrote:

> I've disabled the part of the script that catches the Python exception and
> allowed it to print everything out and it looks like the OSError with the
> code 13, is a permissions error:
>
> Traceback (most recent call last):
>   File "./get-ceph-quota-statistics.py", line 274, in <module>
>     main(args)
>   File "./get-ceph-quota-statistics.py", line 30, in main
>     cephfs = login() # holds CephFS bindings
>   File "./get-ceph-quota-statistics.py", line 94, in login
>     cephfs.mount(filesystem_name=b'cephfs')
>   File "cephfs.pyx", line 684, in cephfs.LibCephFS.mount
>   File "cephfs.pyx", line 676, in cephfs.LibCephFS.init
> cephfs.OSError: error calling ceph_init: Permission denied [Errno 13]
>
> Now I've tested a FUSE mount with the same keyfile and that functions as
> expected, so I'm having to assume that somehow the Python script either
> doesn't have all of the properties I've supplied (which I doubt, because I
> can point it at files with admin credentials and it works fine), something
> within the Python CephFS library might be hardcoded to particular values
> which I'm having problems with, or maybe something else?
>
> Is there a way to interrogate the Python object before I do the
> cephfs.mount, just to confirm the options are as I expect?
>
> Alternatively, python-cephfs wraps around the CephFS library, right?
> Does the CephFS FUSE component utilise the same CephFS library?
> If not, is there a way to call something else on the command line directly
> to rule out problems there?
>
> Many Thanks,
> Adam.
>
> -----Original Message-----
> From: Adam Carrgilson (NBI) <Adam.Carrgilson@xxxxxxxxx>
> Sent: 25 July 2022 16:24
> To: ceph-users@xxxxxxx
> Cc: Bogdan Adrian Velica <vbogdan@xxxxxxxxx>
> Subject:  Re: LibCephFS Python Mount Failure
>
> Thanks Bogdan,
>
> I’m running this script at the moment as my development system’s root user
> account, I don’t have a particular ceph user on this standalone system, and
> I don’t think I’ll be able to control the user account of the monitoring
> hosts either (I think they might run under a user account dedicated to the
> monitoring) but I’m interested to what you think I should test here?
>
> I can definitely run the code as the root user, it can read my custom
> configuration and key files, when I specify those providing the admin user
> credentials, it works as expected, but when I specify the monitoring
> credentials it errors with that ceph_init message.
>
> My script can open and read the configuration and key files (I print those
> to screen), and I do attempt to pull back the environment before I execute
> the mount, and it does include my addition of the CEPH_ARGS. That said,
> those also work when those particular files are for the admin ceph account,
> and that can’t be picking up anything from the default locations as I’ve
> deliberately removed them from there.
>
> Is there any way to make the Python LibCephFS more verbose to better
> understand its error message?
>
> Adam.
>
> From: Bogdan Adrian Velica <vbogdan@xxxxxxxxx>
> Sent: 25 July 2022 14:50
> To: Adam Carrgilson (NBI) <Adam.Carrgilson@xxxxxxxxx>
> Cc: ceph-users@xxxxxxx
> Subject: Re:  LibCephFS Python Mount Failure
>
> Hi Adam,
>
> I think this might be related to the user you are running the script as,
> try running the scrip as ceph user (or the user you are running your ceph
> with). Also make sure the variable os.environ.get is used (i might be
> mistaking here). do a print or something first to see the key is loaded.
> Just my 2 cents...
>
> Best of luck,
>
>  --
> Bogdan Velica
> Ceph Support Engineer
>
> croit GmbH, Freseniusstr. 31h, 81247 Munich
> <https://www.google.com/maps/search/Freseniusstr.+31h,+81247+Munich?entry=gmail&source=g>
> Com. register: Amtsgericht Munich HRB 231263
> Web: https://croit.io<https://croit.io/>
>
> On Mon, Jul 25, 2022 at 4:06 PM Adam Carrgilson (NBI) <
> Adam.Carrgilson@xxxxxxxxx<mailto:Adam.Carrgilson@xxxxxxxxx>> wrote:
> Hi all,
>
> I'm trying to put together a script to gather CephFS quota utilisation.
> I'm using the CephFS Python library from here:
> https://docs.ceph.com/en/latest/cephfs/api/libcephfs-py/
> and I've followed the rather a good guide on how to use it here:
> https://jayjeetc.medium.com/up-and-running-with-libcephfs-7629455f0cdc#934a
>
> I have been able to get this working, however; I want this to be able to
> be portable to run it on our monitoring agents, and specifically, I want to
> be able to use a limited permission account, so read-only permissions and
> network limitations.
> I originally couldn't find a method to specify a custom keyfile to use
> through the library, but with some assistance, I've found that I can use
> the Python command: os.environ["CEPH_ARGS"] = "--keyring=/path/to/keyring"
> to provide the library with that which works great (with my admin account).
>
> And therein lies the error, I've created an account just for this use
> case, but when I provide the keyfile with those credentials, I get the
> response: OSError(13, 'error calling ceph_init') I can give the limited
> permission account capabilities matching the admin account, but it
> continues to fail in the same way, pointing to it not being a permissions
> issue.
>
> Is there something obvious that I've done wrong, or an alternative method
> that might be a better approach, how can I get this to function for my
> monitoring?
>
> I've installed python-cephfs through my systems package manager, it's
> version 14.2.22, and I'm connecting through to a Nautilus system which is
> likewise version 14.2.22.
>
> Many Thanks,
> Adam.
>
> _______________________________________________
> ceph-users mailing list -- ceph-users@xxxxxxx<mailto:ceph-users@xxxxxxx>
> To unsubscribe send an email to ceph-users-leave@xxxxxxx<mailto:
> ceph-users-leave@xxxxxxx>
> _______________________________________________
> ceph-users mailing list -- ceph-users@xxxxxxx To unsubscribe send an
> email to ceph-users-leave@xxxxxxx
> _______________________________________________
> ceph-users mailing list -- ceph-users@xxxxxxx
> To unsubscribe send an email to ceph-users-leave@xxxxxxx
>
_______________________________________________
ceph-users mailing list -- ceph-users@xxxxxxx
To unsubscribe send an email to ceph-users-leave@xxxxxxx




[Index of Archives]     [Information on CEPH]     [Linux Filesystem Development]     [Ceph Development]     [Ceph Large]     [Ceph Dev]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [xfs]


  Powered by Linux