Monday, 2023-07-03

dvo-plvsean-k-mooney, Hello, are you around today ?08:27
dvo-plvmelwitt, Hello08:48
*** Continuity_ is now known as Continuity09:13
elodillesif any core wants to do a trivial review for a bot generated patch, then here is a nice candidate: https://review.opendev.org/c/openstack/osc-placement/+/87510009:41
elodilleso:) (this should have merged months ago)09:42
sean-k-mooneydone09:51
sean-k-mooneydvo-plv: o/09:51
dvo-plvI have a question regarding your comment with implementing functional tests09:52
dvo-plvhttps://review.opendev.org/c/openstack/nova/+/876075/14/nova/scheduler/request_filter.py#28509:52
sean-k-mooneysure09:53
sean-k-mooneywhats specifically09:53
dvo-plvI had rewrite this method to catch conflict in this way https://paste.opendev.org/show/bzaJaNk53E0OX9otfzzI/09:54
dvo-plvbut during the process of creating http response i caught next error09:55
dvo-plvhttps://paste.opendev.org/show/bd8oaO0EfYznOP5gkACa/09:55
sean-k-mooneywhy09:55
sean-k-mooneyoh the dict interfnace for nova/oslo verions objects has been deprecated for years09:56
sean-k-mooneywe started revmign all the supprot a while a go09:56
dvo-plvto handle this issue in the test09:56
dvo-plvso my question is, how should i properly solve this issue09:57
dvo-plvimplement this to_dict method, or leave it with a comment?09:57
sean-k-mooneyneither 09:57
sean-k-mooneywhy is to_dict being called09:57
sean-k-mooneyim not sure why you are doing the rewite09:58
sean-k-mooneyit should not be required09:58
dvo-plvhttps://paste.opendev.org/show/blwO5HpbmFyV7UP3Gppk/09:59
dvo-plvthis is how I impolemnted this test09:59
dvo-plvand it fails as expected, so I add this mock @unittest.expectedFailure10:00
sean-k-mooneywe dont normaly use that decorator10:00
dvo-plvBut folks comfirmed that I should not use it here, because this mock only for bugs10:00
sean-k-mooneywe use an expict assert 10:00
sean-k-mooneyi.e. self.assertRaises(<excption_class>, <function>, *args, **kwargs)10:01
dvo-plvYes, I already tried this and disscuse it with melwitt10:04
dvo-plv<dvo-plv> I alredy tried this way10:04
dvo-plv<dvo-plv> (Pdb) ex = self.assertRaises(exception.FlavorImageConflict,self._resize_server,server,new_flavor_id)10:04
dvo-plv<dvo-plv> *** AssertionError: Notification instance.resize.end hasn't been received. Received:10:04
sean-k-mooneyhttps://github.com/openstack/nova/blob/master/nova/tests/functional/libvirt/test_numa_servers.py#L643-L713 is an example fo a resize test10:05
sean-k-mooneyin your case you need to tell self._resize_server10:05
sean-k-mooneyto expect it to fail10:05
opendevreviewMerged openstack/osc-placement master: Update master for stable/2023.1  https://review.opendev.org/c/openstack/osc-placement/+/87510010:06
sean-k-mooneyhttps://github.com/openstack/nova/blob/4b454febf73cdd7b5be0a2dad272c1d7685fac9e/nova/tests/functional/integrated_helpers.py#L527-L53110:06
sean-k-mooneyso the current helpe expect to get to verify reize10:07
sean-k-mooneyin this case your expecting to get a api error directly right10:07
sean-k-mooneyso you will have to just do  the post directly10:08
sean-k-mooneyself.api.post_server_action(10:08
sean-k-mooney            server['id'], {'resize': {'flavorRef': flavor_id}})10:08
sean-k-mooneylike this https://github.com/openstack/nova/blob/4b454febf73cdd7b5be0a2dad272c1d7685fac9e/nova/tests/functional/test_servers.py#L808-L81810:09
sean-k-mooneyactully  def test_resize_server_negative_invalid_state(self): is kind of a good exampel for you to use as a reference in general10:10
dvo-plvThis way also was tested10:11
dvo-plv<dvo-plv> (Pdb) self.api.post_server_action(server['id'], {'resize': {'flavorRef': new_flavor_id}})10:11
dvo-plv<dvo-plv> {}10:11
dvo-plv<dvo-plv> It does not call class Fault(webob.exc.HTTPException) fault names10:11
dvo-plvIn this test, which can be reference, it wait for 409 error and verify it here  self.assertEqual(409, ex.response.status_code)10:12
dvo-plvSo I belive that I also need to extend FlavorImageConflict with error code 409 and catch it in the test10:13
sean-k-mooneyno you dont10:13
sean-k-mooneyFlavorImageConflict already resultes in a 40910:13
dvo-plvhttps://github.com/openstack/nova/blob/master/nova/exception.py#L234110:14
sean-k-mooneyoh it default to a 500 10:14
dvo-plvI did not found it here, so I thought that I need to extend it10:14
sean-k-mooneybut it should be converted elsewhere to a 400 or 40910:14
sean-k-mooneyhttps://github.com/openstack/nova/blob/master/nova/exception.py#L6710:15
dvo-plvSo, all this changes is not required to raise http conflict ? https://paste.opendev.org/show/bzaJaNk53E0OX9otfzzI/10:16
dvo-plvIt should handle is some other way ?10:16
sean-k-mooneyit is part of INVALID_FLAVOR_IMAGE_EXCEPTIONS https://github.com/openstack/nova/blob/4b454febf73cdd7b5be0a2dad272c1d7685fac9e/nova/api/openstack/compute/servers.py#L5810:16
sean-k-mooneyand that gets converted to a 400 bad reuest for resize here https://github.com/openstack/nova/blob/4b454febf73cdd7b5be0a2dad272c1d7685fac9e/nova/api/openstack/compute/servers.py#L1086-L108710:17
sean-k-mooneyso if you copy test_resize_server_negative_invalid_state and update it with the logic form your test and assert a 400 is retured then that should work10:18
sean-k-mooneyso duplicate https://github.com/openstack/nova/blob/4b454febf73cdd7b5be0a2dad272c1d7685fac9e/nova/tests/functional/test_servers.py#L792C9-L821 and update it image/flavor infor required for your test case10:19
dvo-plvOkay, I will try to use it as template now10:19
sean-k-mooneyyou shoudl get back a client.OpenStackApiException with reponce code 40010:19
dvo-plvthank you10:19
sean-k-mooneyok i need to step away for a bit and pick up a collegue form there house10:20
sean-k-mooneyill be back later10:20
dvo-plvsean-k-mooney, I have rewrote test in the next way and I still get the same empty response 11:16
dvo-plvhttps://paste.opendev.org/show/bSbVh7CP0oKa1eQdVNUj/11:16
opendevreviewAmit Uniyal proposed openstack/nova master: Refactor CinderFixture  https://review.opendev.org/c/openstack/nova/+/88575613:23
opendevreviewAmit Uniyal proposed openstack/nova master: Reproducer for dangling bdms  https://review.opendev.org/c/openstack/nova/+/88145713:23
opendevreviewAmit Uniyal proposed openstack/nova master: Delete dangling bdms  https://review.opendev.org/c/openstack/nova/+/88228413:23
opendevreviewAmit Uniyal proposed openstack/nova master: Allow to set attachment-id for bdm tests  https://review.opendev.org/c/openstack/nova/+/88751513:23
dvo-plvI never catch this exception13:42
dvo-plvhttps://paste.opendev.org/show/bBkeTtneX6hnX4kUj79F/13:42
dvo-plvMaybe I need to wrap my method with some decorator ?13:43
sean-k-mooneyit would be similer to look at this if you pushed your change as a seperate commit on top of the curren tone13:59
sean-k-mooneybut you should not really be modifying _resize14:00
sean-k-mooney if your not getting to INVALID_FLAVOR_IMAGE_EXCEPTIONS on line 4214:01
sean-k-mooneythat implies you likely are not blocking the resize proeprly14:02
sean-k-mooneyi.e. the code path might not be calling the fungiton that does the validation14:03
sean-k-mooneydvo-plv: i belive the validation code is defeintly run for server create yes.14:14
sean-k-mooneyi.e. if you create a server with a conflicting image/flavor 14:14
sean-k-mooneyso perhaps you should start with a funcitonal test to confirm that14:15
sean-k-mooneyand then if the that works and the resize one does not we then definetly have a bug14:15
opendevreviewAmit Uniyal proposed openstack/nova master: Refactor CinderFixture  https://review.opendev.org/c/openstack/nova/+/88575614:29
opendevreviewAmit Uniyal proposed openstack/nova master: Reproducer for dangling bdms  https://review.opendev.org/c/openstack/nova/+/88145714:29
opendevreviewAmit Uniyal proposed openstack/nova master: Delete dangling bdms  https://review.opendev.org/c/openstack/nova/+/88228414:29
opendevreviewDanylo Vodopianov proposed openstack/nova master: Packed virtqueue support was added.  https://review.opendev.org/c/openstack/nova/+/87607514:33
dvo-plvsean-k-mooney, I just uploaded test14:34
dvo-plvthe problem which I get see in the debugger, it does not achive this execption 14:36
dvo-plvhttps://github.com/openstack/nova/blob/master/nova/api/openstack/compute/servers.py#L108614:36
dvo-plvbut it achive this exception https://review.opendev.org/c/openstack/nova/+/876075/15/nova/virt/hardware.py#197114:37
dvo-plvI did not get the vector which I should to move14:43
dvo-plvI can see that  _resize method call > /opt/stack/nova/nova/conductor/tasks/migrate.py(345)_schedule()14:43
dvo-plv-> selection_lists = self.query_client.select_destinations(14:43
dvo-plvand this rescheduler calls self.query_client.select_destinations method which call my filter, which call excepetion conflict14:44
dansmithauniyal: do you want to get this fixed up so we can just merge it? https://review.opendev.org/c/openstack/nova/+/88575614:45
dvo-plvbut this exception does not affect on this https://github.com/openstack/nova/blob/master/nova/api/openstack/compute/servers.py#L108614:45
dansmithwe could do that before you fully fix the dangling bdms thing and then it will be off your plate and out of that stack14:45
dvo-plvit calls rpc server error instead of httconflict 15:07
dvo-plvhttps://paste.opendev.org/show/byeH5cOKuKPovlDt9rGh/15:07
dvo-plvit sets code 500 by default 15:11
dvo-plvhttps://paste.opendev.org/show/byB3mGcovbJN70D7KL6B/15:11
dvo-plvsean-k-mooney, conflict exception absent here: https://github.com/openstack/nova/blob/master/nova/conductor/manager.py#L29415:28
dvo-plvand here: https://github.com/openstack/nova/blob/master/nova/scheduler/manager.py#L14715:35
dvo-plvbut it does not help 15:35
auniyaldansmith, yes, MockPatch didn't work for me right now, so I removed WIP. later I might create new patch for same. if its fine we can merge this.15:39
dansmithauniyal: I commented about this, but you were using it as a context manager right? You need to use it as a fixture15:40
auniyalyes, context manager I tried earlier and also mock.patch('nova.volume.cinder.API.attachment_create', side_effect=self.fake_attachment_create).start()15:42
auniyalbut after your suggestion on MockPatch I started looking into it, but couldn't figure out it15:42
auniyalthis: $ grep 'Fixture.*MockPatch' -r nova/tests15:43
dansmith$ grep 'fixtures.*Mock' -r nova/tests | wc -l                                                                       ✭reimage-timeout15:45
dansmith18115:45
auniyalyes, it was your comment actually, 15:49
auniyalthe files it shows has example of MockPatch15:49
auniyalso I went through them, and tried to apply on cinder fixture, but it did not work, 15:50
auniyalI got the control-flow though15:50
dansmithokay I'm confused15:51
sean-k-mooneydvo-plv: so we seam to be getting to select destination before that runs which is far too late15:53
sean-k-mooneydvo-plv: you should be checkign the image compatibality in _validate_flavor_image_nostatus https://github.com/openstack/nova/blob/4b454febf73cdd7b5be0a2dad272c1d7685fac9e/nova/compute/api.py#L718-L83315:55
sean-k-mooneyfor resize its invoked here https://github.com/openstack/nova/blob/4b454febf73cdd7b5be0a2dad272c1d7685fac9e/nova/compute/api.py#L4253-L4272 but its also used in create and rebuild15:56
sean-k-mooneydvo-plv: _validate_flavor_image_nostatus is the common place in the api that is ment to check compaitble before we ever do a api request to placemnt or an rpc to the conductor15:57
sean-k-mooneyyou will also need to put a call to the check here too https://github.com/openstack/nova/blob/4b454febf73cdd7b5be0a2dad272c1d7685fac9e/nova/compute/api.py#L426816:00
sean-k-mooneyto validate the bfv path16:00
dvo-plvMaybe it will be better to call this https://review.opendev.org/c/openstack/nova/+/876075/15/nova/virt/hardware.py#1971 before this statement 16:02
dvo-plvhttps://github.com/openstack/nova/blob/4b454febf73cdd7b5be0a2dad272c1d7685fac9e/nova/compute/api.py#L426616:02
dvo-plvto call both if and else ?16:02
dvo-plvto catch both if and else16:02
dvo-plvAlso I need to handle rebuild somewhere 16:02
*** LarsErik1 is now known as LarsErikP19:07

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