Monday, 2025-06-02

*** mhen_ is now known as mhen01:18
dansmithcan someone help me with a stupid keystoneauth/client/whatever question?16:31
dansmithwhen I access something like devstack using tls-proxy, the URLs are (as expected) prefixed with /service/blah16:31
dansmithrel links within json documents will include that, so /placement/foo/bar16:32
dansmithif I use one of those to make another call, keystone client will re-prefix it and I'll get /placement/placement/foo/bar16:32
dansmithI can strip off the first, of course, but then that same code doesn't work when used with a deployment that does not have a /placement prefix16:33
gtemaare there anywhere relative links (in catalog, in version discovery doc, etc)?16:33
dansmithI'm not sure how to answer that.. this is what I'm looking at: https://docs.openstack.org/api-ref/placement/#id816:34
dansmiththose "links" have /placement already prefixed, if I just grab one and call that with the client, it will try to hit /placement/placement/blah16:35
gtemayou need to check how the service catalog looks like (openstack catalog show placement), and in addition to that send authenticated request to http(s)://api/placement/16:35
gtemaand check how the version document look like16:36
dansmithokay so I'm supposed to determine it myself, and strip the /placement off the link myself if it looks like the catalog already has that in it?16:37
dansmithI was expecting this to be automatic I guess, like keystoneauth seeing that it was already prefixed or something16:37
gtemano, I mean that if some of the docs is using relative links things may recursively duplicate16:38
gtemaimagine service catalog points to http://api/placement and version doc at that address says: placement/ - then it would be doubled16:38
gtemathat would be deployment bug16:39
dansmithokay I'm not quite sure I understand.. let me grab some of those things and show you what I'm looking at16:39
dansmiththis is standard devstack16:39
gtemaI do not have devstack at hand right now, and I do not play with placement 16:40
gtemaI have found some devstack. Placement version discovery doc looks like that: {"versions":[{"id":"v1.0","links":[{"href":"","rel":"self"}],"max_version":"1.39","min_version":"1.0","status":"CURRENT"}]}16:44
dansmithhttps://paste.opendev.org/show/byWstXnuUAYWvSm1DOug/16:44
dansmiththe endpoint has /placement in it (of course)16:44
dansmithand the links that are returned from placement in a doc include /placement16:44
dansmithso if I do session.get(links[0]['href']) it will try to get /placement/placement/resource_providers/...16:45
dansmithmy version discovery doc looks like yours, yep.. with href:""16:47
gtemafor me this is a sort of bug: either the service should return absolute urls or relative links are relative to the current url. At least this is the base principle of openstack catalog consumption 16:47
gtemaoh well, not to the current url (what could be as well), but to the base of where the placement is deployed16:48
dansmithmeaning links should have /resource_provider in them? or the version doc should have /placement in the self href?16:49
gtemacause the catalog endpoint discovery identified placement base as http://placement/api and relative link is appended to that - OpenStack is full of dumb concats resulting in double slashes and similar insanity16:49
dansmithI guess I'm not sure how nova (et al) works, since it seems to work for either case16:50
gtemayes, if links would be /resource_provider (with or without leading slash is hard to say) it should work16:50
gtemanot a single core service that is intended to be used by the user is returning relative links to the user under the normal recommended conditions16:51
gtemaat least not that I have seen one16:51
dansmithyeah, I guess I will have to dig into what nova is doing to make this work for the /placement and / cases both, because me trying to write a standalone client, I'm not sure16:52
gtemaand placement was stated not designed to be used by the user16:52
gtemaI think placement by default just "hopes" it is deployed under the root and does not worry about anything else16:52
dansmithI don't think so, because if so, it wouldn't be returning /placement prefixed to the urls16:55
dansmithand if you deploy devstack without tls-proxy, it will be on its own port and at the root, and then it does not prefix with /placement16:55
gtemaok, that means deployment respects how it is published, but relative urls are always bad16:57
gtemaa question is where the url construction happens. Do you use keystoneauth or sdk?16:58
dansmithyeah, understand16:58
dansmithgtema: tbh I don't really know where the delineation is, but I'm doing a session.get(url) so I assume that's all keystoneauth16:58
dansmithI'm guessing maybe none of the nova code uses the links structure and so it doesn't know about this stuff16:59
gtemamost likely16:59
dansmithand that's why it works in either place - because session prefixes or doesn't16:59
gtemaand yes, session.get would be in the keystoneauth which either uses the absolute url or appends the relative url to the catalog endpoint (which is already /placement)16:59
dansmithis there an easy way I can see what the current session points to? so I can compare the suffix of that to the prefix of the link url?17:00
gtemahttps://opendev.org/openstack/keystoneauth/src/branch/master/keystoneauth1/session.py#L921 should be what happens17:02
dansmithokay maybe I can at least probe some of that to see if I should strip or not17:04
gtemathe easiest would be really just to fix the deployment so that relative links from placement are relative to where the catalog points to17:06
gtemabasically the placement link should be always the same (if it is relative link)17:06
gtemaand the catalog should point to the correct entry point17:07
gtemaintroducing a-yet-another special case is not going to do any good17:07
dansmiththe catalog is correct17:22
dansmithsounds to me like *placement* should be fixed to return links without a prefix17:22
dansmithand I agree, I'm just trying to make this work against deployments I don't control that are deployed with code that is already released17:23
gtemadansmith: I strongly believe devstack deployment sets some special confg option as api prefix or wsgi SCRIPT_NAME so that all links contain that as a prefix (https://opendev.org/openstack/placement/src/branch/master/placement/util.py#L187)17:30
dansmithokay I don't see it17:33
dansmithmight be a uwsgi default17:33
gtemait maybe set somewhere in the wsgi config which may be somewhere else17:34
dansmithI looked in the systemd file and the wsgi file and I don't see it17:46
dansmithand I don't see SCRIPT_NAME anywhere in devstack/*17:46
dansmithbut I agree, that's probably not the right thing to do in placement regardless17:46
dansmithgtema: unrelated, but.. how is valid_interfaces supposed to be honored by keystoneauth? I have valid_interfaces= set in the client config, but I seem to have to pass interface in the endpoint_filter to a session.request18:20
dansmithI assumed load_session_from_conf_options() to do the right thing for me, but it doesn't seem to18:20

Generated by irclog2html.py 4.0.0 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!