Comment 36 for bug 1617918

Revision history for this message
Julien Danjou (jdanjou) wrote :

"iirc, the original reason we had this translation was because we had some cases where our 'resource_id' had a '/' in it which broke api. the more we expand that, it seems like the translation are very hidden unless you know about it..."""

Resource IDs are and always have been UUID. This won't change.
In Ceilometer we realized we had resource ID which were not UUID (and some with / in it) so we added a translation layer str->uuid a while back, based on uuid5(id-that-is-not-an-uuid-and-that-we-call-original-resource-id).

"""even now i'm not entirely sure what i'd get if i put use /v1/resource/generic/foobar. i feel like it should be simple from REST pov (if you ask for v1/resource/generic/<blah> you should get whatever resource has primary key <blah>."""

If you use /v1/resource/generic/<blah>, you'll get <blah> (after the server or client translates it to an uuid5 _if_ it <blah> is not an UUID).

The problem this bug is about is that when <blah> is a string "blah" it's converted to a uuid5("blah") and that is always the same, whoever you are. That's cool, but you cannot have several resources with "blah" as "original-resource-id". Which is what the bug is about.

(or you think we should not fix the bug? :))

"""so the scope is what my original concern was. this seems to break (my) use case of i am admin user and i want to grab everything from my project."""

It actually does not. With Keystone auth, if you're admin, you can list all resources:

GET /v1/resources/instance

You'll get *all* instances whatever the "creator" field is – you're admin. That will return the data with all details about resources. If you want to access any resource directly, let's say one who has original_resource_id set to "foobar", well, if it's a "foobar" from jd its ID is currently uuid5(foobar). Which means that there's only one uuid5("foobar") in Gnocchi. But you can access it (you have both resource.id and resource.original_id with those info) since you're admin.

The proposal here, is to make "foobar" translated to uuid5("foobar", "jd") rather than just uuid5("foobar"). Then everything still works as just described, but this time you can have more than one resource whose original_resource_id is "foobar'. You can have one where its creator is sileht and its resource_id will be uuid5("foobar", sileht) which is a computed id, but is still unique. And original_resource_id will be still "foobar".