)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dc3fed3bc91363e1bf1080aca8ca94d783482048","unresolved":false,"context_lines":[{"line_number":16,"context_line":""},{"line_number":17,"context_line":"This adds a new policy rule:"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"  os_compute_api:servers:show:host_status_unknown"},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"which controls whether a user can view the host status of UNKNOWN only."},{"line_number":22,"context_line":"This way, operators can allow users to get a hint about what to expect"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"3fa7e38b_3101f53a","line":19,"range":{"start_line":19,"start_character":2,"end_line":19,"end_character":16},"updated":"2019-10-18 22:00:56.000000000","message":"We should probably take the opportunity to follow the new policy rule naming guidelines:\n\nhttps://docs.openstack.org/oslo.policy/latest/user/usage.html#naming-policies\n\nSo I think that just means making this:\n\n  compute:servers:show:host_status_unknown\n\nCould ask gmann what he thinks as well. There is an argument for having consistency with the existing policy rule here.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"c7c67f2e29b19cd57b6034bd2385488718e54923","unresolved":false,"context_lines":[{"line_number":16,"context_line":""},{"line_number":17,"context_line":"This adds a new policy rule:"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"  os_compute_api:servers:show:host_status_unknown"},{"line_number":20,"context_line":""},{"line_number":21,"context_line":"which controls whether a user can view the host status of UNKNOWN only."},{"line_number":22,"context_line":"This way, operators can allow users to get a hint about what to expect"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"3fa7e38b_a960f236","line":19,"range":{"start_line":19,"start_character":2,"end_line":19,"end_character":16},"in_reply_to":"3fa7e38b_3101f53a","updated":"2019-10-23 00:14:20.000000000","message":"Ack, didn\u0027t know about the new naming policy until now. I think I\u0027d expect consistency here with existing policy rules, but will change it if gmann thinks I should.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"}],"nova/api/openstack/compute/views/servers.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dc3fed3bc91363e1bf1080aca8ca94d783482048","unresolved":false,"context_lines":[{"line_number":330,"context_line":"                                          bdms,"},{"line_number":331,"context_line":"                                          add_delete_on_termination)"},{"line_number":332,"context_line":"        if (api_version_request.is_supported(request, min_version\u003d\u00272.16\u0027)):"},{"line_number":333,"context_line":"            if show_host_status is None:"},{"line_number":334,"context_line":"                unknown_only \u003d None"},{"line_number":335,"context_line":"                if context.can("},{"line_number":336,"context_line":"                        servers_policies.SERVERS % \u0027show:host_status\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_b12e45a9","line":333,"range":{"start_line":333,"start_character":12,"end_line":333,"end_character":40},"updated":"2019-10-18 22:00:56.000000000","message":"And this is None in the single server case, i.e. server show, rebuild and update responses (GET /servers/detail is handled separately below).","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dc3fed3bc91363e1bf1080aca8ca94d783482048","unresolved":false,"context_lines":[{"line_number":331,"context_line":"                                          add_delete_on_termination)"},{"line_number":332,"context_line":"        if (api_version_request.is_supported(request, min_version\u003d\u00272.16\u0027)):"},{"line_number":333,"context_line":"            if show_host_status is None:"},{"line_number":334,"context_line":"                unknown_only \u003d None"},{"line_number":335,"context_line":"                if context.can("},{"line_number":336,"context_line":"                        servers_policies.SERVERS % \u0027show:host_status\u0027,"},{"line_number":337,"context_line":"                        fatal\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_11a63955","line":334,"updated":"2019-10-18 22:00:56.000000000","message":"There is some pretty hairy logic in this block - would be good to have some code comments.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"c7c67f2e29b19cd57b6034bd2385488718e54923","unresolved":false,"context_lines":[{"line_number":331,"context_line":"                                          add_delete_on_termination)"},{"line_number":332,"context_line":"        if (api_version_request.is_supported(request, min_version\u003d\u00272.16\u0027)):"},{"line_number":333,"context_line":"            if show_host_status is None:"},{"line_number":334,"context_line":"                unknown_only \u003d None"},{"line_number":335,"context_line":"                if context.can("},{"line_number":336,"context_line":"                        servers_policies.SERVERS % \u0027show:host_status\u0027,"},{"line_number":337,"context_line":"                        fatal\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_695afa83","line":334,"in_reply_to":"3fa7e38b_037ca1e9","updated":"2019-10-23 00:14:20.000000000","message":"Ack, will add some code comments and info to policy doc.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":8556,"name":"Ghanshyam Maan","display_name":"Ghanshyam Maan","email":"gmaan.os14@gmail.com","username":"ghanshyam"},"change_message_id":"e625e04817b15fbf6c5ec9a16b6c5ba61a45590c","unresolved":false,"context_lines":[{"line_number":331,"context_line":"                                          add_delete_on_termination)"},{"line_number":332,"context_line":"        if (api_version_request.is_supported(request, min_version\u003d\u00272.16\u0027)):"},{"line_number":333,"context_line":"            if show_host_status is None:"},{"line_number":334,"context_line":"                unknown_only \u003d None"},{"line_number":335,"context_line":"                if context.can("},{"line_number":336,"context_line":"                        servers_policies.SERVERS % \u0027show:host_status\u0027,"},{"line_number":337,"context_line":"                        fatal\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_037ca1e9","line":334,"in_reply_to":"3fa7e38b_11a63955","updated":"2019-10-21 15:54:28.000000000","message":"yeah + clear policy doc also. basically we have \u0027os_compute_api:servers:show:host_status\u0027 policy is for showing the host with all status and new policy \u0027os_compute_api:servers:show:host_status_unknown\u0027 is for UNKNOWN status only when \u0027os_compute_api:servers:show:host_status\u0027 is false.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dc3fed3bc91363e1bf1080aca8ca94d783482048","unresolved":false,"context_lines":[{"line_number":336,"context_line":"                        servers_policies.SERVERS % \u0027show:host_status\u0027,"},{"line_number":337,"context_line":"                        fatal\u003dFalse):"},{"line_number":338,"context_line":"                    unknown_only \u003d False"},{"line_number":339,"context_line":"                elif context.can("},{"line_number":340,"context_line":"                        servers_policies.SERVERS % \u0027show:host_status_unknown\u0027,"},{"line_number":341,"context_line":"                        fatal\u003dFalse):"},{"line_number":342,"context_line":"                    unknown_only \u003d True"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_d14e6195","line":339,"updated":"2019-10-18 22:00:56.000000000","message":"OK so failing the policy check above, this checks to see if the user can get host_status if the value is UNKNOWN, otherwise if they pass the policy check above they can view any host_status value.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dc3fed3bc91363e1bf1080aca8ca94d783482048","unresolved":false,"context_lines":[{"line_number":340,"context_line":"                        servers_policies.SERVERS % \u0027show:host_status_unknown\u0027,"},{"line_number":341,"context_line":"                        fatal\u003dFalse):"},{"line_number":342,"context_line":"                    unknown_only \u003d True"},{"line_number":343,"context_line":"                if unknown_only is not None:"},{"line_number":344,"context_line":"                    host_status \u003d self.compute_api.get_instance_host_status("},{"line_number":345,"context_line":"                                      instance)"},{"line_number":346,"context_line":"                    if (not unknown_only or"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_7143ed6d","line":343,"updated":"2019-10-18 22:00:56.000000000","message":"And if unknown_only is None it means they failed both policy checks and don\u0027t get to see host_status.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dc3fed3bc91363e1bf1080aca8ca94d783482048","unresolved":false,"context_lines":[{"line_number":343,"context_line":"                if unknown_only is not None:"},{"line_number":344,"context_line":"                    host_status \u003d self.compute_api.get_instance_host_status("},{"line_number":345,"context_line":"                                      instance)"},{"line_number":346,"context_line":"                    if (not unknown_only or"},{"line_number":347,"context_line":"                            host_status \u003d\u003d fields.HostStatus.UNKNOWN):"},{"line_number":348,"context_line":"                        server[\"server\"][\u0027host_status\u0027] \u003d host_status"},{"line_number":349,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_315d7548","line":346,"updated":"2019-10-18 22:00:56.000000000","message":"OK and this is the user can either (1) see all host_status values or (2) can only see UNKNOWN.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dc3fed3bc91363e1bf1080aca8ca94d783482048","unresolved":false,"context_lines":[{"line_number":413,"context_line":"                                       cell_down_support\u003dcell_down_support)"},{"line_number":414,"context_line":""},{"line_number":415,"context_line":"        if api_version_request.is_supported(request, min_version\u003d\u00272.16\u0027):"},{"line_number":416,"context_line":"            unknown_only \u003d None"},{"line_number":417,"context_line":"            if context.can("},{"line_number":418,"context_line":"                    servers_policies.SERVERS % \u0027show:host_status\u0027,"},{"line_number":419,"context_line":"                    fatal\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_f17d9db2","line":416,"updated":"2019-10-18 22:00:56.000000000","message":"Same comment about comments.\n\nAlso, if this is mostly duplicated with the code in show() can we pull the common bits out into a private helper method?\n\nMaybe the only common piece would be the conditional logic for determine the unknown_only value but that\u0027s better than duplication IMO.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"c7c67f2e29b19cd57b6034bd2385488718e54923","unresolved":false,"context_lines":[{"line_number":413,"context_line":"                                       cell_down_support\u003dcell_down_support)"},{"line_number":414,"context_line":""},{"line_number":415,"context_line":"        if api_version_request.is_supported(request, min_version\u003d\u00272.16\u0027):"},{"line_number":416,"context_line":"            unknown_only \u003d None"},{"line_number":417,"context_line":"            if context.can("},{"line_number":418,"context_line":"                    servers_policies.SERVERS % \u0027show:host_status\u0027,"},{"line_number":419,"context_line":"                    fatal\u003dFalse):"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_895df67a","line":416,"in_reply_to":"3fa7e38b_f17d9db2","updated":"2019-10-23 00:14:20.000000000","message":"Yeah, it\u0027s not quite the same but I can do the common part in a helper method.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dc3fed3bc91363e1bf1080aca8ca94d783482048","unresolved":false,"context_lines":[{"line_number":418,"context_line":"                    servers_policies.SERVERS % \u0027show:host_status\u0027,"},{"line_number":419,"context_line":"                    fatal\u003dFalse):"},{"line_number":420,"context_line":"                unknown_only \u003d False"},{"line_number":421,"context_line":"            elif context.can("},{"line_number":422,"context_line":"                    servers_policies.SERVERS % \u0027show:host_status_unknown\u0027,"},{"line_number":423,"context_line":"                    fatal\u003dFalse):"},{"line_number":424,"context_line":"                unknown_only \u003d True"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_8c2a122a","line":421,"updated":"2019-10-18 22:00:56.000000000","message":"Looking at the coverage report this condition isn\u0027t tested:\n\nhttps://openstack.fortnebula.com:13808/v1/AUTH_e8fd161dc34c421a979a9e6421f823e9/logs_81/679181/1/check/openstack-tox-cover/e5e79cf/cover/nova_api_openstack_compute_views_servers_py.html","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"c7c67f2e29b19cd57b6034bd2385488718e54923","unresolved":false,"context_lines":[{"line_number":418,"context_line":"                    servers_policies.SERVERS % \u0027show:host_status\u0027,"},{"line_number":419,"context_line":"                    fatal\u003dFalse):"},{"line_number":420,"context_line":"                unknown_only \u003d False"},{"line_number":421,"context_line":"            elif context.can("},{"line_number":422,"context_line":"                    servers_policies.SERVERS % \u0027show:host_status_unknown\u0027,"},{"line_number":423,"context_line":"                    fatal\u003dFalse):"},{"line_number":424,"context_line":"                unknown_only \u003d True"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_a9c5520c","line":421,"in_reply_to":"3fa7e38b_8c2a122a","updated":"2019-10-23 00:14:20.000000000","message":"Ah, nice catch. I\u0027m new to knowing how to read the coverage report, cool stuff. I\u0027ll be sure to use it from now on.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dc3fed3bc91363e1bf1080aca8ca94d783482048","unresolved":false,"context_lines":[{"line_number":615,"context_line":"            # we had to filter the list of instances above for down cells."},{"line_number":616,"context_line":"            if server[\u0027id\u0027] in host_statuses:"},{"line_number":617,"context_line":"                host_status \u003d host_statuses[server[\u0027id\u0027]]"},{"line_number":618,"context_line":"                if unknown_only and host_status !\u003d fields.HostStatus.UNKNOWN:"},{"line_number":619,"context_line":"                    continue"},{"line_number":620,"context_line":"                server[\u0027host_status\u0027] \u003d host_status"},{"line_number":621,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_ec47064c","line":618,"updated":"2019-10-18 22:00:56.000000000","message":"A simple comment here might be good, something like \"Filter servers that are not allowed by policy to see host_status values other than UNKNOWN.\"","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"c7c67f2e29b19cd57b6034bd2385488718e54923","unresolved":false,"context_lines":[{"line_number":615,"context_line":"            # we had to filter the list of instances above for down cells."},{"line_number":616,"context_line":"            if server[\u0027id\u0027] in host_statuses:"},{"line_number":617,"context_line":"                host_status \u003d host_statuses[server[\u0027id\u0027]]"},{"line_number":618,"context_line":"                if unknown_only and host_status !\u003d fields.HostStatus.UNKNOWN:"},{"line_number":619,"context_line":"                    continue"},{"line_number":620,"context_line":"                server[\u0027host_status\u0027] \u003d host_status"},{"line_number":621,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_69cf5a29","line":618,"in_reply_to":"3fa7e38b_ec47064c","updated":"2019-10-23 00:14:20.000000000","message":"Will do.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"f2a31fbe5978125ba5d2c3994b23d7ec5ccdd7b6","unresolved":false,"context_lines":[{"line_number":186,"context_line":"        return ret"},{"line_number":187,"context_line":""},{"line_number":188,"context_line":"    @staticmethod"},{"line_number":189,"context_line":"    def _get_unknown_only(context):"},{"line_number":190,"context_line":"        # We will use the unknown_only variable to tell us what host status we"},{"line_number":191,"context_line":"        # can show, if any:"},{"line_number":192,"context_line":"        #   * unknown_only \u003d False means we can show any host status."}],"source_content_type":"text/x-python","patch_set":4,"id":"3fa7e38b_e60cb395","line":189,"range":{"start_line":189,"start_character":8,"end_line":189,"end_character":25},"updated":"2019-10-24 15:27:47.000000000","message":"nit: I\u0027d name this _get_host_status_unknown_only since it looks a bit strange on its own without the host_status context in the method name.","commit_id":"e80580ddc5393ce10ca23c51054b7151e1a477ea"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"b2f716c85d2fee41db47f937e522557cabee5dd1","unresolved":false,"context_lines":[{"line_number":186,"context_line":"        return ret"},{"line_number":187,"context_line":""},{"line_number":188,"context_line":"    @staticmethod"},{"line_number":189,"context_line":"    def _get_unknown_only(context):"},{"line_number":190,"context_line":"        # We will use the unknown_only variable to tell us what host status we"},{"line_number":191,"context_line":"        # can show, if any:"},{"line_number":192,"context_line":"        #   * unknown_only \u003d False means we can show any host status."}],"source_content_type":"text/x-python","patch_set":4,"id":"3fa7e38b_5c90f695","line":189,"range":{"start_line":189,"start_character":8,"end_line":189,"end_character":25},"in_reply_to":"3fa7e38b_e60cb395","updated":"2019-10-24 16:41:25.000000000","message":"Done","commit_id":"e80580ddc5393ce10ca23c51054b7151e1a477ea"},{"author":{"_account_id":8556,"name":"Ghanshyam Maan","display_name":"Ghanshyam Maan","email":"gmaan.os14@gmail.com","username":"ghanshyam"},"change_message_id":"006b8153fda83fbcca6c3b1707c0f4982974ea73","unresolved":false,"context_lines":[{"line_number":358,"context_line":"                                          bdms,"},{"line_number":359,"context_line":"                                          add_delete_on_termination)"},{"line_number":360,"context_line":"        if (api_version_request.is_supported(request, min_version\u003d\u00272.16\u0027)):"},{"line_number":361,"context_line":"            if show_host_status is None:"},{"line_number":362,"context_line":"                unknown_only \u003d self._get_host_status_unknown_only(context)"},{"line_number":363,"context_line":"                # If we\u0027re not allowed by policy to show host status at all,"},{"line_number":364,"context_line":"                # don\u0027t bother requesting instance host status from the compute"}],"source_content_type":"text/x-python","patch_set":7,"id":"3fa7e38b_ee0473c8","line":361,"range":{"start_line":361,"start_character":1,"end_line":361,"end_character":40},"updated":"2019-10-25 18:29:43.000000000","message":"this is keeping the \u003c2.75 behaviours same way where no host_status in rebuild and PUT API response.","commit_id":"cc425f0b75e694b824187e05a39b3ef03bcf992e"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"c39c040a9dab0e0344bc5b2056a713331622a264","unresolved":false,"context_lines":[{"line_number":187,"context_line":""},{"line_number":188,"context_line":"    @staticmethod"},{"line_number":189,"context_line":"    def _get_host_status_unknown_only(context):"},{"line_number":190,"context_line":"        # We will use the unknown_only variable to tell us what host status we"},{"line_number":191,"context_line":"        # can show, if any:"},{"line_number":192,"context_line":"        #   * unknown_only \u003d False means we can show any host status."},{"line_number":193,"context_line":"        #   * unknown_only \u003d True means that we can only show host"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_051417e8","line":190,"updated":"2019-10-30 15:00:20.000000000","message":"micronit, this could be a docstring","commit_id":"f9c608924482eb8f3db403b8f49d3d885fed5997"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"c39c040a9dab0e0344bc5b2056a713331622a264","unresolved":false,"context_lines":[{"line_number":192,"context_line":"        #   * unknown_only \u003d False means we can show any host status."},{"line_number":193,"context_line":"        #   * unknown_only \u003d True means that we can only show host"},{"line_number":194,"context_line":"        #     status: UNKNOWN. If the host status is anything other than"},{"line_number":195,"context_line":"        #     UNKNOWN, we will not include the host_status field in the"},{"line_number":196,"context_line":"        #     response."},{"line_number":197,"context_line":"        #   * unknown_only \u003d None means we cannot show host status at all and"},{"line_number":198,"context_line":"        #     we will not include the host_status field in the response."}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_451e8f0c","line":195,"range":{"start_line":195,"start_character":31,"end_line":195,"end_character":64},"updated":"2019-10-30 15:00:20.000000000","message":"nts: come back to this. The bp says we\u0027ll include the field with value \"\" (empty string).\n\n[Later] Okay, it looks like we actually would omit it entirely. Should we update the bp text accordingly?","commit_id":"f9c608924482eb8f3db403b8f49d3d885fed5997"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"c39c040a9dab0e0344bc5b2056a713331622a264","unresolved":false,"context_lines":[{"line_number":195,"context_line":"        #     UNKNOWN, we will not include the host_status field in the"},{"line_number":196,"context_line":"        #     response."},{"line_number":197,"context_line":"        #   * unknown_only \u003d None means we cannot show host status at all and"},{"line_number":198,"context_line":"        #     we will not include the host_status field in the response."},{"line_number":199,"context_line":"        unknown_only \u003d None"},{"line_number":200,"context_line":"        # Check show:host_status policy first because if it passes, we know we"},{"line_number":201,"context_line":"        # can show any host status and need not check the more restrictive"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_e5169bf2","line":198,"range":{"start_line":198,"start_character":22,"end_line":198,"end_character":55},"updated":"2019-10-30 15:00:20.000000000","message":"ditto","commit_id":"f9c608924482eb8f3db403b8f49d3d885fed5997"}],"nova/policies/servers.py":[{"author":{"_account_id":8556,"name":"Ghanshyam Maan","display_name":"Ghanshyam Maan","email":"gmaan.os14@gmail.com","username":"ghanshyam"},"change_message_id":"e625e04817b15fbf6c5ec9a16b6c5ba61a45590c","unresolved":false,"context_lines":[{"line_number":92,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":93,"context_line":"        SERVERS % \u0027show:host_status\u0027,"},{"line_number":94,"context_line":"        base.RULE_ADMIN_API,"},{"line_number":95,"context_line":"        \"Show a server with additional host status information\","},{"line_number":96,"context_line":"        ["},{"line_number":97,"context_line":"            {"},{"line_number":98,"context_line":"                \u0027method\u0027: \u0027GET\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_5ee4ae0e","line":95,"range":{"start_line":95,"start_character":0,"end_line":95,"end_character":64},"updated":"2019-10-21 15:54:28.000000000","message":"it will also good to explain this this policy in more clear word like This means host_status will be shown irrespective of status value. If you want to show only UNKNOWN host then make this false and use policy \u0027os_compute_api:servers:show:host_status_unknown\u0027.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"c7c67f2e29b19cd57b6034bd2385488718e54923","unresolved":false,"context_lines":[{"line_number":92,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":93,"context_line":"        SERVERS % \u0027show:host_status\u0027,"},{"line_number":94,"context_line":"        base.RULE_ADMIN_API,"},{"line_number":95,"context_line":"        \"Show a server with additional host status information\","},{"line_number":96,"context_line":"        ["},{"line_number":97,"context_line":"            {"},{"line_number":98,"context_line":"                \u0027method\u0027: \u0027GET\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_89d2d6d0","line":95,"range":{"start_line":95,"start_character":0,"end_line":95,"end_character":64},"in_reply_to":"3fa7e38b_5ee4ae0e","updated":"2019-10-23 00:14:20.000000000","message":"Will do.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":8556,"name":"Ghanshyam Maan","display_name":"Ghanshyam Maan","email":"gmaan.os14@gmail.com","username":"ghanshyam"},"change_message_id":"e625e04817b15fbf6c5ec9a16b6c5ba61a45590c","unresolved":false,"context_lines":[{"line_number":104,"context_line":"            }"},{"line_number":105,"context_line":"        ]),"},{"line_number":106,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":107,"context_line":"        SERVERS % \u0027show:host_status_unknown\u0027,"},{"line_number":108,"context_line":"        base.RULE_ADMIN_API,"},{"line_number":109,"context_line":"        \"Show a server with additional host status information, only if host \""},{"line_number":110,"context_line":"        \"status is UNKNOWN\","}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_5e482e2d","line":107,"range":{"start_line":107,"start_character":24,"end_line":107,"end_character":43},"updated":"2019-10-21 15:54:28.000000000","message":"how about defining the name with : for its status as per suggested standard policy name[1]\n\n \u0027show:host_status:unknown-only\u0027\n\n[1] https://docs.openstack.org/oslo.policy/latest/user/usage.html#resource-attributes","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"c7c67f2e29b19cd57b6034bd2385488718e54923","unresolved":false,"context_lines":[{"line_number":104,"context_line":"            }"},{"line_number":105,"context_line":"        ]),"},{"line_number":106,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":107,"context_line":"        SERVERS % \u0027show:host_status_unknown\u0027,"},{"line_number":108,"context_line":"        base.RULE_ADMIN_API,"},{"line_number":109,"context_line":"        \"Show a server with additional host status information, only if host \""},{"line_number":110,"context_line":"        \"status is UNKNOWN\","}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_29d962f3","line":107,"range":{"start_line":107,"start_character":24,"end_line":107,"end_character":43},"in_reply_to":"3fa7e38b_5e482e2d","updated":"2019-10-23 00:14:20.000000000","message":"Can do.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":8556,"name":"Ghanshyam Maan","display_name":"Ghanshyam Maan","email":"gmaan.os14@gmail.com","username":"ghanshyam"},"change_message_id":"e625e04817b15fbf6c5ec9a16b6c5ba61a45590c","unresolved":false,"context_lines":[{"line_number":106,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":107,"context_line":"        SERVERS % \u0027show:host_status_unknown\u0027,"},{"line_number":108,"context_line":"        base.RULE_ADMIN_API,"},{"line_number":109,"context_line":"        \"Show a server with additional host status information, only if host \""},{"line_number":110,"context_line":"        \"status is UNKNOWN\","},{"line_number":111,"context_line":"        ["},{"line_number":112,"context_line":"            {"},{"line_number":113,"context_line":"                \u0027method\u0027: \u0027GET\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_9e0c66ed","line":110,"range":{"start_line":109,"start_character":0,"end_line":110,"end_character":28},"updated":"2019-10-21 15:54:28.000000000","message":"we can add more doc here that if you want to enforce this policy then policy \u0027os_compute_api:servers:show:host_status\u0027 has to be false.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"c7c67f2e29b19cd57b6034bd2385488718e54923","unresolved":false,"context_lines":[{"line_number":106,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":107,"context_line":"        SERVERS % \u0027show:host_status_unknown\u0027,"},{"line_number":108,"context_line":"        base.RULE_ADMIN_API,"},{"line_number":109,"context_line":"        \"Show a server with additional host status information, only if host \""},{"line_number":110,"context_line":"        \"status is UNKNOWN\","},{"line_number":111,"context_line":"        ["},{"line_number":112,"context_line":"            {"},{"line_number":113,"context_line":"                \u0027method\u0027: \u0027GET\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_49d4debb","line":110,"range":{"start_line":109,"start_character":0,"end_line":110,"end_character":28},"in_reply_to":"3fa7e38b_9e0c66ed","updated":"2019-10-23 00:14:20.000000000","message":"Can do.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dc3fed3bc91363e1bf1080aca8ca94d783482048","unresolved":false,"context_lines":[{"line_number":108,"context_line":"        base.RULE_ADMIN_API,"},{"line_number":109,"context_line":"        \"Show a server with additional host status information, only if host \""},{"line_number":110,"context_line":"        \"status is UNKNOWN\","},{"line_number":111,"context_line":"        ["},{"line_number":112,"context_line":"            {"},{"line_number":113,"context_line":"                \u0027method\u0027: \u0027GET\u0027,"},{"line_number":114,"context_line":"                \u0027path\u0027: \u0027/servers/{server_id}\u0027"},{"line_number":115,"context_line":"            },"},{"line_number":116,"context_line":"            {"},{"line_number":117,"context_line":"                \u0027method\u0027: \u0027GET\u0027,"},{"line_number":118,"context_line":"                \u0027path\u0027: \u0027/servers/detail\u0027"},{"line_number":119,"context_line":"            }"},{"line_number":120,"context_line":"        ]),"},{"line_number":121,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":122,"context_line":"        SERVERS % \u0027create\u0027,"},{"line_number":123,"context_line":"        RULE_AOO,"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_0c8ce27d","line":120,"range":{"start_line":111,"start_character":8,"end_line":120,"end_character":10},"updated":"2019-10-18 22:00:56.000000000","message":"This, and above, are actually missing PUT /servers/{server_id} (update) and POST /servers/{server_id}/action (rebuild) with microversion 2.75. I\u0027m not sure if gmann thought about that when doing 2.75 to expose consistent responses for update and rebuild to match GET /servers/{server_id} and GET /servers/detail. If we\u0027re going to fix the existing policy above for update/rebuild with 2.75 then we could just do this in the same change. I\u0027m not sure how rigid these API methods need to be in the policy rule docs.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":8556,"name":"Ghanshyam Maan","display_name":"Ghanshyam Maan","email":"gmaan.os14@gmail.com","username":"ghanshyam"},"change_message_id":"e625e04817b15fbf6c5ec9a16b6c5ba61a45590c","unresolved":false,"context_lines":[{"line_number":108,"context_line":"        base.RULE_ADMIN_API,"},{"line_number":109,"context_line":"        \"Show a server with additional host status information, only if host \""},{"line_number":110,"context_line":"        \"status is UNKNOWN\","},{"line_number":111,"context_line":"        ["},{"line_number":112,"context_line":"            {"},{"line_number":113,"context_line":"                \u0027method\u0027: \u0027GET\u0027,"},{"line_number":114,"context_line":"                \u0027path\u0027: \u0027/servers/{server_id}\u0027"},{"line_number":115,"context_line":"            },"},{"line_number":116,"context_line":"            {"},{"line_number":117,"context_line":"                \u0027method\u0027: \u0027GET\u0027,"},{"line_number":118,"context_line":"                \u0027path\u0027: \u0027/servers/detail\u0027"},{"line_number":119,"context_line":"            }"},{"line_number":120,"context_line":"        ]),"},{"line_number":121,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":122,"context_line":"        SERVERS % \u0027create\u0027,"},{"line_number":123,"context_line":"        RULE_AOO,"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_5e102e50","line":120,"range":{"start_line":111,"start_character":8,"end_line":120,"end_character":10},"in_reply_to":"3fa7e38b_0c8ce27d","updated":"2019-10-21 15:54:28.000000000","message":"oh nice catch, This is actually doc bug only. Actual code (2.75 onwards where host_status was added for PUT and rebuild API response) does check the same policy as GET /servers does [1]\n\nI think we can fix the doc in this patch for old policy also if not then I can push separate change?\n\n[1] https://github.com/openstack/nova/blob/964d7dc87989b5765fcc60d34f734963ab8e03e7/nova/api/openstack/compute/servers.py#L854\n\nhttps://github.com/openstack/nova/blob/964d7dc87989b5765fcc60d34f734963ab8e03e7/nova/api/openstack/compute/servers.py#L1161","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"3f82b7ce51d01883deaff57f49a1aac690ce6d67","unresolved":false,"context_lines":[{"line_number":108,"context_line":"        base.RULE_ADMIN_API,"},{"line_number":109,"context_line":"        \"Show a server with additional host status information, only if host \""},{"line_number":110,"context_line":"        \"status is UNKNOWN\","},{"line_number":111,"context_line":"        ["},{"line_number":112,"context_line":"            {"},{"line_number":113,"context_line":"                \u0027method\u0027: \u0027GET\u0027,"},{"line_number":114,"context_line":"                \u0027path\u0027: \u0027/servers/{server_id}\u0027"},{"line_number":115,"context_line":"            },"},{"line_number":116,"context_line":"            {"},{"line_number":117,"context_line":"                \u0027method\u0027: \u0027GET\u0027,"},{"line_number":118,"context_line":"                \u0027path\u0027: \u0027/servers/detail\u0027"},{"line_number":119,"context_line":"            }"},{"line_number":120,"context_line":"        ]),"},{"line_number":121,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":122,"context_line":"        SERVERS % \u0027create\u0027,"},{"line_number":123,"context_line":"        RULE_AOO,"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_fea31ab0","line":120,"range":{"start_line":111,"start_character":8,"end_line":120,"end_character":10},"in_reply_to":"3fa7e38b_5e102e50","updated":"2019-10-21 15:56:30.000000000","message":"It\u0027s probably easier to push a separate docs fix and then this change can rebase on top of it and follow the same pattern.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":8556,"name":"Ghanshyam Maan","display_name":"Ghanshyam Maan","email":"gmaan.os14@gmail.com","username":"ghanshyam"},"change_message_id":"0cc0e53c4ce25031a855f07b95b690f797471a1b","unresolved":false,"context_lines":[{"line_number":108,"context_line":"        base.RULE_ADMIN_API,"},{"line_number":109,"context_line":"        \"Show a server with additional host status information, only if host \""},{"line_number":110,"context_line":"        \"status is UNKNOWN\","},{"line_number":111,"context_line":"        ["},{"line_number":112,"context_line":"            {"},{"line_number":113,"context_line":"                \u0027method\u0027: \u0027GET\u0027,"},{"line_number":114,"context_line":"                \u0027path\u0027: \u0027/servers/{server_id}\u0027"},{"line_number":115,"context_line":"            },"},{"line_number":116,"context_line":"            {"},{"line_number":117,"context_line":"                \u0027method\u0027: \u0027GET\u0027,"},{"line_number":118,"context_line":"                \u0027path\u0027: \u0027/servers/detail\u0027"},{"line_number":119,"context_line":"            }"},{"line_number":120,"context_line":"        ]),"},{"line_number":121,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":122,"context_line":"        SERVERS % \u0027create\u0027,"},{"line_number":123,"context_line":"        RULE_AOO,"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_199c1069","line":120,"range":{"start_line":111,"start_character":8,"end_line":120,"end_character":10},"in_reply_to":"3fa7e38b_fea31ab0","updated":"2019-10-21 16:43:27.000000000","message":"done- https://review.opendev.org/#/c/689833/1","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"c39c040a9dab0e0344bc5b2056a713331622a264","unresolved":false,"context_lines":[{"line_number":123,"context_line":"            }"},{"line_number":124,"context_line":"        ]),"},{"line_number":125,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":126,"context_line":"            SERVERS % \u0027show:host_status:unknown-only\u0027,"},{"line_number":127,"context_line":"        base.RULE_ADMIN_API,"},{"line_number":128,"context_line":"        \"\"\""},{"line_number":129,"context_line":"Show a server with additional host status information, only if host status is"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_85cc87bb","line":126,"range":{"start_line":126,"start_character":8,"end_line":126,"end_character":12},"updated":"2019-10-30 15:00:20.000000000","message":"inconsistent indent","commit_id":"f9c608924482eb8f3db403b8f49d3d885fed5997"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"c39c040a9dab0e0344bc5b2056a713331622a264","unresolved":false,"context_lines":[{"line_number":124,"context_line":"        ]),"},{"line_number":125,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":126,"context_line":"            SERVERS % \u0027show:host_status:unknown-only\u0027,"},{"line_number":127,"context_line":"        base.RULE_ADMIN_API,"},{"line_number":128,"context_line":"        \"\"\""},{"line_number":129,"context_line":"Show a server with additional host status information, only if host status is"},{"line_number":130,"context_line":"UNKNOWN."}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_e54f7b32","line":127,"range":{"start_line":127,"start_character":8,"end_line":127,"end_character":27},"updated":"2019-10-30 15:00:20.000000000","message":"Okay, so by default this is still admin-only, meaning by default the behavior does not change ✔","commit_id":"f9c608924482eb8f3db403b8f49d3d885fed5997"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"c39c040a9dab0e0344bc5b2056a713331622a264","unresolved":false,"context_lines":[{"line_number":129,"context_line":"Show a server with additional host status information, only if host status is"},{"line_number":130,"context_line":"UNKNOWN."},{"line_number":131,"context_line":""},{"line_number":132,"context_line":"This policy rule will only be enforced when the"},{"line_number":133,"context_line":"``os_compute_api:servers:show:host_status`` policy rule does not pass for the"},{"line_number":134,"context_line":"request. An example policy configuration could be where the"},{"line_number":135,"context_line":"``os_compute_api:servers:show:host_status`` rule is set to allow admin-only and"},{"line_number":136,"context_line":"the ``os_compute_api:servers:show:host_status:unknown-only`` rule is set to"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_056657bc","line":133,"range":{"start_line":132,"start_character":22,"end_line":133,"end_character":69},"updated":"2019-10-30 15:00:20.000000000","message":"So if :host_status is *less* stringent, this one is basically ignored, which again is good backward-compatible behavior ✔","commit_id":"f9c608924482eb8f3db403b8f49d3d885fed5997"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"c39c040a9dab0e0344bc5b2056a713331622a264","unresolved":false,"context_lines":[{"line_number":144,"context_line":"            {"},{"line_number":145,"context_line":"                \u0027method\u0027: \u0027GET\u0027,"},{"line_number":146,"context_line":"                \u0027path\u0027: \u0027/servers/detail\u0027"},{"line_number":147,"context_line":"            }"},{"line_number":148,"context_line":"        ]),"},{"line_number":149,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":150,"context_line":"        SERVERS % \u0027create\u0027,"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_257d931b","line":147,"updated":"2019-10-30 15:00:20.000000000","message":"Sorry, why doesn\u0027t it make sense to include the same PUT and POST as we have for :host_status here? If for some reason the operator has opened up those operations, and also this rule, they would expect the response payloads to contain UNKNOWN if appropriate, wouldn\u0027t they?\n\n[Later] Having looked at the tests, it appears this is working as expected for those operations -- but I don\u0027t understand how.","commit_id":"f9c608924482eb8f3db403b8f49d3d885fed5997"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"8180f112f1dd3a43c0ea7ff46fb6a799fe4d5b33","unresolved":false,"context_lines":[{"line_number":144,"context_line":"            {"},{"line_number":145,"context_line":"                \u0027method\u0027: \u0027GET\u0027,"},{"line_number":146,"context_line":"                \u0027path\u0027: \u0027/servers/detail\u0027"},{"line_number":147,"context_line":"            }"},{"line_number":148,"context_line":"        ]),"},{"line_number":149,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":150,"context_line":"        SERVERS % \u0027create\u0027,"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_bba522b7","line":147,"in_reply_to":"3fa7e38b_257d931b","updated":"2019-10-30 15:07:53.000000000","message":"PUT and POST should be here as well, I think it\u0027s just a rebase mistake, i.e. forgot since gmann fixed it above in https://review.opendev.org/#/c/689833/. Could be added in a FUP.","commit_id":"f9c608924482eb8f3db403b8f49d3d885fed5997"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"6d5636ba4f90f3a974ef2bca95781ecaea96ec69","unresolved":false,"context_lines":[{"line_number":144,"context_line":"            {"},{"line_number":145,"context_line":"                \u0027method\u0027: \u0027GET\u0027,"},{"line_number":146,"context_line":"                \u0027path\u0027: \u0027/servers/detail\u0027"},{"line_number":147,"context_line":"            }"},{"line_number":148,"context_line":"        ]),"},{"line_number":149,"context_line":"    policy.DocumentedRuleDefault("},{"line_number":150,"context_line":"        SERVERS % \u0027create\u0027,"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_1b279614","line":147,"in_reply_to":"3fa7e38b_bba522b7","updated":"2019-10-30 15:12:58.000000000","message":"Okay, what I was missing is that these are just doc, they don\u0027t actually dictate which APIs are affected.","commit_id":"f9c608924482eb8f3db403b8f49d3d885fed5997"}],"nova/tests/functional/test_policy.py":[{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"afb9a257af151b371dad40d0b8b2bad172d2375d","unresolved":false,"context_lines":[{"line_number":12,"context_line":""},{"line_number":13,"context_line":"import time"},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"import mock"},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"from nova import test"},{"line_number":18,"context_line":"from nova.tests import fixtures as nova_fixtures"}],"source_content_type":"text/x-python","patch_set":3,"id":"3fa7e38b_10d350d7","line":15,"updated":"2019-10-24 04:38:36.000000000","message":"Argh, pep8 error.","commit_id":"06e2918bc0a5d823b705811d23d2a4551ae8d58c"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"4d6edeeb6de42efdae0be8f4833b0694eda60a05","unresolved":false,"context_lines":[{"line_number":84,"context_line":"        # Need to wait service_down_time amount of seconds to ensure"},{"line_number":85,"context_line":"        # nova considers the host down."},{"line_number":86,"context_line":"        time.sleep(self._service_down_time)"},{"line_number":87,"context_line":"        # Get server as admin."},{"line_number":88,"context_line":"        server \u003d self.admin_api.get_server(server[\u0027id\u0027])"},{"line_number":89,"context_line":"        # Verify admin can see the host status UNKNOWN."},{"line_number":90,"context_line":"        self.assertEqual(\u0027UNKNOWN\u0027, server[\u0027host_status\u0027])"},{"line_number":91,"context_line":"        # Get server as normal non-admin user."},{"line_number":92,"context_line":"        server \u003d self.api.get_server(server[\u0027id\u0027])"},{"line_number":93,"context_line":"        # Verify non-admin can see the host status UNKNOWN too."},{"line_number":94,"context_line":"        self.assertEqual(\u0027UNKNOWN\u0027, server[\u0027host_status\u0027])"},{"line_number":95,"context_line":"        # Now, adjust the policy to make it so only admin are allowed to see"},{"line_number":96,"context_line":"        # UNKNOWN host status only."},{"line_number":97,"context_line":"        self.policy.set_rules({"}],"source_content_type":"text/x-python","patch_set":3,"id":"3fa7e38b_30bd2c68","line":94,"range":{"start_line":87,"start_character":8,"end_line":94,"end_character":58},"updated":"2019-10-24 04:56:10.000000000","message":"I don\u0027t understand the coverage report. It\u0027s saying this line is only partially covered:\n\nhttps://storage.gra1.cloud.ovh.net/v1/AUTH_dcaab5e32b234d56b626f72581e3644c/zuul_opendev_logs_28d/679181/3/check/openstack-tox-cover/28dd583/cover/nova_api_openstack_compute_views_servers_py.html#n374\n\nbut these two actions should result in covering both conditions (?) on that line. Does coverage only run unit tests? I see \u0027stestr run {posargs}\u0027 in tox.ini, which seems to match what is run for the unit test envs?","commit_id":"06e2918bc0a5d823b705811d23d2a4551ae8d58c"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"d932d82a278f5f7b53af034ee08ea398924c3227","unresolved":false,"context_lines":[{"line_number":84,"context_line":"        # Need to wait service_down_time amount of seconds to ensure"},{"line_number":85,"context_line":"        # nova considers the host down."},{"line_number":86,"context_line":"        time.sleep(self._service_down_time)"},{"line_number":87,"context_line":"        # Get server as admin."},{"line_number":88,"context_line":"        server \u003d self.admin_api.get_server(server[\u0027id\u0027])"},{"line_number":89,"context_line":"        # Verify admin can see the host status UNKNOWN."},{"line_number":90,"context_line":"        self.assertEqual(\u0027UNKNOWN\u0027, server[\u0027host_status\u0027])"},{"line_number":91,"context_line":"        # Get server as normal non-admin user."},{"line_number":92,"context_line":"        server \u003d self.api.get_server(server[\u0027id\u0027])"},{"line_number":93,"context_line":"        # Verify non-admin can see the host status UNKNOWN too."},{"line_number":94,"context_line":"        self.assertEqual(\u0027UNKNOWN\u0027, server[\u0027host_status\u0027])"},{"line_number":95,"context_line":"        # Now, adjust the policy to make it so only admin are allowed to see"},{"line_number":96,"context_line":"        # UNKNOWN host status only."},{"line_number":97,"context_line":"        self.policy.set_rules({"}],"source_content_type":"text/x-python","patch_set":3,"id":"3fa7e38b_06b46fd0","line":94,"range":{"start_line":87,"start_character":8,"end_line":94,"end_character":58},"in_reply_to":"3fa7e38b_30bd2c68","updated":"2019-10-24 15:01:27.000000000","message":"Unfortunately the coverage report only includes stuff covered in unit tests because of this:\n\nhttps://github.com/openstack/nova/blob/1bfa4626d13d0a73e63745cc4a864ae86d490daf/.stestr.conf#L2\n\nI\u0027ve tried adding functional to the job before but it\u0027s a mess to sort out:\n\nhttps://review.opendev.org/#/c/669912/","commit_id":"06e2918bc0a5d823b705811d23d2a4551ae8d58c"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"f2a31fbe5978125ba5d2c3994b23d7ec5ccdd7b6","unresolved":false,"context_lines":[{"line_number":79,"context_line":"        self.assertNotIn(\u0027host_status\u0027, server)"},{"line_number":80,"context_line":"        # Stop the compute service to trigger UNKNOWN host_status."},{"line_number":81,"context_line":"        self.compute.stop()"},{"line_number":82,"context_line":"        # Need to wait service_down_time amount of seconds to ensure"},{"line_number":83,"context_line":"        # nova considers the host down."},{"line_number":84,"context_line":"        time.sleep(self._service_down_time)"},{"line_number":85,"context_line":"        # Get server as admin."},{"line_number":86,"context_line":"        server \u003d self.admin_api.get_server(server[\u0027id\u0027])"},{"line_number":87,"context_line":"        # Verify admin can see the host status UNKNOWN."}],"source_content_type":"text/x-python","patch_set":4,"id":"3fa7e38b_c6d417be","line":84,"range":{"start_line":82,"start_character":8,"end_line":84,"end_character":43},"updated":"2019-10-24 15:27:47.000000000","message":"So the test is going to wait 10 seconds? Can\u0027t we shave that down to at least 1 second or force the service down? Though I think the force-down logic is different when it comes to host_status so maybe that doesn\u0027t work.\n\nThis also may be a bit racy, reminds me of:\n\nhttps://review.opendev.org/#/c/585978/\n\nSo maybe we can set _service_down_time\u003d1 and sleep is _service_down_time+.5?","commit_id":"e80580ddc5393ce10ca23c51054b7151e1a477ea"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"b2f716c85d2fee41db47f937e522557cabee5dd1","unresolved":false,"context_lines":[{"line_number":79,"context_line":"        self.assertNotIn(\u0027host_status\u0027, server)"},{"line_number":80,"context_line":"        # Stop the compute service to trigger UNKNOWN host_status."},{"line_number":81,"context_line":"        self.compute.stop()"},{"line_number":82,"context_line":"        # Need to wait service_down_time amount of seconds to ensure"},{"line_number":83,"context_line":"        # nova considers the host down."},{"line_number":84,"context_line":"        time.sleep(self._service_down_time)"},{"line_number":85,"context_line":"        # Get server as admin."},{"line_number":86,"context_line":"        server \u003d self.admin_api.get_server(server[\u0027id\u0027])"},{"line_number":87,"context_line":"        # Verify admin can see the host status UNKNOWN."}],"source_content_type":"text/x-python","patch_set":4,"id":"3fa7e38b_fcf442f3","line":84,"range":{"start_line":82,"start_character":8,"end_line":84,"end_character":43},"in_reply_to":"3fa7e38b_c6d417be","updated":"2019-10-24 16:41:25.000000000","message":"Yeah, I had a bit of A Time wrangling this func test and got desperate and went this approach based on stuff I saw in:\n\nhttps://github.com/openstack/nova/blob/1bfa4626d13d0a73e63745cc4a864ae86d490daf/nova/tests/functional/test_server_group.py#L420\n\nbut after sleeping I realize I can just use timeutils to override time and avoid all this bad stuff.","commit_id":"e80580ddc5393ce10ca23c51054b7151e1a477ea"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"847afa843c6d1a03b475167e23d1e31258484522","unresolved":false,"context_lines":[{"line_number":79,"context_line":"        self.assertNotIn(\u0027host_status\u0027, server)"},{"line_number":80,"context_line":"        # Stop the compute service to trigger UNKNOWN host_status."},{"line_number":81,"context_line":"        self.compute.stop()"},{"line_number":82,"context_line":"        # Need to wait service_down_time amount of seconds to ensure"},{"line_number":83,"context_line":"        # nova considers the host down."},{"line_number":84,"context_line":"        time.sleep(self._service_down_time)"},{"line_number":85,"context_line":"        # Get server as admin."},{"line_number":86,"context_line":"        server \u003d self.admin_api.get_server(server[\u0027id\u0027])"},{"line_number":87,"context_line":"        # Verify admin can see the host status UNKNOWN."}],"source_content_type":"text/x-python","patch_set":4,"id":"3fa7e38b_910c103a","line":84,"range":{"start_line":82,"start_character":8,"end_line":84,"end_character":43},"in_reply_to":"3fa7e38b_fcf442f3","updated":"2019-10-24 20:57:12.000000000","message":"Heh and that\u0027s the test module that has the known race bug that Kevin was trying to fix above so yeah, not a good one to build from.","commit_id":"e80580ddc5393ce10ca23c51054b7151e1a477ea"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"f2a31fbe5978125ba5d2c3994b23d7ec5ccdd7b6","unresolved":false,"context_lines":[{"line_number":99,"context_line":"        server \u003d self.api.get_server(server[\u0027id\u0027])"},{"line_number":100,"context_line":"        # Verify non-admin do not receive the host_status field."},{"line_number":101,"context_line":"        self.assertNotIn(\u0027host_status\u0027, server)"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    def test_get_servers_detail_host_status_unknown_only(self):"},{"line_number":104,"context_line":"        # Set policy such that admin are allowed to see any/all host status and"},{"line_number":105,"context_line":"        # all users are allowed to see UNKNOWN host status only."}],"source_content_type":"text/x-python","patch_set":4,"id":"3fa7e38b_06ba2f6d","line":102,"updated":"2019-10-24 15:27:47.000000000","message":"How about another test to make sure host_status is not shown for the admin user if the microversion is less than 2.16 so regardless of policy. You could do that like:\n\nfrom nova import utils\n...\nwith utils.temporary_mutation(self.admin_api,\n                              microversion\u003d\u00272.15\u0027):\n    server \u003d self.admin_api.get_server(server[\u0027id\u0027])\n    self.assertNotIn(\u0027host_status\u0027, server)","commit_id":"e80580ddc5393ce10ca23c51054b7151e1a477ea"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"b2f716c85d2fee41db47f937e522557cabee5dd1","unresolved":false,"context_lines":[{"line_number":99,"context_line":"        server \u003d self.api.get_server(server[\u0027id\u0027])"},{"line_number":100,"context_line":"        # Verify non-admin do not receive the host_status field."},{"line_number":101,"context_line":"        self.assertNotIn(\u0027host_status\u0027, server)"},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    def test_get_servers_detail_host_status_unknown_only(self):"},{"line_number":104,"context_line":"        # Set policy such that admin are allowed to see any/all host status and"},{"line_number":105,"context_line":"        # all users are allowed to see UNKNOWN host status only."}],"source_content_type":"text/x-python","patch_set":4,"id":"3fa7e38b_1cd11e58","line":102,"in_reply_to":"3fa7e38b_06ba2f6d","updated":"2019-10-24 16:41:25.000000000","message":"Done","commit_id":"e80580ddc5393ce10ca23c51054b7151e1a477ea"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"f2a31fbe5978125ba5d2c3994b23d7ec5ccdd7b6","unresolved":false,"context_lines":[{"line_number":131,"context_line":"        self.compute.stop()"},{"line_number":132,"context_line":"        # Need to wait service_down_time amount of seconds to ensure"},{"line_number":133,"context_line":"        # nova considers the host down."},{"line_number":134,"context_line":"        time.sleep(self._service_down_time)"},{"line_number":135,"context_line":"        # Get servers as admin."},{"line_number":136,"context_line":"        servers \u003d self.admin_api.get_servers()"},{"line_number":137,"context_line":"        # Verify admin can see the host status UNKNOWN."}],"source_content_type":"text/x-python","patch_set":4,"id":"3fa7e38b_4665871c","line":134,"updated":"2019-10-24 15:27:47.000000000","message":"same","commit_id":"e80580ddc5393ce10ca23c51054b7151e1a477ea"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"847afa843c6d1a03b475167e23d1e31258484522","unresolved":false,"context_lines":[{"line_number":52,"context_line":"    def _setup_host_status_unknown_only_test(self):"},{"line_number":53,"context_line":"        # Set policy such that admin are allowed to see any/all host status and"},{"line_number":54,"context_line":"        # all users are allowed to see UNKNOWN host status only."},{"line_number":55,"context_line":"        self.host_status_rule \u003d \u0027os_compute_api:servers:show:host_status\u0027"},{"line_number":56,"context_line":"        self.host_status_unknown_only_rule \u003d ("},{"line_number":57,"context_line":"            \u0027os_compute_api:servers:show:host_status:unknown-only\u0027)"},{"line_number":58,"context_line":"        self.policy.set_rules({"}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_b6126261","line":55,"updated":"2019-10-24 20:57:12.000000000","message":"nit: could hard-code these as module-level constants","commit_id":"c402896a2fd16c80d25773f47eca9502dd306250"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"9fb9b3a3412464026a6129110aae6de54ae3f5e3","unresolved":false,"context_lines":[{"line_number":52,"context_line":"    def _setup_host_status_unknown_only_test(self):"},{"line_number":53,"context_line":"        # Set policy such that admin are allowed to see any/all host status and"},{"line_number":54,"context_line":"        # all users are allowed to see UNKNOWN host status only."},{"line_number":55,"context_line":"        self.host_status_rule \u003d \u0027os_compute_api:servers:show:host_status\u0027"},{"line_number":56,"context_line":"        self.host_status_unknown_only_rule \u003d ("},{"line_number":57,"context_line":"            \u0027os_compute_api:servers:show:host_status:unknown-only\u0027)"},{"line_number":58,"context_line":"        self.policy.set_rules({"}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_5cf78f5a","line":55,"in_reply_to":"3fa7e38b_b6126261","updated":"2019-10-24 23:00:48.000000000","message":"I thought about it, then thought I didn\u0027t want to pollute the class if someone else wanted to add a test, forgetting that I had changed it from PolicyTestCase to HostStatusPolicyTestCase already.\n\nAll that is to say, class constants would be better here.","commit_id":"c402896a2fd16c80d25773f47eca9502dd306250"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"847afa843c6d1a03b475167e23d1e31258484522","unresolved":false,"context_lines":[{"line_number":62,"context_line":"            overwrite\u003dFalse)"},{"line_number":63,"context_line":"        # Create a server as a normal non-admin user."},{"line_number":64,"context_line":"        kwargs \u003d {}"},{"line_number":65,"context_line":"        if (pkg_resources.parse_version(self.api.microversion) \u003e\u003d"},{"line_number":66,"context_line":"                pkg_resources.parse_version(\u00272.75\u0027)):"},{"line_number":67,"context_line":"            # In microversion 2.36 the /images proxy API was deprecated, so"},{"line_number":68,"context_line":"            # must specifiy the image_uuid directly."}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_760cea41","line":65,"range":{"start_line":65,"start_character":12,"end_line":65,"end_character":25},"updated":"2019-10-24 20:57:12.000000000","message":"Rather than this you could just pass a flag into the method for this logic, but if you want to do the version compare I\u0027d prefer that we use the APIVersion objects which have compare functionality built in:\n\nhttps://github.com/openstack/nova/blob/1bfa4626d13d0a73e63745cc4a864ae86d490daf/nova/api/openstack/api_version_request.py#L272","commit_id":"c402896a2fd16c80d25773f47eca9502dd306250"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"9fb9b3a3412464026a6129110aae6de54ae3f5e3","unresolved":false,"context_lines":[{"line_number":62,"context_line":"            overwrite\u003dFalse)"},{"line_number":63,"context_line":"        # Create a server as a normal non-admin user."},{"line_number":64,"context_line":"        kwargs \u003d {}"},{"line_number":65,"context_line":"        if (pkg_resources.parse_version(self.api.microversion) \u003e\u003d"},{"line_number":66,"context_line":"                pkg_resources.parse_version(\u00272.75\u0027)):"},{"line_number":67,"context_line":"            # In microversion 2.36 the /images proxy API was deprecated, so"},{"line_number":68,"context_line":"            # must specifiy the image_uuid directly."}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_7c87ebb7","line":65,"range":{"start_line":65,"start_character":12,"end_line":65,"end_character":25},"in_reply_to":"3fa7e38b_760cea41","updated":"2019-10-24 23:00:48.000000000","message":"Yeah, I looked at the APIVersion stuff and it looked overkill for this compare. I thought about a flag and I think I should just do that instead. This is ugly.","commit_id":"c402896a2fd16c80d25773f47eca9502dd306250"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"847afa843c6d1a03b475167e23d1e31258484522","unresolved":false,"context_lines":[{"line_number":63,"context_line":"        # Create a server as a normal non-admin user."},{"line_number":64,"context_line":"        kwargs \u003d {}"},{"line_number":65,"context_line":"        if (pkg_resources.parse_version(self.api.microversion) \u003e\u003d"},{"line_number":66,"context_line":"                pkg_resources.parse_version(\u00272.75\u0027)):"},{"line_number":67,"context_line":"            # In microversion 2.36 the /images proxy API was deprecated, so"},{"line_number":68,"context_line":"            # must specifiy the image_uuid directly."},{"line_number":69,"context_line":"            kwargs[\u0027image_uuid\u0027] \u003d \u0027155d900f-4e14-4e4c-a73d-069cbf4541e6\u0027"}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_f1fd4408","line":66,"range":{"start_line":66,"start_character":45,"end_line":66,"end_character":49},"updated":"2019-10-24 20:57:12.000000000","message":"This is a bit odd since you\u0027re dealing with 2.36+ compat below, so couldn\u0027t this just be 2.36?","commit_id":"c402896a2fd16c80d25773f47eca9502dd306250"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"9fb9b3a3412464026a6129110aae6de54ae3f5e3","unresolved":false,"context_lines":[{"line_number":63,"context_line":"        # Create a server as a normal non-admin user."},{"line_number":64,"context_line":"        kwargs \u003d {}"},{"line_number":65,"context_line":"        if (pkg_resources.parse_version(self.api.microversion) \u003e\u003d"},{"line_number":66,"context_line":"                pkg_resources.parse_version(\u00272.75\u0027)):"},{"line_number":67,"context_line":"            # In microversion 2.36 the /images proxy API was deprecated, so"},{"line_number":68,"context_line":"            # must specifiy the image_uuid directly."},{"line_number":69,"context_line":"            kwargs[\u0027image_uuid\u0027] \u003d \u0027155d900f-4e14-4e4c-a73d-069cbf4541e6\u0027"}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_9c82e7a4","line":66,"range":{"start_line":66,"start_character":45,"end_line":66,"end_character":49},"in_reply_to":"3fa7e38b_f1fd4408","updated":"2019-10-24 23:00:48.000000000","message":"Yeah. I got obsessed with 2.75 I guess.","commit_id":"c402896a2fd16c80d25773f47eca9502dd306250"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"847afa843c6d1a03b475167e23d1e31258484522","unresolved":false,"context_lines":[{"line_number":66,"context_line":"                pkg_resources.parse_version(\u00272.75\u0027)):"},{"line_number":67,"context_line":"            # In microversion 2.36 the /images proxy API was deprecated, so"},{"line_number":68,"context_line":"            # must specifiy the image_uuid directly."},{"line_number":69,"context_line":"            kwargs[\u0027image_uuid\u0027] \u003d \u0027155d900f-4e14-4e4c-a73d-069cbf4541e6\u0027"},{"line_number":70,"context_line":"            # Starting with microversion 2.37 the networks field is required."},{"line_number":71,"context_line":"            kwargs[\u0027networks\u0027] \u003d \u0027none\u0027"},{"line_number":72,"context_line":"        server \u003d self._build_minimal_create_server_request("}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_31343cde","line":69,"updated":"2019-10-24 20:57:12.000000000","message":"You might want to just always specify an image_uuid regardless of microversion to make things easier.","commit_id":"c402896a2fd16c80d25773f47eca9502dd306250"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"9fb9b3a3412464026a6129110aae6de54ae3f5e3","unresolved":false,"context_lines":[{"line_number":66,"context_line":"                pkg_resources.parse_version(\u00272.75\u0027)):"},{"line_number":67,"context_line":"            # In microversion 2.36 the /images proxy API was deprecated, so"},{"line_number":68,"context_line":"            # must specifiy the image_uuid directly."},{"line_number":69,"context_line":"            kwargs[\u0027image_uuid\u0027] \u003d \u0027155d900f-4e14-4e4c-a73d-069cbf4541e6\u0027"},{"line_number":70,"context_line":"            # Starting with microversion 2.37 the networks field is required."},{"line_number":71,"context_line":"            kwargs[\u0027networks\u0027] \u003d \u0027none\u0027"},{"line_number":72,"context_line":"        server \u003d self._build_minimal_create_server_request("}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_5c8c6fd6","line":69,"in_reply_to":"3fa7e38b_31343cde","updated":"2019-10-24 23:00:48.000000000","message":"I might.","commit_id":"c402896a2fd16c80d25773f47eca9502dd306250"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"847afa843c6d1a03b475167e23d1e31258484522","unresolved":false,"context_lines":[{"line_number":175,"context_line":"        server \u003d self._setup_host_status_unknown_only_test()"},{"line_number":176,"context_line":"        # POST /servers/{server_id}/action (rebuild)"},{"line_number":177,"context_line":"        rebuild \u003d {\u0027rebuild\u0027:"},{"line_number":178,"context_line":"                   {\u0027imageRef\u0027: \u002776fa36fc-c930-4bf3-8c8a-ea2a2420deb6\u0027}}"},{"line_number":179,"context_line":"        admin_func \u003d functools.partial(self.admin_api.post_server_action,"},{"line_number":180,"context_line":"                                       server[\u0027id\u0027], rebuild)"},{"line_number":181,"context_line":"        func \u003d functools.partial(self.api.post_server_action, server[\u0027id\u0027],"}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_51445847","line":178,"updated":"2019-10-24 20:57:12.000000000","message":"nit: if you hard-code the created server to always use image 155d900f-4e14-4e4c-a73d-069cbf4541e6 then you could just the same image here and then avoid a pass through the scheduler (which will fail anyway due to NoValidHost), but rebuild goes through the scheduler if the image changes. Likely has no effect on your test since you care about the rebuild response and you get that before the API casts off to conductor which calls the scheduler. So ignore me I guess.","commit_id":"c402896a2fd16c80d25773f47eca9502dd306250"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"9fb9b3a3412464026a6129110aae6de54ae3f5e3","unresolved":false,"context_lines":[{"line_number":175,"context_line":"        server \u003d self._setup_host_status_unknown_only_test()"},{"line_number":176,"context_line":"        # POST /servers/{server_id}/action (rebuild)"},{"line_number":177,"context_line":"        rebuild \u003d {\u0027rebuild\u0027:"},{"line_number":178,"context_line":"                   {\u0027imageRef\u0027: \u002776fa36fc-c930-4bf3-8c8a-ea2a2420deb6\u0027}}"},{"line_number":179,"context_line":"        admin_func \u003d functools.partial(self.admin_api.post_server_action,"},{"line_number":180,"context_line":"                                       server[\u0027id\u0027], rebuild)"},{"line_number":181,"context_line":"        func \u003d functools.partial(self.api.post_server_action, server[\u0027id\u0027],"}],"source_content_type":"text/x-python","patch_set":6,"id":"3fa7e38b_1cc037e0","line":178,"in_reply_to":"3fa7e38b_51445847","updated":"2019-10-24 23:00:48.000000000","message":"Oh, yeah, I didn\u0027t think about that. It doesn\u0027t affect my test as you said, but no reason not to just use the same image anyway.","commit_id":"c402896a2fd16c80d25773f47eca9502dd306250"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"c39c040a9dab0e0344bc5b2056a713331622a264","unresolved":false,"context_lines":[{"line_number":57,"context_line":"        # Set policy such that admin are allowed to see any/all host status and"},{"line_number":58,"context_line":"        # all users are allowed to see UNKNOWN host status only."},{"line_number":59,"context_line":"        self.policy.set_rules({"},{"line_number":60,"context_line":"            self.host_status_rule: \u0027rule:admin_api\u0027,"},{"line_number":61,"context_line":"            self.host_status_unknown_only_rule: \u0027@\u0027},"},{"line_number":62,"context_line":"            # This is needed to avoid nulling out the rest of default policy."},{"line_number":63,"context_line":"            overwrite\u003dFalse)"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_c5e11fd2","line":60,"range":{"start_line":60,"start_character":12,"end_line":60,"end_character":51},"updated":"2019-10-30 15:00:20.000000000","message":"this is the default, right? (but explicit is good)","commit_id":"f9c608924482eb8f3db403b8f49d3d885fed5997"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"8180f112f1dd3a43c0ea7ff46fb6a799fe4d5b33","unresolved":false,"context_lines":[{"line_number":57,"context_line":"        # Set policy such that admin are allowed to see any/all host status and"},{"line_number":58,"context_line":"        # all users are allowed to see UNKNOWN host status only."},{"line_number":59,"context_line":"        self.policy.set_rules({"},{"line_number":60,"context_line":"            self.host_status_rule: \u0027rule:admin_api\u0027,"},{"line_number":61,"context_line":"            self.host_status_unknown_only_rule: \u0027@\u0027},"},{"line_number":62,"context_line":"            # This is needed to avoid nulling out the rest of default policy."},{"line_number":63,"context_line":"            overwrite\u003dFalse)"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_1b947643","line":60,"range":{"start_line":60,"start_character":12,"end_line":60,"end_character":51},"in_reply_to":"3fa7e38b_c5e11fd2","updated":"2019-10-30 15:07:53.000000000","message":"yes","commit_id":"f9c608924482eb8f3db403b8f49d3d885fed5997"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"c39c040a9dab0e0344bc5b2056a713331622a264","unresolved":false,"context_lines":[{"line_number":58,"context_line":"        # all users are allowed to see UNKNOWN host status only."},{"line_number":59,"context_line":"        self.policy.set_rules({"},{"line_number":60,"context_line":"            self.host_status_rule: \u0027rule:admin_api\u0027,"},{"line_number":61,"context_line":"            self.host_status_unknown_only_rule: \u0027@\u0027},"},{"line_number":62,"context_line":"            # This is needed to avoid nulling out the rest of default policy."},{"line_number":63,"context_line":"            overwrite\u003dFalse)"},{"line_number":64,"context_line":"        # Create a server as a normal non-admin user."}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_45cd2f5b","line":61,"range":{"start_line":61,"start_character":48,"end_line":61,"end_character":52},"updated":"2019-10-30 15:00:20.000000000","message":"out of curiosity, why not use the consts from nova.policies.base?","commit_id":"f9c608924482eb8f3db403b8f49d3d885fed5997"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"c39c040a9dab0e0344bc5b2056a713331622a264","unresolved":false,"context_lines":[{"line_number":71,"context_line":"        server \u003d self._build_minimal_create_server_request("},{"line_number":72,"context_line":"            self.api, \u0027test_host_status_unknown_only\u0027, **kwargs)"},{"line_number":73,"context_line":"        server \u003d self.api.post_server({\u0027server\u0027: server})"},{"line_number":74,"context_line":"        server \u003d self._wait_for_state_change(self.admin_api, server, \u0027ACTIVE\u0027)"},{"line_number":75,"context_line":"        return server"},{"line_number":76,"context_line":""},{"line_number":77,"context_line":"    @staticmethod"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_805a35ef","line":74,"range":{"start_line":74,"start_character":50,"end_line":74,"end_character":59},"updated":"2019-10-30 15:00:20.000000000","message":"this would (should) work with the user api too, right?","commit_id":"f9c608924482eb8f3db403b8f49d3d885fed5997"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"8180f112f1dd3a43c0ea7ff46fb6a799fe4d5b33","unresolved":false,"context_lines":[{"line_number":71,"context_line":"        server \u003d self._build_minimal_create_server_request("},{"line_number":72,"context_line":"            self.api, \u0027test_host_status_unknown_only\u0027, **kwargs)"},{"line_number":73,"context_line":"        server \u003d self.api.post_server({\u0027server\u0027: server})"},{"line_number":74,"context_line":"        server \u003d self._wait_for_state_change(self.admin_api, server, \u0027ACTIVE\u0027)"},{"line_number":75,"context_line":"        return server"},{"line_number":76,"context_line":""},{"line_number":77,"context_line":"    @staticmethod"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_db725e4a","line":74,"range":{"start_line":74,"start_character":50,"end_line":74,"end_character":59},"in_reply_to":"3fa7e38b_805a35ef","updated":"2019-10-30 15:07:53.000000000","message":"Maybe - my guess is she\u0027s using admin_api here because that\u0027s the name of the variable in the InstanceHelperMixin._wait_for_state_change method. Depending on policy and if the caller cares about getting host_status then you\u0027d use the admin API (default policy would return host_status) but I\u0027m not sure if it matters for callers. It looks like they just turn around and GET using self.api and self.admin_api to validate.","commit_id":"f9c608924482eb8f3db403b8f49d3d885fed5997"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"c39c040a9dab0e0344bc5b2056a713331622a264","unresolved":false,"context_lines":[{"line_number":90,"context_line":"        self.admin_api.post_server_action(server[\u0027id\u0027], reset_state)"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"    def _test_host_status_unknown_only(self, admin_func, func):"},{"line_number":93,"context_line":"        # Get server as admin."},{"line_number":94,"context_line":"        server \u003d self._get_server(admin_func())"},{"line_number":95,"context_line":"        # We need to wait for ACTIVE if this was a post rebuild server action,"},{"line_number":96,"context_line":"        # else a subsequent rebuild request will fail with a 409 in the API."}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_001405e8","line":93,"range":{"start_line":93,"start_character":10,"end_line":93,"end_character":20},"updated":"2019-10-30 15:00:20.000000000","message":"This would be easier to understand if this (and similar below) said something like \"Run the operation as admin and extract the server from the response\". Otherwise combined with the name of the _get_server helper it feels like we\u0027re doing a GET /servers/{id} all the time, which obv isn\u0027t the point at all.","commit_id":"f9c608924482eb8f3db403b8f49d3d885fed5997"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"c39c040a9dab0e0344bc5b2056a713331622a264","unresolved":false,"context_lines":[{"line_number":102,"context_line":"        self._wait_for_state_change(self.admin_api, server, \u0027ACTIVE\u0027)"},{"line_number":103,"context_line":"        # Verify non-admin do not receive the host_status field because it is"},{"line_number":104,"context_line":"        # not UNKNOWN."},{"line_number":105,"context_line":"        self.assertNotIn(\u0027host_status\u0027, server)"},{"line_number":106,"context_line":"        # Stop the compute service to trigger UNKNOWN host_status."},{"line_number":107,"context_line":"        self.compute.stop()"},{"line_number":108,"context_line":"        # Advance time by 30 minutes so nova considers service as down."}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_e51c5bc3","line":105,"range":{"start_line":105,"start_character":19,"end_line":105,"end_character":24},"updated":"2019-10-30 15:00:20.000000000","message":"as opposed to Equal(\u0027\u0027..., as noted earlier","commit_id":"f9c608924482eb8f3db403b8f49d3d885fed5997"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"c39c040a9dab0e0344bc5b2056a713331622a264","unresolved":false,"context_lines":[{"line_number":115,"context_line":"        # complete. But we\u0027re only interested in what would be returned from"},{"line_number":116,"context_line":"        # the API post rebuild action, so reset the state to ACTIVE to allow"},{"line_number":117,"context_line":"        # the next rebuild request to go through without a 409 error."},{"line_number":118,"context_line":"        self._set_server_state_active(server)"},{"line_number":119,"context_line":"        # Verify admin can see the host status UNKNOWN."},{"line_number":120,"context_line":"        self.assertEqual(\u0027UNKNOWN\u0027, server[\u0027host_status\u0027])"},{"line_number":121,"context_line":"        # Get server as normal non-admin user."}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_40c2fd86","line":118,"range":{"start_line":118,"start_character":8,"end_line":118,"end_character":45},"updated":"2019-10-30 15:00:20.000000000","message":"I don\u0027t understand how this is affecting the `server` obtained in the line above.\n\n[Later] Okay, took me a minute, but IIUC from the comment this is only to clear the way for subsequent operations. In which case IMO it would make it easier to read if it were switched with the assertion below (similar for all the other places this happens).","commit_id":"f9c608924482eb8f3db403b8f49d3d885fed5997"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"c39c040a9dab0e0344bc5b2056a713331622a264","unresolved":false,"context_lines":[{"line_number":122,"context_line":"        server \u003d self._get_server(func())"},{"line_number":123,"context_line":"        self._set_server_state_active(server)"},{"line_number":124,"context_line":"        # Verify non-admin can see the host status UNKNOWN too."},{"line_number":125,"context_line":"        self.assertEqual(\u0027UNKNOWN\u0027, server[\u0027host_status\u0027])"},{"line_number":126,"context_line":"        # Now, adjust the policy to make it so only admin are allowed to see"},{"line_number":127,"context_line":"        # UNKNOWN host status only."},{"line_number":128,"context_line":"        self.policy.set_rules({"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_e099a979","line":125,"range":{"start_line":125,"start_character":8,"end_line":125,"end_character":58},"updated":"2019-10-30 15:00:20.000000000","message":"Hmph. I don\u0027t understand how this is working for PUT and POST, since those aren\u0027t listed in the policy rule.","commit_id":"f9c608924482eb8f3db403b8f49d3d885fed5997"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"8180f112f1dd3a43c0ea7ff46fb6a799fe4d5b33","unresolved":false,"context_lines":[{"line_number":122,"context_line":"        server \u003d self._get_server(func())"},{"line_number":123,"context_line":"        self._set_server_state_active(server)"},{"line_number":124,"context_line":"        # Verify non-admin can see the host status UNKNOWN too."},{"line_number":125,"context_line":"        self.assertEqual(\u0027UNKNOWN\u0027, server[\u0027host_status\u0027])"},{"line_number":126,"context_line":"        # Now, adjust the policy to make it so only admin are allowed to see"},{"line_number":127,"context_line":"        # UNKNOWN host status only."},{"line_number":128,"context_line":"        self.policy.set_rules({"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_5b942e36","line":125,"range":{"start_line":125,"start_character":8,"end_line":125,"end_character":58},"in_reply_to":"3fa7e38b_e099a979","updated":"2019-10-30 15:07:53.000000000","message":"The policy rule docs are just missing PUT and POST as noted.","commit_id":"f9c608924482eb8f3db403b8f49d3d885fed5997"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"c39c040a9dab0e0344bc5b2056a713331622a264","unresolved":false,"context_lines":[{"line_number":172,"context_line":"        self.api.microversion \u003d \u00272.75\u0027"},{"line_number":173,"context_line":"        self.admin_api.microversion \u003d \u00272.75\u0027"},{"line_number":174,"context_line":"        server \u003d self._setup_host_status_unknown_only_test(networks\u003d\u0027none\u0027)"},{"line_number":175,"context_line":"        # POST /servers/{server_id}/action (rebuild)"},{"line_number":176,"context_line":"        rebuild \u003d {\u0027rebuild\u0027: {\u0027imageRef\u0027: self.image_uuid}}"},{"line_number":177,"context_line":"        admin_func \u003d functools.partial(self.admin_api.post_server_action,"},{"line_number":178,"context_line":"                                       server[\u0027id\u0027], rebuild)"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_1bc5568e","line":175,"updated":"2019-10-30 15:00:20.000000000","message":"(musing, feel free to ignore)\n\nAFAICT the test harness could have been\n\n _test_host_status_unknown_only(self, func_name, *args):\n     admin_func \u003d getattr(self.admin_api, func_name)\n     user_func \u003d getattr(self.api, func_name)\n     ...\n     server \u003d self._get_server(admin_func(*args))\n\n...and not need the functools.partial lines in the test cases, e.g. here would be\n\n self._test_host_status_unknown_only(\u0027post_server_action\u0027, server[\u0027id\u0027], rebuild)\n\nProbably a matter of preference whether using getattr to pull a method is more or less confusing than functools.partial.","commit_id":"f9c608924482eb8f3db403b8f49d3d885fed5997"}],"nova/tests/unit/api/openstack/compute/test_serversV21.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dc3fed3bc91363e1bf1080aca8ca94d783482048","unresolved":false,"context_lines":[{"line_number":2131,"context_line":""},{"line_number":2132,"context_line":"        return server_dict"},{"line_number":2133,"context_line":""},{"line_number":2134,"context_line":"    def _verify_host_status_policy_behavior(self, func, expected_server):"},{"line_number":2135,"context_line":"        def verify_response(expected, response):"},{"line_number":2136,"context_line":"            if \u0027servers\u0027 in response:"},{"line_number":2137,"context_line":"                self.assertIn(expected[\u0027server\u0027], response[\u0027servers\u0027])"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_2cf67eda","line":2134,"updated":"2019-10-18 22:00:56.000000000","message":"This is OK but a bit tricky. For something that involves the API and service group API checks and stuff it seems like it would have been straight-forward to write a functional test which does all of this stuff and brings the service down to trigger the UNKNOWN case. I think you\u0027d have to configure report_interval and/or service_down_time to trigger the UNKNOWN case in a reasonable amount of time in a test (like set both to 1 second or something) but it might not be worth it to write a functional test for this stuff if these unit tests suffice.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"c7c67f2e29b19cd57b6034bd2385488718e54923","unresolved":false,"context_lines":[{"line_number":2131,"context_line":""},{"line_number":2132,"context_line":"        return server_dict"},{"line_number":2133,"context_line":""},{"line_number":2134,"context_line":"    def _verify_host_status_policy_behavior(self, func, expected_server):"},{"line_number":2135,"context_line":"        def verify_response(expected, response):"},{"line_number":2136,"context_line":"            if \u0027servers\u0027 in response:"},{"line_number":2137,"context_line":"                self.assertIn(expected[\u0027server\u0027], response[\u0027servers\u0027])"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_09f7c65b","line":2134,"in_reply_to":"3fa7e38b_2cf67eda","updated":"2019-10-23 00:14:20.000000000","message":"Yeah... in retrospect, I see your point. I\u0027m not sure why I didn\u0027t think to go the func test route. Probably because I can\u0027t recall having written any policy-related func tests before.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dc3fed3bc91363e1bf1080aca8ca94d783482048","unresolved":false,"context_lines":[{"line_number":2133,"context_line":""},{"line_number":2134,"context_line":"    def _verify_host_status_policy_behavior(self, func, expected_server):"},{"line_number":2135,"context_line":"        def verify_response(expected, response):"},{"line_number":2136,"context_line":"            if \u0027servers\u0027 in response:"},{"line_number":2137,"context_line":"                self.assertIn(expected[\u0027server\u0027], response[\u0027servers\u0027])"},{"line_number":2138,"context_line":"            else:"},{"line_number":2139,"context_line":"                self.assertThat(response, matchers.DictMatches(expected))"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_ccd48a4a","line":2136,"updated":"2019-10-18 22:00:56.000000000","message":"OK so this is the detail() case","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dc3fed3bc91363e1bf1080aca8ca94d783482048","unresolved":false,"context_lines":[{"line_number":2135,"context_line":"        def verify_response(expected, response):"},{"line_number":2136,"context_line":"            if \u0027servers\u0027 in response:"},{"line_number":2137,"context_line":"                self.assertIn(expected[\u0027server\u0027], response[\u0027servers\u0027])"},{"line_number":2138,"context_line":"            else:"},{"line_number":2139,"context_line":"                self.assertThat(response, matchers.DictMatches(expected))"},{"line_number":2140,"context_line":""},{"line_number":2141,"context_line":"        # Set policy to disallow only UNKNOWN host status and make sure we"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_6cc9d6aa","line":2138,"updated":"2019-10-18 22:00:56.000000000","message":"and this is the show() case, right?","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"c7c67f2e29b19cd57b6034bd2385488718e54923","unresolved":false,"context_lines":[{"line_number":2135,"context_line":"        def verify_response(expected, response):"},{"line_number":2136,"context_line":"            if \u0027servers\u0027 in response:"},{"line_number":2137,"context_line":"                self.assertIn(expected[\u0027server\u0027], response[\u0027servers\u0027])"},{"line_number":2138,"context_line":"            else:"},{"line_number":2139,"context_line":"                self.assertThat(response, matchers.DictMatches(expected))"},{"line_number":2140,"context_line":""},{"line_number":2141,"context_line":"        # Set policy to disallow only UNKNOWN host status and make sure we"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_2902c23f","line":2138,"in_reply_to":"3fa7e38b_6cc9d6aa","updated":"2019-10-23 00:14:20.000000000","message":"Correct.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"f2a31fbe5978125ba5d2c3994b23d7ec5ccdd7b6","unresolved":false,"context_lines":[{"line_number":2163,"context_line":"        policy.set_rules(oslo_policy.Rules.from_dict(rules), overwrite\u003dFalse)"},{"line_number":2164,"context_line":"        func()"},{"line_number":2165,"context_line":"        mock_get_host_status.assert_not_called()"},{"line_number":2166,"context_line":"        # Restore the original rules."},{"line_number":2167,"context_line":"        policy.set_rules(orig_rules)"},{"line_number":2168,"context_line":""},{"line_number":2169,"context_line":"    def test_show(self):"},{"line_number":2170,"context_line":"        image_bookmark \u003d \"http://localhost/%s/images/10\" % self.project_id"}],"source_content_type":"text/x-python","patch_set":4,"id":"3fa7e38b_662d23a7","line":2167,"range":{"start_line":2166,"start_character":8,"end_line":2167,"end_character":36},"updated":"2019-10-24 15:27:47.000000000","message":"I\u0027m not sure that it matters, but this seems like something that should go into a finally block in case func or assert_not_called raises.","commit_id":"e80580ddc5393ce10ca23c51054b7151e1a477ea"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"b2f716c85d2fee41db47f937e522557cabee5dd1","unresolved":false,"context_lines":[{"line_number":2163,"context_line":"        policy.set_rules(oslo_policy.Rules.from_dict(rules), overwrite\u003dFalse)"},{"line_number":2164,"context_line":"        func()"},{"line_number":2165,"context_line":"        mock_get_host_status.assert_not_called()"},{"line_number":2166,"context_line":"        # Restore the original rules."},{"line_number":2167,"context_line":"        policy.set_rules(orig_rules)"},{"line_number":2168,"context_line":""},{"line_number":2169,"context_line":"    def test_show(self):"},{"line_number":2170,"context_line":"        image_bookmark \u003d \"http://localhost/%s/images/10\" % self.project_id"}],"source_content_type":"text/x-python","patch_set":4,"id":"3fa7e38b_3c62daae","line":2167,"range":{"start_line":2166,"start_character":8,"end_line":2167,"end_character":36},"in_reply_to":"3fa7e38b_662d23a7","updated":"2019-10-24 16:41:25.000000000","message":"I don\u0027t think it matters because policy rules are reset per test, so if func or assert_not_called raises, the test rightly fails and the policy rules for this test run no longer matter. Other tests will get fresh policy regardless.\n\nhttps://github.com/openstack/nova/blob/1bfa4626d13d0a73e63745cc4a864ae86d490daf/nova/test.py#L319\n\nThe reason I added the restore after my verify here is just in case someone ever adds more tests or assertions after the self._verify_host_status_policy_behavior(func) calls I added. I\u0027d expect to not have to care what policy modification occurred inside this helper method.","commit_id":"e80580ddc5393ce10ca23c51054b7151e1a477ea"}],"releasenotes/notes/host_status_unknown_policy-839cfda56b610d39.yaml":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"dc3fed3bc91363e1bf1080aca8ca94d783482048","unresolved":false,"context_lines":[{"line_number":3,"context_line":"  - |"},{"line_number":4,"context_line":"    A new policy rule ``os_compute_api:servers:show:host_status_unknown`` has"},{"line_number":5,"context_line":"    been added to control whether a user can view a server host status of"},{"line_number":6,"context_line":"    ``UNKNOWN`` in the /servers GET API."},{"line_number":7,"context_line":"    This is different than the ``os_compute_api:servers:show:host_status``"},{"line_number":8,"context_line":"    policy rule which controls whether a user can view all possible host"},{"line_number":9,"context_line":"    status in the /servers GET API including ``UP``, ``DOWN``, ``MAINTENANCE``,"}],"source_content_type":"text/x-yaml","patch_set":1,"id":"3fa7e38b_6c5796cc","line":6,"range":{"start_line":6,"start_character":23,"end_line":6,"end_character":39},"updated":"2019-10-18 22:00:56.000000000","message":"``GET /servers/{server_id}`` and ``GET /servers/detail`` APIs?","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"c7c67f2e29b19cd57b6034bd2385488718e54923","unresolved":false,"context_lines":[{"line_number":3,"context_line":"  - |"},{"line_number":4,"context_line":"    A new policy rule ``os_compute_api:servers:show:host_status_unknown`` has"},{"line_number":5,"context_line":"    been added to control whether a user can view a server host status of"},{"line_number":6,"context_line":"    ``UNKNOWN`` in the /servers GET API."},{"line_number":7,"context_line":"    This is different than the ``os_compute_api:servers:show:host_status``"},{"line_number":8,"context_line":"    policy rule which controls whether a user can view all possible host"},{"line_number":9,"context_line":"    status in the /servers GET API including ``UP``, ``DOWN``, ``MAINTENANCE``,"}],"source_content_type":"text/x-yaml","patch_set":1,"id":"3fa7e38b_699d1a09","line":6,"range":{"start_line":6,"start_character":23,"end_line":6,"end_character":39},"in_reply_to":"3fa7e38b_6c5796cc","updated":"2019-10-23 00:14:20.000000000","message":"Yes, will update.","commit_id":"2c5325e2bf52c1e6dd04c5ee3f3d0bfe08a1c6f0"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"f2a31fbe5978125ba5d2c3994b23d7ec5ccdd7b6","unresolved":false,"context_lines":[{"line_number":3,"context_line":"  - |"},{"line_number":4,"context_line":"    A new policy rule ``os_compute_api:servers:show:host_status:unknown-only``"},{"line_number":5,"context_line":"    has been added to control whether a user can view a server host status of"},{"line_number":6,"context_line":"    ``UNKNOWN`` in the ``GET /servers/{server_id}`` and ``GET /servers/detail``"},{"line_number":7,"context_line":"    APIs."},{"line_number":8,"context_line":"    This is different than the ``os_compute_api:servers:show:host_status``"},{"line_number":9,"context_line":"    policy rule which controls whether a user can view all possible host"}],"source_content_type":"text/x-yaml","patch_set":4,"id":"3fa7e38b_c659775b","line":6,"updated":"2019-10-24 15:27:47.000000000","message":"I don\u0027t know if it\u0027s worth mentioning, but if using microversion 2.75+ you\u0027ll also get this with PUT /servers/{server_id} and POST /servers/{server_id}/action (rebuild) responses. If you do add those, I\u0027d work it into a bullet list format since it\u0027s hard to follow all of that in prose.","commit_id":"e80580ddc5393ce10ca23c51054b7151e1a477ea"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"b2f716c85d2fee41db47f937e522557cabee5dd1","unresolved":false,"context_lines":[{"line_number":3,"context_line":"  - |"},{"line_number":4,"context_line":"    A new policy rule ``os_compute_api:servers:show:host_status:unknown-only``"},{"line_number":5,"context_line":"    has been added to control whether a user can view a server host status of"},{"line_number":6,"context_line":"    ``UNKNOWN`` in the ``GET /servers/{server_id}`` and ``GET /servers/detail``"},{"line_number":7,"context_line":"    APIs."},{"line_number":8,"context_line":"    This is different than the ``os_compute_api:servers:show:host_status``"},{"line_number":9,"context_line":"    policy rule which controls whether a user can view all possible host"}],"source_content_type":"text/x-yaml","patch_set":4,"id":"3fa7e38b_dca94690","line":6,"in_reply_to":"3fa7e38b_c659775b","updated":"2019-10-24 16:41:25.000000000","message":"Oh, yeah that\u0027s worth mentioning I think. Which means I need more test coverage too for PUT and POST.","commit_id":"e80580ddc5393ce10ca23c51054b7151e1a477ea"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"86d20b4d3cf5677617cb4087300b11c1789b472c","unresolved":false,"context_lines":[{"line_number":5,"context_line":"    has been added to control whether a user can view a server host status of"},{"line_number":6,"context_line":"    ``UNKNOWN`` in the following APIs:"},{"line_number":7,"context_line":""},{"line_number":8,"context_line":"    * ``GET /servers/{server_id}``"},{"line_number":9,"context_line":"    * ``GET /servers/detail``"},{"line_number":10,"context_line":"    * ``PUT /servers/{server_id}`` if using API microversion \u003e\u003d 2.75"},{"line_number":11,"context_line":"    * ``POST /servers/{server_id}/action`` (rebuild) if using API microversion"},{"line_number":12,"context_line":"      \u003e\u003d 2.75"}],"source_content_type":"text/x-yaml","patch_set":5,"id":"3fa7e38b_f68d3a2a","line":9,"range":{"start_line":8,"start_character":4,"end_line":9,"end_character":29},"updated":"2019-10-24 20:23:38.000000000","message":"Bah, I guess I should put microversion 2.16 in here.","commit_id":"1d4c7c4deaa9104aac30c0c5c2642afcab9244e6"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"9ed93aeb787a1184261c1eba549790f017208149","unresolved":false,"context_lines":[{"line_number":5,"context_line":"    has been added to control whether a user can view a server host status of"},{"line_number":6,"context_line":"    ``UNKNOWN`` in the following APIs:"},{"line_number":7,"context_line":""},{"line_number":8,"context_line":"    * ``GET /servers/{server_id}``"},{"line_number":9,"context_line":"    * ``GET /servers/detail``"},{"line_number":10,"context_line":"    * ``PUT /servers/{server_id}`` if using API microversion \u003e\u003d 2.75"},{"line_number":11,"context_line":"    * ``POST /servers/{server_id}/action`` (rebuild) if using API microversion"},{"line_number":12,"context_line":"      \u003e\u003d 2.75"}],"source_content_type":"text/x-yaml","patch_set":5,"id":"3fa7e38b_76cf0a57","line":9,"range":{"start_line":8,"start_character":4,"end_line":9,"end_character":29},"in_reply_to":"3fa7e38b_f68d3a2a","updated":"2019-10-24 20:25:30.000000000","message":"Done","commit_id":"1d4c7c4deaa9104aac30c0c5c2642afcab9244e6"}]}
