Monday, 2022-06-27

bauzasgood morning Nova07:15
gibio/07:24
bauzasone day off and a lot of emails to triager07:35
gibifrickler:  re https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1013410 we have an upstream bug for that  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1013410 and it is being fixed by https://review.opendev.org/c/openstack/nova/+/84592208:18
gibibah, I mean upstream bug https://bugs.launchpad.net/nova/+bug/197881708:18
gibicolby_: I think we saw similar issues before but I don't find the relevan bug report now I suggest to ping bauzas as he might have more context with vgpus/mdevs08:26
bauzascontext ?08:26
gibibauzas: 19:49 < colby_> Hello everyone. we are experienceing a strange but with vGPU. We are using Virtoria on Centos 8 Stream with A40 gpus in SRIOV setup. Everything works correctly except when we delete an instance. It does not seem to release the virtualfunction mdev device. I can manually release them by echoing to the remove method of the mdev. So its like nova is not doing that.08:27
gibibauzas: that was from friday08:27
fricklergibi: ah, cool, thx for the pointer08:30
gibifrickler: I replied in the debian tracker too08:30
bauzasgibi: colby_: yes we don't delete the mdevs08:32
bauzas4 years ago, I thought it was not needed08:33
UgglaHello, bauzas, gibi, sean-k-mooney https://review.opendev.org/c/openstack/nova/+831507, I have fixed latest comments from bauzas and I have verified it works fine with devstack. Can you go ahead with a new review round ?09:30
sean-k-mooneygibi: we are tarcking that as a downstream bug09:31
sean-k-mooneyim suggesting that we shoudl free the mdev when we delete the vm09:31
sean-k-mooneywe could resue the mdev on the next vm creation but09:31
sean-k-mooneyit think that will be problematic if we start using mdevs more dynamicaly in the future09:32
sean-k-mooneyit would work for our current usecase but i would prefer to only allocate mdevs if they are in use09:32
sean-k-mooneyUggla: gerrit says no09:33
sean-k-mooneyUggla: specifically it give a 40409:33
sean-k-mooneyand a 09:33
sean-k-mooney¯\_(ツ)_/¯09:33
Ugglahttps://review.opendev.org/c/openstack/nova-specs/+/83366909:33
sean-k-mooneythat works fine09:34
* Uggla a bit tired today. Forget about the above links.09:34
UgglaHere is the good one: https://review.opendev.org/c/openstack/nova/+/83150709:35
Ugglasean-k-mooney, please look at the link ^09:36
sean-k-mooneyah it was miising a /09:38
sean-k-mooneyso looking a the spec you are just missing the parmater to pass to the  grant api to resolve the locking issue09:39
sean-k-mooneyfor manila09:39
sean-k-mooneyim not a huge fan of _unset_field_sentinel but i guess that works09:41
Ugglasean-k-mooney, regarding manila yes. I have reviewed the spec locally, I will push it ASAP. Before the 5th hopping it will be approved and merged.09:47
Ugglasean-k-mooney, fyi _unset_field_sentinel was proposed and agreed from gibi and bauzas, so I used that as an humble padawan. :)09:51
gibisean-k-mooney: about the sentinel, do you see a viable alternative?09:51
sean-k-mooneyright i just dont like how pervaisve the check is09:51
sean-k-mooneygibi: nothing substaitally differnt i proably would have made it a module level constant and uppercase it rather then a class variable09:52
sean-k-mooneyand i might have done the test once and assigned it to a varible at the top of the function09:53
sean-k-mooneyno_az = new_az == AZ_SENTINAL09:53
gibisean-k-mooney: I have no hard opinion abou the location, could be on module level too. 09:53
sean-k-mooneyif not no_az and new_az: ...09:53
sean-k-mooneywell its just a nit09:54
sean-k-mooneyas i said it does not really change anything09:54
gibion the test side, I agree, that could be factored out09:54
sean-k-mooneyjust stypictlly i like constnats to eb UPPERCASE_WITH_UNDERSCORES09:54
sean-k-mooney*stylisticly09:55
sean-k-mooneyUggla: so realisticaly you do not need to change anything it just not an established pattern in our code base to have sentenial like this so it looks odd because its different then our normal pattern09:56
gibibauzas: ^^ look sean-k-mooney also feels it is not an established pattern :D09:57
gibisean-k-mooney: context: we had a bit of back and forth with bauzas around the sentinel09:57
sean-k-mooneywe dont currntly have the equivalent of std:optional in python/nova09:58
sean-k-mooneyi would kind of perfer to have that class but i know other recoile at c++ conventions09:59
gibibauzas pointed out that the sentinel + kwargs is widely used in the nova rpc apis09:59
sean-k-mooneywe use none as the sentinal there no?09:59
sean-k-mooneyi dont really like that the custom sentinal we use is not "truthy" so we can just use if directly10:00
gibiI think we use kwargs not to send a value even10:00
sean-k-mooneywe use None however as the sentinal https://github.com/openstack/nova/blob/c53ec4e48884235566962bc934cbf292ad5b67b8/nova/compute/manager.py#L11017-L11019=10:02
sean-k-mooneyso what Uggla  is doing is very differnt10:03
sean-k-mooneythe use of None as a sential for kwargs is idiomatic python10:04
Ugglasean-k-mooney, fyi bauzas provided this as a sentinel example: https://github.com/openstack/nova/blob/master/nova/scheduler/rpcapi.py#L152 and https://github.com/openstack/nova/blob/master/nova/scheduler/manager.py#L145 so I try to respect that pattern.10:04
sean-k-mooneyi see10:05
sean-k-mooneyi still dont like that10:05
Uggla:)10:05
sean-k-mooneyits kind of like raw gotos10:05
sean-k-mooneywe have if while ectra for a reason10:06
gibiwe cannot use None in the current case as None has a different meaning than the missing param10:06
gibias we want to be able to signal either unpin or no-change 10:07
sean-k-mooneyyes im aware10:07
gibiso we needed an extra value10:07
sean-k-mooneyyep that is what std:optional does in c++10:07
sean-k-mooneyit give you a value that is outside the normal set10:08
sean-k-mooneysame with ovo10:08
sean-k-mooneythe field have an addtional unset value10:08
gibiyeah, I don't like the ovo way of missing fields, as that breaks the class invariant for me10:08
sean-k-mooneywell i prefer it to this10:08
sean-k-mooneythe ovo way at least work with in and is encapulated10:09
gibiI create an ovo class with predefined fields, and then I have to check at each access if the field exists, that seem against the fact that we predefine the fields10:10
sean-k-mooneyi dont like that we have to rememeber that this is not just an az its a union of an az and a sentinal10:10
gibianyhow I go back to review the unshelve patch10:10
gibisean-k-mooney: so you would add an extra param to the call instead? like az_provided ?10:10
gibithat way we can avoid the sentinel10:11
gibinew_az can be None to unpin or a valid AZ name, and az_provided boolean can be set if no AZ field is provided in the REST request10:11
sean-k-mooneyperhaps or wrap the parmters in a class10:11
sean-k-mooneyi would think that az_provided would be more readable10:12
sean-k-mooneyso ideally even if we had a sentinil i would like use to do that test once at the top of the function and defien a local az_provided varible10:13
sean-k-mooneythat better expresses the intent10:13
opendevreviewAmit Uniyal proposed openstack/nova master: Adds validation for hw machine type in host caps  https://review.opendev.org/c/openstack/nova/+/84712611:37
bauzasUggla: sean-k-mooney: gibi: sorry folks, I was cooking and lunching with my kid11:40
bauzassean-k-mooney: not sure I understand why you unlike the sentinel pattern11:42
bauzassean-k-mooney: and why you ask for a new parameter11:42
sean-k-mooneybauzas: its very very error prone11:42
bauzas?11:42
sean-k-mooneyyou need to keep the context that the vraiable is a union of a sential and the az11:42
sean-k-mooneyand everywhere you use it test for both11:42
sean-k-mooneyits very easy to miss that11:43
bauzassean-k-mooney: not if you provide a doc 11:43
sean-k-mooneyno one reads docs11:43
bauzasa doc comment I mean11:43
bauzaslike I said 11:43
bauzas:param az: (optional) blah11:43
sean-k-mooneyyep i hate those11:43
bauzasand so, you prefer to have pypi parameters...11:44
sean-k-mooneyif we have a sential i would prefer use to do the test once at the top of the function and never refernce the centinal again11:44
sean-k-mooneywell thos are at least testable by mypy so yes11:44
sean-k-mooneybut that is missign the point11:44
bauzassean-k-mooney: well, if we have two tests, one for verifying a sepific value for new_az and another one for verifying to not use the parameter, I wouldn't see why it could be a problem11:45
sean-k-mooneyyou are adding extra context that you need to keep in mind11:45
bauzassean-k-mooney: but we have done that since I'm working in Nova11:45
sean-k-mooneyin very limits places11:46
sean-k-mooneyi really dont want o see us doing this more in the code11:46
bauzaslemme look at Uggla's change11:46
bauzassean-k-mooney: in general within RPC methods11:49
bauzasso, I briefly looked at Uggla's code11:49
bauzasI don't see why people wouldn't understand this is an optional parameter when looking at the call https://review.opendev.org/c/openstack/nova/+/831507/14..16/nova/api/openstack/compute/shelve.py#10611:49
bauzasand in https://review.opendev.org/c/openstack/nova/+/831507/14..16/nova/compute/api.py#4467 Uggla added docstrings11:50
bauzasbut I understand your point11:51
bauzasmaybe we could use PEP661 then https://peps.python.org/pep-0661/11:51
bauzasand using the sentinels module11:52
bauzaslemme see if py3.8 supports it11:52
bauzasmmm, not stdlib11:53
bauzasoh my bad, PEP661 is a drafy11:53
bauzasdraft*11:53
* bauzas facepalms11:53
sean-k-mooneybauzas: its not the call site11:54
sean-k-mooneyits the use site within the function i find distasteful11:54
bauzasyou mean, the caller or the called method ?11:54
sean-k-mooneythe use in the called method11:55
bauzasthe if conditional ?11:55
sean-k-mooneyyes11:55
bauzashah11:55
sean-k-mooneythe fact you have to check the sential with an is check explictly11:55
bauzaswell, then we could have one single conditional that would set a value or not11:55
sean-k-mooneyright which is what i actully was askign for11:55
bauzaswould you then prefer something like 11:56
sean-k-mooneyi didnt leave review feedback yet because i was in the midel of other thngs11:56
sean-k-mooneybauzas: also https://peps.python.org/pep-0661/ is basically the same as cpp's std:optional11:56
sean-k-mooneyat least in inteded usage11:57
sean-k-mooneyso yes i would prefer that11:57
sean-k-mooneythat said i dont se how its used11:57
bauzassean-k-mooney: https://paste.opendev.org/show/bLmJ5uKGsufcYjXAIda3/11:58
bauzaswould you prefer this pattern ?11:58
bauzaswe only set an internal value if the parameter was provided11:59
bauzasso we only check the sentinel value once at the top of the method11:59
sean-k-mooneynot quite11:59
sean-k-mooneythe problem with that is we can refernce undeined varbles11:59
sean-k-mooneythat actully a error  in any path where new_az is not _sentinel12:00
bauzaswell, the reference to _sentinel is unique12:00
bauzasyou can check its id12:00
bauzasthat's why this pattern exists in Python to verify whether this parameter was called12:01
sean-k-mooneyhttps://paste.opendev.org/show/bqHsJAFVEGmRncJcERMd/12:01
bauzasas, if the id of the value explicitly matches the unpassed12:01
sean-k-mooney if _new_az or host: in your version is a runtime error12:02
bauzassean-k-mooney: true12:02
bauzasI like your counterproposal12:02
sean-k-mooneyi just like have a name for the concept that we are modeling 12:03
sean-k-mooneyand abstracting how it implemtned via the name12:03
bauzasof course, "az_passed == new_az is not _sentinel" without the trailing double-dot :)12:03
bauzasand with a single equal12:03
bauzasbut I got your idea12:03
bauzasyou create an always-set internal reference for knowing whether this field was set or not12:04
bauzasthis is a good pattern12:04
bauzasand only at the top of the method12:04
sean-k-mooneyyep12:04
sean-k-mooneyyou check once and define a varible at the top of the method with a meaningful name12:04
sean-k-mooneyand then use that later so you dont need to keep the context loaded12:05
bauzaswfm12:05
bauzasUggla: ^12:05
bauzasUggla: tl;dr follow the pattern proposed by https://paste.opendev.org/show/bqHsJAFVEGmRncJcERMd/12:05
bauzasbut modify the first line by "az_passed = new_az is not _sentinel12:05
Ugglabauzas, ok 12:27
gibiUggla: fyi I'm in the middle of reviewing your patches so you will get feedback from me soon too12:44
Ugglagibi, a lot of new ones ?12:45
gibiUggla: couple of nits in the code and a list of suggestions in the functional tests12:46
Ugglagibi, ok I'm gonna wait for your comments.12:46
gibiUggla: posted my comments13:00
Ugglagibi, ok thx13:00
opendevreviewJan Hartkopf proposed openstack/nova master: add support for updating server's user_data  https://review.opendev.org/c/openstack/nova/+/81615714:01
opendevreviewJan Hartkopf proposed openstack/python-novaclient master: add support for microversion 2.91  https://review.opendev.org/c/openstack/python-novaclient/+/81615814:03
*** diablo_rojo__ is now known as diablo_rojo16:22
opendevreviewJan Hartkopf proposed openstack/nova master: add support for updating server's user_data  https://review.opendev.org/c/openstack/nova/+/81615716:29
*** diablo_rojo is now known as Guest343417:08
*** Guest3434 is now known as diablo_rojo18:03
*** diablo_rojo__ is now known as diablo_rojo19:25
colby__gibi: bauzas: sean-k-mooney: Thanks for the info. If the mdevs are not removed to be reused why would nova see them as being used then? Is that the bug mentioned? We have dynamic mdevs made from the sriov-manage on the pgpus that all work on initial spin up of instances, but once you delete the instances you can no longer use the vgpu device. Its still seen as busy.19:55
*** dasm is now known as dasm|off22:16
*** hemna0 is now known as hemna23:38

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