Friday, 2024-10-18

ralonsohstephenfin, hello! if you have some minutes: https://review.opendev.org/c/openstack/openstacksdk/+/92777905:41
ralonsohthanks in advance!05:41
opendevreviewRodolfo Alonso proposed openstack/openstacksdk master: Add ``trunk_details`` to ``ports`` resource  https://review.opendev.org/c/openstack/openstacksdk/+/92660909:02
opendevreviewRodolfo Alonso proposed openstack/python-openstackclient master: Add the trunk subports information to the port list command  https://review.opendev.org/c/openstack/python-openstackclient/+/92661109:58
opendevreviewRodolfo Alonso proposed openstack/python-openstackclient master: Add the trunk subports information to the port list command  https://review.opendev.org/c/openstack/python-openstackclient/+/92661110:07
stephenfinralonsoh: I'm slightly concerned that we now have two similarly named methods that will only work with some services11:27
stephenfinHow come neutron is using POST instead of PUT? Is PUT an option?11:28
stephenfinAnd what happens if you POST multiple times? Does that result in it being overridden or...?11:28
ralonsohstephenfin, PUT was the initial implementation. Was used to add a single tag to a resource. But there are some problems with the tag names, for example if you use slash /11:38
ralonsohpost multiple times: that is tested in the patch. This is idempotent11:38
ralonsohyou can post several times the same tag but it will be created once only11:38
ralonsohPOST is the new method and in the CLI it will replace PUT11:39
stephenfinI thought the issue was that we were passing the parameters in the URI rather than in the body?11:40
ralonsohyes11:40
stephenfin(btw, I realize I'm straying into Neutron API design rather than openstacksdk stuff here, but I'd like to understand this so please bear with me :))11:40
stephenfinOkay, how come we didn't just...start passing it in the body?11:40
stephenfiniiuc, that's what nova et al do?11:40
ralonsohthat is the main reason: not to add the tag name in the URL11:40
stephenfinhttps://docs.openstack.org/api-ref/compute/#replace-tags11:41
ralonsohthat is different: with this call you will replace the existing tag list with the new one passed11:42
ralonsohwith post you'll only create the non existing ones11:42
ralonsohin the Neutron CLI we are currently reading the current tags and creating the new tag list11:42
ralonsohinstead with this it won't be needed first to read the tag list, you can directly POST the new tags11:43
stephenfinOkay, gotcha. And I'm guessing it's still not possible to PUT with a body?11:43
ralonsoh(and yes, another option could have been updating the neutron PUT command)11:43
ralonsohyes, this is another option too11:43
ralonsohI didn't go this way11:44
ralonsohbut of course I can implement that too11:44
stephenfinI'd be interested in knowing how many, if any, of the current methods in the TagMixin actually work with neutron resources11:45
stephenfini.e. https://review.opendev.org/c/openstack/openstacksdk/+/927779/7/openstack/common/tag.py11:45
stephenfinIf the answer is zero, or nearly zero, I wonder if neutron should have it's own TagMixin?11:45
ralonsohstephenfin, sorry, I don't understand the question11:45
ralonsohall Neutron resources that have tags (except for the bug with qos policies) work with these methods11:46
stephenfinCan I do e.g. x = network.find('foo'); x.add_tag(session, 'bar')11:46
stephenfinor x.remove_tag(session, 'bar')11:46
stephenfinor x.check_tag(session, 'bar')11:46
ralonsohthat must work, for sure, this patch has the corresponding functional tests11:47
ralonsohand I think we are testing all these methods11:47
ralonsohwell, we are not testing all of them11:48
ralonsohlet me add this in my TODO list: add FTs for Neutron resources in SDK11:48
ralonsohadd FTs for tags for Neutron resources in SDK*11:49
ralonsohstephenfin, is that ok for you?11:49
stephenfinsure11:50
* stephenfin quickly experiments locally 11:51
greatgatsbyHello.  Is it possible to have the openstack commandline client perform pagination automatically, or force it to return all the results in some way?  I believe --limit -1 does not work anymore?  Thanks for your help.11:51
stephenfingreatgatsby: Pagination should happen automatically. Could you test with OSC < 6.1.0 (when we switched from novaclient to SDK under the hood). I don't have an environment with enough VMs running to test.11:53
greatgatsbystephenfin: thanks, I'll test that version.  With 6.3.0, I get a 400 Client Error Invalid input for query parameters limit, Value -1 does not match '^[0-9]*$'.  So it looks like it's the API that does not support this anymore, but OSC still shows -1 as a valid argument in the help.11:56
greatgatsbythis could also apply to listing volumes, for example, so I'm not sure it's specific to novaclient11:58
stephenfinralonsoh: Mea culpa. I misunderstood the bug /o\ I assumed this was a replacement for 'set_tag' method, but in reality you are using this as a replacement for the 'add_tag' method (and an alternative to 'set_tag' if you want to keep the extend rather than replace the existing tags)11:59
stephenfinRight?12:00
stephenfingreatgatsby: I'd have to go back and check, but my guess is the server never supported this and instead the client was doing something special if -1 was provided.12:00
stephenfinactually, that was a quick grep. Yeah, this is a client-side thing https://github.com/openstack/python-novaclient/blob/3add6476fb265626d77704f7828dacc21cff81d9/novaclient/v2/servers.py#L1042-L104312:01
greatgatsbyoh interesting.  So this is possibly something that could get "fixed" in the current OSC?12:02
stephenfingreatgatsby: what happens if you omit --limit entirely? From reading that it appears if no limit parameter is provided then everything would have been returned.12:03
stephenfini.e. --limit -1 is identical to not providing --limit12:03
greatgatsbywith 6.3.0 I'm 99% sure we have to use pagination.  If we don't provide limit or marker, we get a subset of all the servers12:04
ralonsohstephenfin, yes, we want to replace set_tag with add_tag, that is idempotent12:04
stephenfinralonsoh: Okay, Apologies for the confusion. In that case, new suggestion: s/create_tags/add_tags/ (plural) Tags aren't really a resource in their own right so you're not really "creating" anything, anymore than you'd be "creating" a name or name alias.12:07
stephenfinI'd also still be in favour of providing a Neutron-specific TagMixin subclass with this in it, since afaik no other service has this API currently12:07
stephenfingreatgatsby: Right you are. There's also this code https://github.com/openstack/python-novaclient/blob/3add6476fb265626d77704f7828dacc21cff81d9/novaclient/v2/servers.py#L1068-L106912:08
stephenfinSo the behavior now is that pagination will happen by default because that's what SDK default to. You'd have to opt-in to a limit if you wanted one12:08
ralonsohstephenfin, I'll update the patch today12:09
greatgatsbystephenfin: ok, thanks a lot for the quick feedback.  I'll look deeper into the SDK and investigate my options.  Cheers.12:10
stephenfinWe should definitely re-add support for -1, at least temporarily. Whether we want to revert to pagination by default is a more difficult thing to decide. IMO, you'd always want to get everything unless you're in a huge environment, in which case you'll quickly learn to pass --limit12:11
stephenfingreatgatsby: nw. If you can file a bug, please do. Links to the bug trackers are in the channel description12:11
greatgatsbystephenfin: will do, thanks again12:17
opendevreviewMerged openstack/keystoneauth master: typing: Annotate keystoneauth1.discover  https://review.opendev.org/c/openstack/keystoneauth/+/92881415:46
opendevreviewMerged openstack/keystoneauth master: typing: Annotate keystoneauth1.plugin  https://review.opendev.org/c/openstack/keystoneauth/+/93076215:46
opendevreviewMerged openstack/keystoneauth master: typing: Annotate keystoneauth1.session  https://review.opendev.org/c/openstack/keystoneauth/+/93076315:53
opendevreviewMerged openstack/keystoneauth master: trivial: Consistent f prefixes  https://review.opendev.org/c/openstack/keystoneauth/+/93076415:58
opendevreviewMerged openstack/keystoneauth master: typing: Annotate keystoneauth1.adapter  https://review.opendev.org/c/openstack/keystoneauth/+/93076515:58
opendevreviewMerged openstack/keystoneauth master: typing: Annotate keystoneauth1._fair_semaphore  https://review.opendev.org/c/openstack/keystoneauth/+/93076616:08
opendevreviewMerged openstack/keystoneauth master: typing: Annotate various plugin modules  https://review.opendev.org/c/openstack/keystoneauth/+/93076716:10
opendevreviewMerged openstack/keystoneauth master: typing: Annotate keystoneauth1._utils  https://review.opendev.org/c/openstack/keystoneauth/+/93076816:10
opendevreviewMerged openstack/keystoneauth master: typing: Annotate keystoneauth1.exceptions  https://review.opendev.org/c/openstack/keystoneauth/+/93076916:10
opendevreviewOria Weng proposed openstack/python-openstackclient master: Identity: Migrate 'role' commands to SDK  https://review.opendev.org/c/openstack/python-openstackclient/+/92971221:14

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