)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":12393,"name":"chandan kumar","display_name":"Chandan Kumar","email":"chkumar@redhat.com","username":"chkumar246"},"change_message_id":"86a5d099edfa08f827d147a47a388bfc860755c5","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"5a5d1490_ea83ef19","updated":"2025-06-04 07:29:03.000000000","message":"+1 for adding more debug message!","commit_id":"d82018596a03f17cbdbf947f5acc5ab081c67511"},{"author":{"_account_id":34452,"name":"Joan Gilabert","display_name":"jgilaber","email":"jgilaber@redhat.com","username":"jgilaber"},"change_message_id":"5c0eaae390c2adaa45993d9f4d39d7d911916116","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"b663c310_6c804d6b","updated":"2025-06-03 15:54:10.000000000","message":"looks good, and will be helpful for the user","commit_id":"d82018596a03f17cbdbf947f5acc5ab081c67511"},{"author":{"_account_id":12393,"name":"chandan kumar","display_name":"Chandan Kumar","email":"chkumar@redhat.com","username":"chkumar246"},"change_message_id":"dfb1236b35e9c216f0cb50f2486bbc963426bf2d","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"5dcac921_3ad213d0","updated":"2025-06-04 07:28:42.000000000","message":"recheck","commit_id":"d82018596a03f17cbdbf947f5acc5ab081c67511"},{"author":{"_account_id":34452,"name":"Joan Gilabert","display_name":"jgilaber","email":"jgilaber@redhat.com","username":"jgilaber"},"change_message_id":"0b5506e5b62d25a52a09386b8d0fbaadf33b6ac9","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"9ad2fb44_56ae198c","updated":"2025-06-16 13:01:20.000000000","message":"adding the vote again","commit_id":"c39fe710bac586ad97eb3e72414c501813bf1b91"},{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"7337dff43a2fe44ac11921fb5ee9bf836609541d","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"cf006190_c09e558f","updated":"2025-06-05 16:56:48.000000000","message":"code looks good, but I couldn\u0027t find a test for workload_balance to check the logs there :/","commit_id":"c39fe710bac586ad97eb3e72414c501813bf1b91"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"6d9924a0250060a3f97fca517a07bc98975ee0ff","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"da0076ad_f0118c42","in_reply_to":"cf006190_c09e558f","updated":"2025-06-10 11:16:46.000000000","message":"You have https://review.opendev.org/c/openstack/watcher-tempest-plugin/+/950335 which has depends-on this one, i.e.:\n\nhttps://storage.gra.cloud.ovh.net/v1/AUTH_dcaab5e32b234d56b626f72581e3644c/zuul_opendev_logs_19a/openstack/19a13905080f48068eb255c2e0c7f460/controller/logs/screen-watcher-decision-engine.txt\n\nJun 09 15:38:50.747938 np0041065212 watcher-decision-engine[101026]: DEBUG watcher.decision_engine.strategy.strategies.workload_balance [None req-baf4359c-5005-4e1e-9227-a7f919eb0c3b None None] Host usage for (a395e7ec-a4df-4ba9-b3e6-548bada3edbf): host_cpu_usage_percent is 0.000000, lower than threshold 1.000000 {{(pid\u003d101026) group_hosts_by_cpu_or_ram_util /opt/stack/watcher/watcher/decision_engine/strategy/strategies/workload_balance.py:286}}\n\nJun 09 15:38:50.870230 np0041065212 watcher-decision-engine[101026]: DEBUG watcher.decision_engine.strategy.strategies.workload_balance [None req-baf4359c-5005-4e1e-9227-a7f919eb0c3b None None] Host usage for (66d244cb-2131-44cb-918f-3c1f6197256a): host_cpu_usage_percent is 88.934769, higher than threshold 1.000000 {{(pid\u003d101026) group_hosts_by_cpu_or_ram_util /opt/stack/watcher/watcher/decision_engine/strategy/strategies/workload_balance.py:281}}\n\nJun 09 15:45:02.291631 np0041065212 watcher-decision-engine[101026]: DEBUG watcher.decision_engine.strategy.strategies.workload_balance [None req-4e184c79-e002-4c38-94fd-de750df8dbd3 None None] Host usage for (a395e7ec-a4df-4ba9-b3e6-548bada3edbf): host_ram_usage_percent is 0.000000, lower than threshold 2.000000 {{(pid\u003d101026) group_hosts_by_cpu_or_ram_util /opt/stack/watcher/watcher/decision_engine/strategy/strategies/workload_balance.py:286}}\n\nJun 09 15:45:02.321102 np0041065212 watcher-decision-engine[101026]: DEBUG watcher.decision_engine.strategy.strategies.workload_balance [None req-4e184c79-e002-4c38-94fd-de750df8dbd3 None None] Host usage for (66d244cb-2131-44cb-918f-3c1f6197256a): host_ram_usage_percent is 8.411792, higher than threshold 2.000000 {{(pid\u003d101026) group_hosts_by_cpu_or_ram_util /opt/stack/watcher/watcher/decision_engine/strategy/strategies/workload_balance.py:281}}\n\nand\n\nJun 09 15:38:50.872338 np0041065212 watcher-decision-engine[101026]: DEBUG watcher.decision_engine.strategy.strategies.workload_balance [None req-baf4359c-5005-4e1e-9227-a7f919eb0c3b None None] Host np0041065213 skipped as destination for 6747c637-5220-48aa-862e-bbe2ca87574a as host cpu usage would be 11.224082 which is higher that threshold 1 {{(pid\u003d101026) filter_destination_hosts /opt/stack/watcher/watcher/decision_engine/strategy/strategies/workload_balance.py:200}}","commit_id":"c39fe710bac586ad97eb3e72414c501813bf1b91"},{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"41530ac509403ca9734eb4da7e32f5a8e1d2f81b","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"4b2a6b01_16f91e71","in_reply_to":"da0076ad_f0118c42","updated":"2025-06-13 14:11:40.000000000","message":"Thanks for sharing this Alfredo.","commit_id":"c39fe710bac586ad97eb3e72414c501813bf1b91"},{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"a7e35f98d6a35318798f7478e9951a9d00847a17","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":4,"id":"431b372c_bc8cc552","updated":"2025-06-18 11:52:01.000000000","message":"LGTM, thanks for adding more unit tests!\nI can see these logs in CI job from another patch [1]:\n\n```\nHost np0041156952 evaluated as destination for 94366dda-b2f4-48ec-a4b6-e4ce18cf35b3. Host usage for cpu would be 6.778409090909091.The threshold is: 20. selected: True\n```\n\n[1]: https://fade954140882f399441-e5788b19bd89c28fd446f909c1b0ae99.ssl.cf1.rackcdn.com/openstack/9169bc5a7d0f459ca9bee4365fb6bff2/controller/logs/screen-watcher-decision-engine.txt","commit_id":"1529e3faddf27ee4e0bdab8fd932f7e9f2aedeaa"}],"watcher/decision_engine/strategy/strategies/workload_balance.py":[{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"96785b6ac954d0130bcb7ca364611b8aab04334f","unresolved":true,"context_lines":[{"line_number":196,"context_line":"                    ((src_instance_workload + workload) \u003c"},{"line_number":197,"context_line":"                     self.threshold / 100 * host.vcpus)):"},{"line_number":198,"context_line":"                    destination_hosts.append(instance_data)"},{"line_number":199,"context_line":"                elif self._meter \u003d\u003d \u0027instance_cpu_usage\u0027:"},{"line_number":200,"context_line":"                    LOG.debug(\"Host %s skipped as destination for %s as host \""},{"line_number":201,"context_line":"                              \"cpu usage would be %f which is higher that \""},{"line_number":202,"context_line":"                              \"threshold %s\","}],"source_content_type":"text/x-python","patch_set":2,"id":"de976979_cced1bb7","line":199,"updated":"2025-06-17 12:21:09.000000000","message":"by the way in v2 this had no unit test coverage\n\nhttps://51b862355f8b2cc3358d-6f76ca65e5801c05e86d356ab1b2046b.ssl.cf2.rackcdn.com/openstack/5236c2835eb047bda8e01d34ae4c1854/cover/z_65cb95e032a919a1_workload_balance_py.html#t199\n\nwhiel im less strict on fully unit test coverage then other i do think that if we add a log message we shoudl alwasy make sure it is at least\nexecuted in our unit test suite.\n\nYou can add a new test to assert that it is logged with the expected message but at a minimum, we should not be adding new lines with no coverage like this.\n\ni have seen incorrectly formatted log lines cause production outages before.\n\nOur logging fixture will, at a minimum ensure that the logs are correctly formatable but only if they are execuite in a test.","commit_id":"c39fe710bac586ad97eb3e72414c501813bf1b91"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"ce6026fdc2fb0673b387fd236762efd2a7c54bbe","unresolved":true,"context_lines":[{"line_number":192,"context_line":"            if (free_res[\u0027vcpu\u0027] \u003e\u003d required_cores and"},{"line_number":193,"context_line":"                    free_res[\u0027memory\u0027] \u003e\u003d required_mem and"},{"line_number":194,"context_line":"                    free_res[\u0027disk\u0027] \u003e\u003d required_disk):"},{"line_number":195,"context_line":"                if (self._meter \u003d\u003d \u0027instance_cpu_usage\u0027 and"},{"line_number":196,"context_line":"                    ((src_instance_workload + workload) \u003c"},{"line_number":197,"context_line":"                     self.threshold / 100 * host.vcpus)):"},{"line_number":198,"context_line":"                    destination_hosts.append(instance_data)"},{"line_number":199,"context_line":"                elif self._meter \u003d\u003d \u0027instance_cpu_usage\u0027:"},{"line_number":200,"context_line":"                    LOG.debug(\"Host %s skipped as destination for %s as host \""},{"line_number":201,"context_line":"                              \"cpu usage would be %f which is higher that \""},{"line_number":202,"context_line":"                              \"threshold %s\","},{"line_number":203,"context_line":"                              host.hostname, instance_to_migrate.uuid,"},{"line_number":204,"context_line":"                              (src_instance_workload + workload) *"},{"line_number":205,"context_line":"                              100 / host.vcpus,"},{"line_number":206,"context_line":"                              self.threshold)"},{"line_number":207,"context_line":"                if (self._meter \u003d\u003d \u0027instance_ram_usage\u0027 and"},{"line_number":208,"context_line":"                    ((src_instance_workload + workload) \u003c"},{"line_number":209,"context_line":"                     self.threshold / 100 * host.memory)):"}],"source_content_type":"text/x-python","patch_set":2,"id":"83868ba2_4f1ef89e","line":206,"range":{"start_line":195,"start_character":15,"end_line":206,"end_character":45},"updated":"2025-06-16 14:38:36.000000000","message":"im not a fan of this approch.\nspecificly i do not like repeatign the algortiom in two places.\ni also think if we are going to add this debug log we shoudl alwasy print it.\n\n```suggestion\n                if self._meter \u003d\u003d \u0027instance_cpu_usage\u0027:\n                    usage \u003d src_instance_workload + workload\n                    scale \u003d 100 * host.vcpus\n                    limit \u003d self.threshold / scale )\n                     if usage \u003c limit:\n                        destination_hosts.append(instance_data)\n                     LOG.debug(f\"Host {host.hostname} evaluated as destination for \"\n                               f\"{instance_to_migrate.uuid}. Host \"\n                               f\"cpu usage would be  {usage/scale}.\"\n                               f\"the threshold is: {self.threshold}.\",\n                               f\"selected: {usage \u003c limit}\"\n                               )\n```","commit_id":"c39fe710bac586ad97eb3e72414c501813bf1b91"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"16b2fd81bf887a65adb12eccd7bb35c45a02189e","unresolved":true,"context_lines":[{"line_number":192,"context_line":"            if (free_res[\u0027vcpu\u0027] \u003e\u003d required_cores and"},{"line_number":193,"context_line":"                    free_res[\u0027memory\u0027] \u003e\u003d required_mem and"},{"line_number":194,"context_line":"                    free_res[\u0027disk\u0027] \u003e\u003d required_disk):"},{"line_number":195,"context_line":"                if (self._meter \u003d\u003d \u0027instance_cpu_usage\u0027 and"},{"line_number":196,"context_line":"                    ((src_instance_workload + workload) \u003c"},{"line_number":197,"context_line":"                     self.threshold / 100 * host.vcpus)):"},{"line_number":198,"context_line":"                    destination_hosts.append(instance_data)"},{"line_number":199,"context_line":"                elif self._meter \u003d\u003d \u0027instance_cpu_usage\u0027:"},{"line_number":200,"context_line":"                    LOG.debug(\"Host %s skipped as destination for %s as host \""},{"line_number":201,"context_line":"                              \"cpu usage would be %f which is higher that \""},{"line_number":202,"context_line":"                              \"threshold %s\","},{"line_number":203,"context_line":"                              host.hostname, instance_to_migrate.uuid,"},{"line_number":204,"context_line":"                              (src_instance_workload + workload) *"},{"line_number":205,"context_line":"                              100 / host.vcpus,"},{"line_number":206,"context_line":"                              self.threshold)"},{"line_number":207,"context_line":"                if (self._meter \u003d\u003d \u0027instance_ram_usage\u0027 and"},{"line_number":208,"context_line":"                    ((src_instance_workload + workload) \u003c"},{"line_number":209,"context_line":"                     self.threshold / 100 * host.memory)):"}],"source_content_type":"text/x-python","patch_set":2,"id":"499f8f44_d4c550d7","line":206,"range":{"start_line":195,"start_character":15,"end_line":206,"end_character":45},"in_reply_to":"04029346_0235a474","updated":"2025-06-16 18:02:28.000000000","message":"i know that the data is being formatted/scaled differently btu i really don\u0027t like the use of elif here and that you are repeating much of the calculation \n\ni also dont like how you using % string here in genreal with positiaonl args.\n\nmy main poin tis i woudl prefer this ti use f string, and that we logged regardelss of if it was added as a destioantion or not.","commit_id":"c39fe710bac586ad97eb3e72414c501813bf1b91"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"c29a5fe97d9bb8453d5197dd5376c6c6eadcc0db","unresolved":false,"context_lines":[{"line_number":192,"context_line":"            if (free_res[\u0027vcpu\u0027] \u003e\u003d required_cores and"},{"line_number":193,"context_line":"                    free_res[\u0027memory\u0027] \u003e\u003d required_mem and"},{"line_number":194,"context_line":"                    free_res[\u0027disk\u0027] \u003e\u003d required_disk):"},{"line_number":195,"context_line":"                if (self._meter \u003d\u003d \u0027instance_cpu_usage\u0027 and"},{"line_number":196,"context_line":"                    ((src_instance_workload + workload) \u003c"},{"line_number":197,"context_line":"                     self.threshold / 100 * host.vcpus)):"},{"line_number":198,"context_line":"                    destination_hosts.append(instance_data)"},{"line_number":199,"context_line":"                elif self._meter \u003d\u003d \u0027instance_cpu_usage\u0027:"},{"line_number":200,"context_line":"                    LOG.debug(\"Host %s skipped as destination for %s as host \""},{"line_number":201,"context_line":"                              \"cpu usage would be %f which is higher that \""},{"line_number":202,"context_line":"                              \"threshold %s\","},{"line_number":203,"context_line":"                              host.hostname, instance_to_migrate.uuid,"},{"line_number":204,"context_line":"                              (src_instance_workload + workload) *"},{"line_number":205,"context_line":"                              100 / host.vcpus,"},{"line_number":206,"context_line":"                              self.threshold)"},{"line_number":207,"context_line":"                if (self._meter \u003d\u003d \u0027instance_ram_usage\u0027 and"},{"line_number":208,"context_line":"                    ((src_instance_workload + workload) \u003c"},{"line_number":209,"context_line":"                     self.threshold / 100 * host.memory)):"}],"source_content_type":"text/x-python","patch_set":2,"id":"6b51bf42_a3113984","line":206,"range":{"start_line":195,"start_character":15,"end_line":206,"end_character":45},"in_reply_to":"499f8f44_d4c550d7","updated":"2025-06-17 12:14:59.000000000","message":"Done","commit_id":"c39fe710bac586ad97eb3e72414c501813bf1b91"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"fdcf025ebe5a3f4f4019fd1df01bc5c6b786156b","unresolved":true,"context_lines":[{"line_number":192,"context_line":"            if (free_res[\u0027vcpu\u0027] \u003e\u003d required_cores and"},{"line_number":193,"context_line":"                    free_res[\u0027memory\u0027] \u003e\u003d required_mem and"},{"line_number":194,"context_line":"                    free_res[\u0027disk\u0027] \u003e\u003d required_disk):"},{"line_number":195,"context_line":"                if (self._meter \u003d\u003d \u0027instance_cpu_usage\u0027 and"},{"line_number":196,"context_line":"                    ((src_instance_workload + workload) \u003c"},{"line_number":197,"context_line":"                     self.threshold / 100 * host.vcpus)):"},{"line_number":198,"context_line":"                    destination_hosts.append(instance_data)"},{"line_number":199,"context_line":"                elif self._meter \u003d\u003d \u0027instance_cpu_usage\u0027:"},{"line_number":200,"context_line":"                    LOG.debug(\"Host %s skipped as destination for %s as host \""},{"line_number":201,"context_line":"                              \"cpu usage would be %f which is higher that \""},{"line_number":202,"context_line":"                              \"threshold %s\","},{"line_number":203,"context_line":"                              host.hostname, instance_to_migrate.uuid,"},{"line_number":204,"context_line":"                              (src_instance_workload + workload) *"},{"line_number":205,"context_line":"                              100 / host.vcpus,"},{"line_number":206,"context_line":"                              self.threshold)"},{"line_number":207,"context_line":"                if (self._meter \u003d\u003d \u0027instance_ram_usage\u0027 and"},{"line_number":208,"context_line":"                    ((src_instance_workload + workload) \u003c"},{"line_number":209,"context_line":"                     self.threshold / 100 * host.memory)):"}],"source_content_type":"text/x-python","patch_set":2,"id":"04029346_0235a474","line":206,"range":{"start_line":195,"start_character":15,"end_line":206,"end_character":45},"in_reply_to":"83868ba2_4f1ef89e","updated":"2025-06-16 17:32:31.000000000","message":"Actually, it is not repeating the same calculation. To compare, it is comparing the exected workload if the migration passes in total cpu in absolute number with the threshold in vcpus too.\n\nI\u0027m printing the expected cpu usage in % as, the threshold provided by the user is in that unit.","commit_id":"c39fe710bac586ad97eb3e72414c501813bf1b91"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"ce6026fdc2fb0673b387fd236762efd2a7c54bbe","unresolved":true,"context_lines":[{"line_number":215,"context_line":"                              host.hostname, instance_to_migrate.uuid,"},{"line_number":216,"context_line":"                              (src_instance_workload + workload) *"},{"line_number":217,"context_line":"                              100 / host.memory,"},{"line_number":218,"context_line":"                              self.threshold)"},{"line_number":219,"context_line":""},{"line_number":220,"context_line":"        return destination_hosts"},{"line_number":221,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"eb4bc2db_5bda8258","line":218,"updated":"2025-06-16 14:38:36.000000000","message":"same applies here i do not like repeatign the callulation and i think if\nwe are to to add a debug log we want ti for both branches.\n\ni.e. if its slecelcted as a destination or not.","commit_id":"c39fe710bac586ad97eb3e72414c501813bf1b91"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"16b2fd81bf887a65adb12eccd7bb35c45a02189e","unresolved":true,"context_lines":[{"line_number":215,"context_line":"                              host.hostname, instance_to_migrate.uuid,"},{"line_number":216,"context_line":"                              (src_instance_workload + workload) *"},{"line_number":217,"context_line":"                              100 / host.memory,"},{"line_number":218,"context_line":"                              self.threshold)"},{"line_number":219,"context_line":""},{"line_number":220,"context_line":"        return destination_hosts"},{"line_number":221,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"658d3423_38528e26","line":218,"in_reply_to":"5c91d9ad_dccd7921","updated":"2025-06-16 18:02:28.000000000","message":"my expirince form debuging nova for year is if you need to add debug logging for any branch you shoudl add it for all branches.\n\nso yes i woudl prefer if you updated this change","commit_id":"c39fe710bac586ad97eb3e72414c501813bf1b91"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"c29a5fe97d9bb8453d5197dd5376c6c6eadcc0db","unresolved":false,"context_lines":[{"line_number":215,"context_line":"                              host.hostname, instance_to_migrate.uuid,"},{"line_number":216,"context_line":"                              (src_instance_workload + workload) *"},{"line_number":217,"context_line":"                              100 / host.memory,"},{"line_number":218,"context_line":"                              self.threshold)"},{"line_number":219,"context_line":""},{"line_number":220,"context_line":"        return destination_hosts"},{"line_number":221,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"e9dce11c_72c08856","line":218,"in_reply_to":"658d3423_38528e26","updated":"2025-06-17 12:14:59.000000000","message":"Done","commit_id":"c39fe710bac586ad97eb3e72414c501813bf1b91"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"fdcf025ebe5a3f4f4019fd1df01bc5c6b786156b","unresolved":true,"context_lines":[{"line_number":215,"context_line":"                              host.hostname, instance_to_migrate.uuid,"},{"line_number":216,"context_line":"                              (src_instance_workload + workload) *"},{"line_number":217,"context_line":"                              100 / host.memory,"},{"line_number":218,"context_line":"                              self.threshold)"},{"line_number":219,"context_line":""},{"line_number":220,"context_line":"        return destination_hosts"},{"line_number":221,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"5c91d9ad_dccd7921","line":218,"in_reply_to":"eb4bc2db_5bda8258","updated":"2025-06-16 17:32:31.000000000","message":"Same, it\u0027s not the same calculation.\n\nThe compute node that is selected is in the action itself, so, imo that is not very important to have in debug messages. The fact to debug in this strategy is usually \"Why the strategy did not find any valid host to move an instance to?\", so that\u0027s why those log messages are relevant. If the strategy found the image. Said that, if you find that a blocker, i can add it.","commit_id":"c39fe710bac586ad97eb3e72414c501813bf1b91"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"2bb3220a10b60c5a0320a70cf112ef07371dac49","unresolved":true,"context_lines":[{"line_number":192,"context_line":"            if (free_res[\u0027vcpu\u0027] \u003e\u003d required_cores and"},{"line_number":193,"context_line":"                    free_res[\u0027memory\u0027] \u003e\u003d required_mem and"},{"line_number":194,"context_line":"                    free_res[\u0027disk\u0027] \u003e\u003d required_disk):"},{"line_number":195,"context_line":"                if self._meter \u003d\u003d \u0027instance_cpu_usage\u0027:"},{"line_number":196,"context_line":"                    usage \u003d src_instance_workload + workload"},{"line_number":197,"context_line":"                    usage_percent \u003d usage / host.vcpus * 100"},{"line_number":198,"context_line":"                    limit \u003d self.threshold / 100 * host.vcpus"},{"line_number":199,"context_line":"                    if usage \u003c limit:"},{"line_number":200,"context_line":"                        destination_hosts.append(instance_data)"},{"line_number":201,"context_line":"                if self._meter \u003d\u003d \u0027instance_ram_usage\u0027:"},{"line_number":202,"context_line":"                    usage \u003d src_instance_workload + workload"},{"line_number":203,"context_line":"                    usage_percent \u003d usage / host.memory * 100"},{"line_number":204,"context_line":"                    limit \u003d self.threshold / 100 * host.memory"},{"line_number":205,"context_line":"                    if usage \u003c limit:"},{"line_number":206,"context_line":"                        destination_hosts.append(instance_data)"},{"line_number":207,"context_line":"                LOG.debug(f\"Host {host.hostname} evaluated as destination \""},{"line_number":208,"context_line":"                          f\"for {instance_to_migrate.uuid}. Host usage \""},{"line_number":209,"context_line":"                          f\"for {self._meter} metric would be {usage_percent}.\""}],"source_content_type":"text/x-python","patch_set":3,"id":"eb2a0f85_36bee38a","line":206,"range":{"start_line":195,"start_character":16,"end_line":206,"end_character":63},"updated":"2025-06-17 12:28:38.000000000","message":"this is using a dangerous pattern in python that we shoudl avoid.\n\nif do not create a scope, however it consided bad practice in general to use a valiabel that is defiend only in an if block out side of the if.\n\nso if we follow this patther you shoudl alwasy pre-declare teh variables outside of the if block to avoid atribute erros if you do not initalise them in all branches.\n\nit woudl be better to put the log in the if.\n\ncurrently if  self._meter  is anythin other then instance_cpu_usage or instance_ram_usage\nit will rasie an atibute error because usage limit and usage_percentage are not defiend.\n\nin this case that is the full set of possibel meteres today btu this is not a patten we shoudl use lightly as it lead to hard to debug issues.","commit_id":"130c461910588ac181e0aaf872e24af492da0950"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"23e349ed488fbfc799033158a605640c7a449093","unresolved":false,"context_lines":[{"line_number":192,"context_line":"            if (free_res[\u0027vcpu\u0027] \u003e\u003d required_cores and"},{"line_number":193,"context_line":"                    free_res[\u0027memory\u0027] \u003e\u003d required_mem and"},{"line_number":194,"context_line":"                    free_res[\u0027disk\u0027] \u003e\u003d required_disk):"},{"line_number":195,"context_line":"                if self._meter \u003d\u003d \u0027instance_cpu_usage\u0027:"},{"line_number":196,"context_line":"                    usage \u003d src_instance_workload + workload"},{"line_number":197,"context_line":"                    usage_percent \u003d usage / host.vcpus * 100"},{"line_number":198,"context_line":"                    limit \u003d self.threshold / 100 * host.vcpus"},{"line_number":199,"context_line":"                    if usage \u003c limit:"},{"line_number":200,"context_line":"                        destination_hosts.append(instance_data)"},{"line_number":201,"context_line":"                if self._meter \u003d\u003d \u0027instance_ram_usage\u0027:"},{"line_number":202,"context_line":"                    usage \u003d src_instance_workload + workload"},{"line_number":203,"context_line":"                    usage_percent \u003d usage / host.memory * 100"},{"line_number":204,"context_line":"                    limit \u003d self.threshold / 100 * host.memory"},{"line_number":205,"context_line":"                    if usage \u003c limit:"},{"line_number":206,"context_line":"                        destination_hosts.append(instance_data)"},{"line_number":207,"context_line":"                LOG.debug(f\"Host {host.hostname} evaluated as destination \""},{"line_number":208,"context_line":"                          f\"for {instance_to_migrate.uuid}. Host usage \""},{"line_number":209,"context_line":"                          f\"for {self._meter} metric would be {usage_percent}.\""}],"source_content_type":"text/x-python","patch_set":3,"id":"569aa956_8db21418","line":206,"range":{"start_line":195,"start_character":16,"end_line":206,"end_character":63},"in_reply_to":"01886041_d29da336","updated":"2025-06-17 17:16:15.000000000","message":"Done","commit_id":"130c461910588ac181e0aaf872e24af492da0950"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"84ca3566dc3d864a07ae1bd38313edb3751b6fe8","unresolved":true,"context_lines":[{"line_number":192,"context_line":"            if (free_res[\u0027vcpu\u0027] \u003e\u003d required_cores and"},{"line_number":193,"context_line":"                    free_res[\u0027memory\u0027] \u003e\u003d required_mem and"},{"line_number":194,"context_line":"                    free_res[\u0027disk\u0027] \u003e\u003d required_disk):"},{"line_number":195,"context_line":"                if self._meter \u003d\u003d \u0027instance_cpu_usage\u0027:"},{"line_number":196,"context_line":"                    usage \u003d src_instance_workload + workload"},{"line_number":197,"context_line":"                    usage_percent \u003d usage / host.vcpus * 100"},{"line_number":198,"context_line":"                    limit \u003d self.threshold / 100 * host.vcpus"},{"line_number":199,"context_line":"                    if usage \u003c limit:"},{"line_number":200,"context_line":"                        destination_hosts.append(instance_data)"},{"line_number":201,"context_line":"                if self._meter \u003d\u003d \u0027instance_ram_usage\u0027:"},{"line_number":202,"context_line":"                    usage \u003d src_instance_workload + workload"},{"line_number":203,"context_line":"                    usage_percent \u003d usage / host.memory * 100"},{"line_number":204,"context_line":"                    limit \u003d self.threshold / 100 * host.memory"},{"line_number":205,"context_line":"                    if usage \u003c limit:"},{"line_number":206,"context_line":"                        destination_hosts.append(instance_data)"},{"line_number":207,"context_line":"                LOG.debug(f\"Host {host.hostname} evaluated as destination \""},{"line_number":208,"context_line":"                          f\"for {instance_to_migrate.uuid}. Host usage \""},{"line_number":209,"context_line":"                          f\"for {self._meter} metric would be {usage_percent}.\""}],"source_content_type":"text/x-python","patch_set":3,"id":"01886041_d29da336","line":206,"range":{"start_line":195,"start_character":16,"end_line":206,"end_character":63},"in_reply_to":"eb2a0f85_36bee38a","updated":"2025-06-17 14:24:52.000000000","message":"Good point, fixing it.","commit_id":"130c461910588ac181e0aaf872e24af492da0950"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"d54e9b75f2f05707099d0fc2baf87ef89a627b5a","unresolved":true,"context_lines":[{"line_number":279,"context_line":"                overload_hosts.append(instance_data)"},{"line_number":280,"context_line":"            else:"},{"line_number":281,"context_line":"                nonoverload_hosts.append(instance_data)"},{"line_number":282,"context_line":"            LOG.debug(f\"Host usage for {node_id}: {host_metric} is \""},{"line_number":283,"context_line":"                      f\"{node_util}. Higher than threshold {self.threshold}: \""},{"line_number":284,"context_line":"                      f\"{node_util \u003e\u003d self.threshold}\")"},{"line_number":285,"context_line":""},{"line_number":286,"context_line":"        avg_workload \u003d 0"},{"line_number":287,"context_line":"        if cluster_size !\u003d 0:"}],"source_content_type":"text/x-python","patch_set":4,"id":"103ab63c_87f30d8b","line":284,"range":{"start_line":282,"start_character":12,"end_line":284,"end_character":55},"updated":"2025-06-17 18:49:26.000000000","message":"this is also the same pattern i disliek for what its worht but i am ok with not respinnign this again.\n\nif it need a rebase feel free to refactor but im ok with this patch as is.","commit_id":"1529e3faddf27ee4e0bdab8fd932f7e9f2aedeaa"}],"watcher/tests/decision_engine/strategy/strategies/test_workload_balance.py":[{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"ab2033739ea707502a9dd5b71aced557cb21896b","unresolved":true,"context_lines":[{"line_number":122,"context_line":"                      \u002773b09e16-35b7-4922-804e-e8f5d9b740fc. Host usage for \u0027"},{"line_number":123,"context_line":"                      \u0027cpu would be 20.0.The threshold is: 25.0. selected: \u0027"},{"line_number":124,"context_line":"                      \u0027True\u0027)]"},{"line_number":125,"context_line":"        mock_debug.assert_has_calls(expected_calls, any_order\u003dTrue)"},{"line_number":126,"context_line":""},{"line_number":127,"context_line":"    @mock.patch.object(workload_balance.LOG, \u0027debug\u0027, autospec\u003dTrue)"},{"line_number":128,"context_line":"    def test_filter_destination_hosts_ram(self, mock_debug):"}],"source_content_type":"text/x-python","patch_set":4,"id":"55778b45_d6cdcc63","line":125,"updated":"2025-06-17 18:47:54.000000000","message":"+1 the any_order is kind of nice ot make this less fragile.","commit_id":"1529e3faddf27ee4e0bdab8fd932f7e9f2aedeaa"}]}
