)]}'
{"cinder/db/api.py":[{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"4cfb1109acbcba40defefb5d5457cdddcbb2c758","unresolved":false,"context_lines":[{"line_number":98,"context_line":""},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"def service_get(context, service_id\u003dNone, **filters):"},{"line_number":101,"context_line":"    \"\"\"Get a service that matchs the criteria."},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    A possible filter is is_up\u003dTrue and it will filter nodes that are down."},{"line_number":104,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"fa0719c6_ac24e95f","line":101,"range":{"start_line":101,"start_character":26,"end_line":101,"end_character":32},"updated":"2016-03-23 12:38:42.000000000","message":"s/matchs/matches","commit_id":"7a1027ee562766b9b6fe389d4424d316687223db"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"20d565e3c42563c7cd911b53036e32e99aa56f9b","unresolved":false,"context_lines":[{"line_number":98,"context_line":""},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"def service_get(context, service_id\u003dNone, **filters):"},{"line_number":101,"context_line":"    \"\"\"Get a service that matchs the criteria."},{"line_number":102,"context_line":""},{"line_number":103,"context_line":"    A possible filter is is_up\u003dTrue and it will filter nodes that are down."},{"line_number":104,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"da0c15f0_6c795ff6","line":101,"range":{"start_line":101,"start_character":26,"end_line":101,"end_character":32},"in_reply_to":"fa0719c6_ac24e95f","updated":"2016-03-28 10:46:16.000000000","message":"Done","commit_id":"7a1027ee562766b9b6fe389d4424d316687223db"}],"cinder/db/sqlalchemy/api.py":[{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"a8ca3f1f364672b930c504d9b761aac6e3d4c753","unresolved":false,"context_lines":[{"line_number":373,"context_line":"    # well as hosts that specify the backend"},{"line_number":374,"context_line":"    if host:"},{"line_number":375,"context_line":"        host_attr \u003d models.Service.host"},{"line_number":376,"context_line":"        # Mysql is not doing case sensitive filtering, so we force it"},{"line_number":377,"context_line":"        if CONF.database.connection.startswith(\u0027mysql:\u0027):"},{"line_number":378,"context_line":"            conditions \u003d or_(host_attr \u003d\u003d func.binary(host),"},{"line_number":379,"context_line":"                             host_attr.op(\u0027LIKE BINARY\u0027)(host + \u0027@%\u0027))"},{"line_number":380,"context_line":"        else:"},{"line_number":381,"context_line":"            conditions \u003d or_(host_attr \u003d\u003d host,"},{"line_number":382,"context_line":"                             host_attr.op(\u0027LIKE\u0027)(host + \u0027@%\u0027))"},{"line_number":383,"context_line":"        query \u003d query.filter(conditions)"},{"line_number":384,"context_line":""},{"line_number":385,"context_line":"    if filters:"}],"source_content_type":"text/x-python","patch_set":5,"id":"5aef4532_8b134b5c","line":382,"range":{"start_line":376,"start_character":0,"end_line":382,"end_character":63},"updated":"2016-03-07 13:19:13.000000000","message":"This is much better than filtering on Python side, but were we using LIKE in previous version?","commit_id":"09b5591b683949c68db972a5660467766f4c9fd5"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"45b780b7db8371249852f5a56f0e8230ac936977","unresolved":false,"context_lines":[{"line_number":373,"context_line":"    # well as hosts that specify the backend"},{"line_number":374,"context_line":"    if host:"},{"line_number":375,"context_line":"        host_attr \u003d models.Service.host"},{"line_number":376,"context_line":"        # Mysql is not doing case sensitive filtering, so we force it"},{"line_number":377,"context_line":"        if CONF.database.connection.startswith(\u0027mysql:\u0027):"},{"line_number":378,"context_line":"            conditions \u003d or_(host_attr \u003d\u003d func.binary(host),"},{"line_number":379,"context_line":"                             host_attr.op(\u0027LIKE BINARY\u0027)(host + \u0027@%\u0027))"},{"line_number":380,"context_line":"        else:"},{"line_number":381,"context_line":"            conditions \u003d or_(host_attr \u003d\u003d host,"},{"line_number":382,"context_line":"                             host_attr.op(\u0027LIKE\u0027)(host + \u0027@%\u0027))"},{"line_number":383,"context_line":"        query \u003d query.filter(conditions)"},{"line_number":384,"context_line":""},{"line_number":385,"context_line":"    if filters:"}],"source_content_type":"text/x-python","patch_set":5,"id":"5aef4532_43456d15","line":382,"range":{"start_line":376,"start_character":0,"end_line":382,"end_character":63},"in_reply_to":"5aef4532_8b134b5c","updated":"2016-03-08 13:35:38.000000000","message":"We were only using it on service_get_all method -L399 of old code- which is one of the reasons to refactor, so that all methods behave in the same way.","commit_id":"09b5591b683949c68db972a5660467766f4c9fd5"},{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"4cfb1109acbcba40defefb5d5457cdddcbb2c758","unresolved":false,"context_lines":[{"line_number":35,"context_line":"from oslo_log import log as logging"},{"line_number":36,"context_line":"from oslo_utils import timeutils"},{"line_number":37,"context_line":"from oslo_utils import uuidutils"},{"line_number":38,"context_line":"import osprofiler.sqlalchemy"},{"line_number":39,"context_line":"import six"},{"line_number":40,"context_line":"import sqlalchemy"},{"line_number":41,"context_line":"from sqlalchemy import MetaData"}],"source_content_type":"text/x-python","patch_set":13,"id":"fa0719c6_ec7ee117","line":38,"range":{"start_line":38,"start_character":0,"end_line":38,"end_character":28},"updated":"2016-03-23 12:38:42.000000000","message":"Rebase glitch?","commit_id":"7a1027ee562766b9b6fe389d4424d316687223db"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"20d565e3c42563c7cd911b53036e32e99aa56f9b","unresolved":false,"context_lines":[{"line_number":35,"context_line":"from oslo_log import log as logging"},{"line_number":36,"context_line":"from oslo_utils import timeutils"},{"line_number":37,"context_line":"from oslo_utils import uuidutils"},{"line_number":38,"context_line":"import osprofiler.sqlalchemy"},{"line_number":39,"context_line":"import six"},{"line_number":40,"context_line":"import sqlalchemy"},{"line_number":41,"context_line":"from sqlalchemy import MetaData"}],"source_content_type":"text/x-python","patch_set":13,"id":"da0c15f0_4c1d7bbc","line":38,"range":{"start_line":38,"start_character":0,"end_line":38,"end_character":28},"in_reply_to":"fa0719c6_ec7ee117","updated":"2016-03-28 10:46:16.000000000","message":"Or in one of the many rebases I made a mistake...\n\nThanks for catching this.","commit_id":"7a1027ee562766b9b6fe389d4424d316687223db"},{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"4cfb1109acbcba40defefb5d5457cdddcbb2c758","unresolved":false,"context_lines":[{"line_number":85,"context_line":"            CONF.import_group(\"profiler\", \"cinder.service\")"},{"line_number":86,"context_line":"            if CONF.profiler.enabled:"},{"line_number":87,"context_line":"                if CONF.profiler.trace_sqlalchemy:"},{"line_number":88,"context_line":"                    osprofiler.sqlalchemy.add_tracing(sqlalchemy,"},{"line_number":89,"context_line":"                                                      _FACADE.get_engine(),"},{"line_number":90,"context_line":"                                                      \"db\")"},{"line_number":91,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"fa0719c6_6c913147","line":88,"range":{"start_line":88,"start_character":0,"end_line":88,"end_character":65},"updated":"2016-03-23 12:38:42.000000000","message":"ditto","commit_id":"7a1027ee562766b9b6fe389d4424d316687223db"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"20d565e3c42563c7cd911b53036e32e99aa56f9b","unresolved":false,"context_lines":[{"line_number":85,"context_line":"            CONF.import_group(\"profiler\", \"cinder.service\")"},{"line_number":86,"context_line":"            if CONF.profiler.enabled:"},{"line_number":87,"context_line":"                if CONF.profiler.trace_sqlalchemy:"},{"line_number":88,"context_line":"                    osprofiler.sqlalchemy.add_tracing(sqlalchemy,"},{"line_number":89,"context_line":"                                                      _FACADE.get_engine(),"},{"line_number":90,"context_line":"                                                      \"db\")"},{"line_number":91,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"da0c15f0_8c7dd3e9","line":88,"range":{"start_line":88,"start_character":0,"end_line":88,"end_character":65},"in_reply_to":"fa0719c6_6c913147","updated":"2016-03-28 10:46:16.000000000","message":"ditto","commit_id":"7a1027ee562766b9b6fe389d4424d316687223db"},{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"4cfb1109acbcba40defefb5d5457cdddcbb2c758","unresolved":false,"context_lines":[{"line_number":397,"context_line":""},{"line_number":398,"context_line":"@require_admin_context"},{"line_number":399,"context_line":"def service_get(context, service_id\u003dNone, **filters):"},{"line_number":400,"context_line":"    \"\"\"Get a service that matchs the criteria."},{"line_number":401,"context_line":""},{"line_number":402,"context_line":"    A possible filter is is_up\u003dTrue and it will filter nodes that are down."},{"line_number":403,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"fa0719c6_6cdf710d","line":400,"range":{"start_line":400,"start_character":26,"end_line":400,"end_character":32},"updated":"2016-03-23 12:38:42.000000000","message":"s/match/matches","commit_id":"7a1027ee562766b9b6fe389d4424d316687223db"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"20d565e3c42563c7cd911b53036e32e99aa56f9b","unresolved":false,"context_lines":[{"line_number":397,"context_line":""},{"line_number":398,"context_line":"@require_admin_context"},{"line_number":399,"context_line":"def service_get(context, service_id\u003dNone, **filters):"},{"line_number":400,"context_line":"    \"\"\"Get a service that matchs the criteria."},{"line_number":401,"context_line":""},{"line_number":402,"context_line":"    A possible filter is is_up\u003dTrue and it will filter nodes that are down."},{"line_number":403,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"da0c15f0_ec0d6f91","line":400,"range":{"start_line":400,"start_character":26,"end_line":400,"end_character":32},"in_reply_to":"fa0719c6_6cdf710d","updated":"2016-03-28 10:46:16.000000000","message":"Done","commit_id":"7a1027ee562766b9b6fe389d4424d316687223db"},{"author":{"_account_id":2243,"name":"John Griffith","email":"john.griffith8@gmail.com","username":"john-griffith"},"change_message_id":"58afd7d8d90098e34da86ed21039ce2bee0b56c7","unresolved":false,"context_lines":[{"line_number":356,"context_line":""},{"line_number":357,"context_line":"###################"},{"line_number":358,"context_line":""},{"line_number":359,"context_line":""},{"line_number":360,"context_line":"def _clean_filters(filters):"},{"line_number":361,"context_line":"    return {k: v for k, v in filters.items() if v is not None}"},{"line_number":362,"context_line":""}],"source_content_type":"text/x-python","patch_set":15,"id":"ba0121b8_73f1e26a","line":359,"range":{"start_line":359,"start_character":0,"end_line":359,"end_character":0},"updated":"2016-03-31 16:53:50.000000000","message":"are you removing context checks intentionally?  Is there a reason for that?","commit_id":"c60afc1353c37b1be737d93be0e21452f50cb248"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"8b0ffbf333570016f24c41c7e46bf2c6548148ca","unresolved":false,"context_lines":[{"line_number":356,"context_line":""},{"line_number":357,"context_line":"###################"},{"line_number":358,"context_line":""},{"line_number":359,"context_line":""},{"line_number":360,"context_line":"def _clean_filters(filters):"},{"line_number":361,"context_line":"    return {k: v for k, v in filters.items() if v is not None}"},{"line_number":362,"context_line":""}],"source_content_type":"text/x-python","patch_set":15,"id":"ba0121b8_bb8defd4","line":359,"range":{"start_line":359,"start_character":0,"end_line":359,"end_character":0},"in_reply_to":"ba0121b8_73f1e26a","updated":"2016-04-01 10:28:42.000000000","message":"I removed the check on _service_query because this is an internal method to the module and we are already checking the context on the methods that are exposed outside the module: service_destroy, service_get, service_get_all, so I see no point in checking the context twice.\n\nBut if you see a case where it would be helpful to have it I\u0027ll add it back.","commit_id":"c60afc1353c37b1be737d93be0e21452f50cb248"},{"author":{"_account_id":15961,"name":"lisali","email":"xiaoyan.li@intel.com","username":"lisali"},"change_message_id":"66b0d4b145bc6fe262f81e3fb98ab71aa0ede481","unresolved":false,"context_lines":[{"line_number":421,"context_line":"        serv_id \u003d service_id or filters.get(\u0027topic\u0027) or filters.get(\u0027binary\u0027)"},{"line_number":422,"context_line":"        raise exception.ServiceNotFound(service_id\u003dserv_id,"},{"line_number":423,"context_line":"                                        host\u003dfilters.get(\u0027host\u0027))"},{"line_number":424,"context_line":"    return service"},{"line_number":425,"context_line":""},{"line_number":426,"context_line":""},{"line_number":427,"context_line":"@require_admin_context"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a122d0e_c3887dc9","line":424,"updated":"2016-04-22 07:48:27.000000000","message":"I am concerned why we set filters in service_get?\n\nIt may lead to the unclear usage between service_get and service_get_all. Seems that service_get can get anything done by service_get_all, the only difference is service_get raises exception when no service found.\n\nHow about we set service_get_all to following definition?\ndef service_get_all(context, raise_exception\u003dFalse, **filters)\n\nMeanwhile, use traditional service_get: \ndef service_get(context, service_id)\n\nIf we want to get is_up info, we can set this function as \ndef service_get(context, service_id, additional_info\u003dFalse) to get is_up extra info.\n\nJust my opinion.","commit_id":"19f2ca001a4b8f6decb10b5d3c017865a6b11b66"},{"author":{"_account_id":15961,"name":"lisali","email":"xiaoyan.li@intel.com","username":"lisali"},"change_message_id":"919fbbae74c1d24a270e4b0eb93ff8bd567edabb","unresolved":false,"context_lines":[{"line_number":421,"context_line":"        serv_id \u003d service_id or filters.get(\u0027topic\u0027) or filters.get(\u0027binary\u0027)"},{"line_number":422,"context_line":"        raise exception.ServiceNotFound(service_id\u003dserv_id,"},{"line_number":423,"context_line":"                                        host\u003dfilters.get(\u0027host\u0027))"},{"line_number":424,"context_line":"    return service"},{"line_number":425,"context_line":""},{"line_number":426,"context_line":""},{"line_number":427,"context_line":"@require_admin_context"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a122d0e_fedb4ceb","line":424,"in_reply_to":"1a122d0e_4faac771","updated":"2016-04-25 07:30:34.000000000","message":"Thanks for the explanation.","commit_id":"19f2ca001a4b8f6decb10b5d3c017865a6b11b66"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"d5bb3dd2136b5526e04ddbadf678d777286e2922","unresolved":false,"context_lines":[{"line_number":421,"context_line":"        serv_id \u003d service_id or filters.get(\u0027topic\u0027) or filters.get(\u0027binary\u0027)"},{"line_number":422,"context_line":"        raise exception.ServiceNotFound(service_id\u003dserv_id,"},{"line_number":423,"context_line":"                                        host\u003dfilters.get(\u0027host\u0027))"},{"line_number":424,"context_line":"    return service"},{"line_number":425,"context_line":""},{"line_number":426,"context_line":""},{"line_number":427,"context_line":"@require_admin_context"}],"source_content_type":"text/x-python","patch_set":19,"id":"1a122d0e_4faac771","line":424,"in_reply_to":"1a122d0e_c3887dc9","updated":"2016-04-22 10:39:01.000000000","message":"There are more differences to service_get and service_get_all:\n\n- service_get needs to exist with that exact name and first argument has to be the id because we have a generic OVO mechanism to get objects by ID (method is get_by_id) and methods get constructed using the object name and appending _get.\n\n- service_get differs from service_get_all also by returning only 1 element, not only by raising the exception.\n\nAlso by adding the filters we can do things like: Get me a backup service (any) that is up and enabled:\n\n service_get(context, binary\u003d\u0027cinder-backup\u0027, is_up\u003dTrue, disabled\u003dFalse)\n\nIt also gives additional consistency to the get methods.","commit_id":"19f2ca001a4b8f6decb10b5d3c017865a6b11b66"},{"author":{"_account_id":20140,"name":"Karthik Prabhu Vinod","email":"karthik.prabhu.vinod@intel.com","username":"kprabhuv"},"change_message_id":"f08dffcfa0739ca9c32b214396e9298d002fd195","unresolved":false,"context_lines":[{"line_number":375,"context_line":"    query \u003d model_query(context, models.Service, session\u003dsession,"},{"line_number":376,"context_line":"                        read_deleted\u003dread_deleted)"},{"line_number":377,"context_line":""},{"line_number":378,"context_line":"    # Host is a particular case of filter, because we must match exact match as"},{"line_number":379,"context_line":"    # well as hosts that specify the backend"},{"line_number":380,"context_line":"    if host:"},{"line_number":381,"context_line":"        host_attr \u003d models.Service.host"}],"source_content_type":"text/x-python","patch_set":33,"id":"1aa78d24_7e8be668","line":378,"range":{"start_line":378,"start_character":50,"end_line":378,"end_character":51},"updated":"2016-07-11 00:24:06.000000000","message":"Small typo. I believe this should be\n\nHost is a particular case of filter, because we must match either a single host or bunch of hosts that specify the same backend","commit_id":"b49ac833629af588eb59de5a295f506c65b2afb9"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"a29b47699b25fc9b4c8336cf43f1f1b6aa165471","unresolved":false,"context_lines":[{"line_number":375,"context_line":"    query \u003d model_query(context, models.Service, session\u003dsession,"},{"line_number":376,"context_line":"                        read_deleted\u003dread_deleted)"},{"line_number":377,"context_line":""},{"line_number":378,"context_line":"    # Host is a particular case of filter, because we must match exact match as"},{"line_number":379,"context_line":"    # well as hosts that specify the backend"},{"line_number":380,"context_line":"    if host:"},{"line_number":381,"context_line":"        host_attr \u003d models.Service.host"}],"source_content_type":"text/x-python","patch_set":33,"id":"1aa78d24_68e0ac26","line":378,"range":{"start_line":378,"start_character":50,"end_line":378,"end_character":51},"in_reply_to":"1aa78d24_7e8be668","updated":"2016-07-13 15:51:00.000000000","message":"Nop, they would match different backends from the same host name. But I agree it\u0027s not very clear.","commit_id":"b49ac833629af588eb59de5a295f506c65b2afb9"},{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"91668881486caa709b67e0767ad92cd710ec09e9","unresolved":false,"context_lines":[{"line_number":393,"context_line":"        query \u003d query.filter_by(**filters)"},{"line_number":394,"context_line":""},{"line_number":395,"context_line":"    if is_up is not None:"},{"line_number":396,"context_line":"        date_limit \u003d (timeutils.utcnow() -"},{"line_number":397,"context_line":"                      dt.timedelta(seconds\u003dCONF.service_down_time))"},{"line_number":398,"context_line":"        svc \u003d models.Service"},{"line_number":399,"context_line":"        filter_ \u003d or_("}],"source_content_type":"text/x-python","patch_set":36,"id":"dada55a8_523da6db","line":396,"range":{"start_line":396,"start_character":22,"end_line":396,"end_character":40},"updated":"2016-07-21 18:13:33.000000000","message":"I can see that in cinder.utils.service_is_up we\u0027re using with_timezone\u003dTrue here. Are we sure this isn\u0027t needed here?","commit_id":"88e7ae1acfdadc6d39748580e4abf66eb4af4a45"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"39eaf3fdfcfb38ea7623e0dcccc0dec8e98ba8df","unresolved":false,"context_lines":[{"line_number":393,"context_line":"        query \u003d query.filter_by(**filters)"},{"line_number":394,"context_line":""},{"line_number":395,"context_line":"    if is_up is not None:"},{"line_number":396,"context_line":"        date_limit \u003d (timeutils.utcnow() -"},{"line_number":397,"context_line":"                      dt.timedelta(seconds\u003dCONF.service_down_time))"},{"line_number":398,"context_line":"        svc \u003d models.Service"},{"line_number":399,"context_line":"        filter_ \u003d or_("}],"source_content_type":"text/x-python","patch_set":36,"id":"dada55a8_1c6cbc07","line":396,"range":{"start_line":396,"start_character":22,"end_line":396,"end_character":40},"in_reply_to":"dada55a8_523da6db","updated":"2016-07-22 12:18:24.000000000","message":"Yes, it\u0027s not required here because comparison is not going to be done by Python but the SQL engine.","commit_id":"88e7ae1acfdadc6d39748580e4abf66eb4af4a45"}],"cinder/db/sqlalchemy/models.py":[{"author":{"_account_id":2243,"name":"John Griffith","email":"john.griffith8@gmail.com","username":"john-griffith"},"change_message_id":"58afd7d8d90098e34da86ed21039ce2bee0b56c7","unresolved":false,"context_lines":[{"line_number":92,"context_line":"    replication_status \u003d Column(String(255), default\u003d\"not-capable\")"},{"line_number":93,"context_line":"    active_backend_id \u003d Column(String(255))"},{"line_number":94,"context_line":"    frozen \u003d Column(Boolean, nullable\u003dFalse, default\u003dFalse)"},{"line_number":95,"context_line":""},{"line_number":96,"context_line":"    @hybrid_property"},{"line_number":97,"context_line":"    def is_up(self):"},{"line_number":98,"context_line":"        date_limit \u003d (timeutils.utcnow() -"}],"source_content_type":"text/x-python","patch_set":15,"id":"ba0121b8_f328529c","line":95,"updated":"2016-03-31 16:53:50.000000000","message":"the hybrid decorator and the overloading your doing here is clever for sure, but from a maintenance/supportability standpoint for a project like cinder I think this sort of thing is a bad idea.  Actually, I think it\u0027s typically not such a great idea in Python at all.  Explicit being better than implicit etc.","commit_id":"c60afc1353c37b1be737d93be0e21452f50cb248"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"8b0ffbf333570016f24c41c7e46bf2c6548148ca","unresolved":false,"context_lines":[{"line_number":92,"context_line":"    replication_status \u003d Column(String(255), default\u003d\"not-capable\")"},{"line_number":93,"context_line":"    active_backend_id \u003d Column(String(255))"},{"line_number":94,"context_line":"    frozen \u003d Column(Boolean, nullable\u003dFalse, default\u003dFalse)"},{"line_number":95,"context_line":""},{"line_number":96,"context_line":"    @hybrid_property"},{"line_number":97,"context_line":"    def is_up(self):"},{"line_number":98,"context_line":"        date_limit \u003d (timeutils.utcnow() -"}],"source_content_type":"text/x-python","patch_set":15,"id":"ba0121b8_e6acee8d","line":95,"in_reply_to":"ba0121b8_f328529c","updated":"2016-04-01 10:28:42.000000000","message":"I\u0027ll give a little context of what I\u0027m trying to do here, as it is used by the other patches in the series (the job-distribution and also in the cleanup patches).\n\nThe idea is to be able to easily filter out using is_up field in any query.  For that I only need the @hybrid_property and the code in there, but if I remember correctly I added the @is_up.expression only for completeness, although I could be remembering it wrong now.\n\nSince the meaning of is_up is going to be changing (first is like this, then it uses fields in Service and also takes into account if there is at least 1 service node that is_up, and then in the next release it goes to just depend on existing a service node that is up) it makes sense to have it here in a single point so no matter where this is used from it will have the right meaning.\n\nThat will reduce the chances of introducing a bug in one of these changes, and also it is a great help on some joined loads.","commit_id":"c60afc1353c37b1be737d93be0e21452f50cb248"},{"author":{"_account_id":1207,"name":"Duncan Thomas","email":"duncan.thomas@gmail.com","username":"duncan-thomas"},"change_message_id":"77d13c69edbb379ec071aba43c022cd9edfb32b8","unresolved":false,"context_lines":[{"line_number":52,"context_line":""},{"line_number":53,"context_line":"    def delete(self, session):"},{"line_number":54,"context_line":"        \"\"\"Delete this object.\"\"\""},{"line_number":55,"context_line":"        self.update(self.delete_values())"},{"line_number":56,"context_line":"        self.save(session\u003dsession)"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""}],"source_content_type":"text/x-python","patch_set":37,"id":"dada55a8_f9d60c26","line":55,"range":{"start_line":55,"start_character":25,"end_line":55,"end_character":38},"updated":"2016-07-22 15:11:05.000000000","message":"Why not hard code the dictionary here rather than the method call?","commit_id":"6cfecade9e2ee86bbb7d95c3c401c9e4c70f6a96"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"1cf9a88dc15a6e05b4d021639eafaf5a1333705f","unresolved":false,"context_lines":[{"line_number":52,"context_line":""},{"line_number":53,"context_line":"    def delete(self, session):"},{"line_number":54,"context_line":"        \"\"\"Delete this object.\"\"\""},{"line_number":55,"context_line":"        self.update(self.delete_values())"},{"line_number":56,"context_line":"        self.save(session\u003dsession)"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""}],"source_content_type":"text/x-python","patch_set":37,"id":"dada55a8_7408632e","line":55,"range":{"start_line":55,"start_character":25,"end_line":55,"end_character":38},"in_reply_to":"dada55a8_f9d60c26","updated":"2016-07-22 15:40:56.000000000","message":"Because we use the delete_values when we don\u0027t have an ORM instance, example in this patch: https://review.openstack.org/#/c/286598/37/cinder/db/sqlalchemy/api.py@410","commit_id":"6cfecade9e2ee86bbb7d95c3c401c9e4c70f6a96"},{"author":{"_account_id":12924,"name":"Patrick East","email":"east.patrick@gmail.com","username":"patrick.east"},"change_message_id":"d0b83704ac41dade5299c36cfb549268955d26c7","unresolved":false,"context_lines":[{"line_number":52,"context_line":""},{"line_number":53,"context_line":"    def delete(self, session):"},{"line_number":54,"context_line":"        \"\"\"Delete this object.\"\"\""},{"line_number":55,"context_line":"        self.update(self.delete_values())"},{"line_number":56,"context_line":"        self.save(session\u003dsession)"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":""}],"source_content_type":"text/x-python","patch_set":37,"id":"dada55a8_546c3f08","line":55,"range":{"start_line":55,"start_character":25,"end_line":55,"end_character":38},"in_reply_to":"dada55a8_f9d60c26","updated":"2016-07-22 15:39:49.000000000","message":"Makes it a little easier for sub-classes to overwrite it I suppose","commit_id":"6cfecade9e2ee86bbb7d95c3c401c9e4c70f6a96"}],"cinder/tests/unit/api/contrib/test_admin_actions.py":[{"author":{"_account_id":4523,"name":"Eric Harney","email":"eharney@redhat.com","username":"eharney"},"change_message_id":"a12ebb22841d3790036b7b73b43d29f2035e3089","unresolved":false,"context_lines":[{"line_number":660,"context_line":"                          {\u0027status\u0027: \u0027creating\u0027})"},{"line_number":661,"context_line":""},{"line_number":662,"context_line":"    @mock.patch(\u0027cinder.objects.service.Service.get_minimum_rpc_version\u0027,"},{"line_number":663,"context_line":"                autspec\u003dTrue, return_value\u003d\u00272.0\u0027)"},{"line_number":664,"context_line":"    @mock.patch(\u0027cinder.objects.service.Service.get_minimum_obj_version\u0027,"},{"line_number":665,"context_line":"                autspec\u003dTrue,"},{"line_number":666,"context_line":"                return_value\u003dobjects.base.OBJ_VERSIONS.get_current())"}],"source_content_type":"text/x-python","patch_set":32,"id":"1aa78d24_73fab476","line":663,"updated":"2016-07-06 13:49:32.000000000","message":"s/autspec/autospec","commit_id":"85939dac895433105f85f56ac62de4127685c9b9"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"9ea9ab56706dc629e8a1a82517a670332bc2d368","unresolved":false,"context_lines":[{"line_number":660,"context_line":"                          {\u0027status\u0027: \u0027creating\u0027})"},{"line_number":661,"context_line":""},{"line_number":662,"context_line":"    @mock.patch(\u0027cinder.objects.service.Service.get_minimum_rpc_version\u0027,"},{"line_number":663,"context_line":"                autspec\u003dTrue, return_value\u003d\u00272.0\u0027)"},{"line_number":664,"context_line":"    @mock.patch(\u0027cinder.objects.service.Service.get_minimum_obj_version\u0027,"},{"line_number":665,"context_line":"                autspec\u003dTrue,"},{"line_number":666,"context_line":"                return_value\u003dobjects.base.OBJ_VERSIONS.get_current())"}],"source_content_type":"text/x-python","patch_set":32,"id":"1aa78d24_b8addeea","line":663,"in_reply_to":"1aa78d24_73fab476","updated":"2016-07-07 12:04:54.000000000","message":"Oooops, me and my typing.\n\nAnd I\u0027ll have to change it, because mock.patch cannot handle the method with the classmethod decorator using autospec\u003dTrue.   :-(","commit_id":"85939dac895433105f85f56ac62de4127685c9b9"},{"author":{"_account_id":4523,"name":"Eric Harney","email":"eharney@redhat.com","username":"eharney"},"change_message_id":"a12ebb22841d3790036b7b73b43d29f2035e3089","unresolved":false,"context_lines":[{"line_number":662,"context_line":"    @mock.patch(\u0027cinder.objects.service.Service.get_minimum_rpc_version\u0027,"},{"line_number":663,"context_line":"                autspec\u003dTrue, return_value\u003d\u00272.0\u0027)"},{"line_number":664,"context_line":"    @mock.patch(\u0027cinder.objects.service.Service.get_minimum_obj_version\u0027,"},{"line_number":665,"context_line":"                autspec\u003dTrue,"},{"line_number":666,"context_line":"                return_value\u003dobjects.base.OBJ_VERSIONS.get_current())"},{"line_number":667,"context_line":"    @mock.patch(\u0027cinder.db.service_get_all\u0027)"},{"line_number":668,"context_line":"    @mock.patch(\u0027cinder.backup.api.API._check_support_to_force_delete\u0027)"}],"source_content_type":"text/x-python","patch_set":32,"id":"1aa78d24_d331e85b","line":665,"updated":"2016-07-06 13:49:32.000000000","message":"Ditto","commit_id":"85939dac895433105f85f56ac62de4127685c9b9"},{"author":{"_account_id":4523,"name":"Eric Harney","email":"eharney@redhat.com","username":"eharney"},"change_message_id":"a12ebb22841d3790036b7b73b43d29f2035e3089","unresolved":false,"context_lines":[{"line_number":668,"context_line":"    @mock.patch(\u0027cinder.backup.api.API._check_support_to_force_delete\u0027)"},{"line_number":669,"context_line":"    def _force_delete_backup_util(self, test_status, mock_check_support,"},{"line_number":670,"context_line":"                                  _mock_service_get_all, mock_obj, mock_rpc):"},{"line_number":671,"context_line":"        _mock_service_get_all.return_value \u003d ["},{"line_number":672,"context_line":"            {\u0027availability_zone\u0027: \"az1\", \u0027host\u0027: \u0027testhost\u0027,"},{"line_number":673,"context_line":"             \u0027disabled\u0027: 0, \u0027updated_at\u0027: timeutils.utcnow()}]"},{"line_number":674,"context_line":"        # admin context"}],"source_content_type":"text/x-python","patch_set":32,"id":"1aa78d24_934480b7","line":671,"updated":"2016-07-06 13:49:32.000000000","message":"This var shouldn\u0027t really start w/ underscore since it\u0027s used and tested here.","commit_id":"85939dac895433105f85f56ac62de4127685c9b9"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"9ea9ab56706dc629e8a1a82517a670332bc2d368","unresolved":false,"context_lines":[{"line_number":668,"context_line":"    @mock.patch(\u0027cinder.backup.api.API._check_support_to_force_delete\u0027)"},{"line_number":669,"context_line":"    def _force_delete_backup_util(self, test_status, mock_check_support,"},{"line_number":670,"context_line":"                                  _mock_service_get_all, mock_obj, mock_rpc):"},{"line_number":671,"context_line":"        _mock_service_get_all.return_value \u003d ["},{"line_number":672,"context_line":"            {\u0027availability_zone\u0027: \"az1\", \u0027host\u0027: \u0027testhost\u0027,"},{"line_number":673,"context_line":"             \u0027disabled\u0027: 0, \u0027updated_at\u0027: timeutils.utcnow()}]"},{"line_number":674,"context_line":"        # admin context"}],"source_content_type":"text/x-python","patch_set":32,"id":"1aa78d24_589e7ab9","line":671,"in_reply_to":"1aa78d24_934480b7","updated":"2016-07-07 12:04:54.000000000","message":"Ok, but I didn\u0027t choose the name, I just removed the ending \"_by_topic\" from the original name.  ;-)","commit_id":"85939dac895433105f85f56ac62de4127685c9b9"},{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"91668881486caa709b67e0767ad92cd710ec09e9","unresolved":false,"context_lines":[{"line_number":660,"context_line":"                          {\u0027status\u0027: \u0027creating\u0027})"},{"line_number":661,"context_line":""},{"line_number":662,"context_line":"    @mock.patch(\u0027cinder.objects.service.Service.get_minimum_rpc_version\u0027,"},{"line_number":663,"context_line":"                autospecs\u003dobjects.Service.get_minimum_rpc_version,"},{"line_number":664,"context_line":"                return_value\u003d\u00272.0\u0027)"},{"line_number":665,"context_line":"    @mock.patch(\u0027cinder.objects.service.Service.get_minimum_obj_version\u0027,"},{"line_number":666,"context_line":"                autospecs\u003dobjects.Service.get_minimum_rpc_version,"}],"source_content_type":"text/x-python","patch_set":36,"id":"dada55a8_4625e759","line":663,"range":{"start_line":663,"start_character":16,"end_line":663,"end_character":25},"updated":"2016-07-21 18:13:33.000000000","message":"Looks like the valid argument is `autospec`.","commit_id":"88e7ae1acfdadc6d39748580e4abf66eb4af4a45"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"39eaf3fdfcfb38ea7623e0dcccc0dec8e98ba8df","unresolved":false,"context_lines":[{"line_number":660,"context_line":"                          {\u0027status\u0027: \u0027creating\u0027})"},{"line_number":661,"context_line":""},{"line_number":662,"context_line":"    @mock.patch(\u0027cinder.objects.service.Service.get_minimum_rpc_version\u0027,"},{"line_number":663,"context_line":"                autospecs\u003dobjects.Service.get_minimum_rpc_version,"},{"line_number":664,"context_line":"                return_value\u003d\u00272.0\u0027)"},{"line_number":665,"context_line":"    @mock.patch(\u0027cinder.objects.service.Service.get_minimum_obj_version\u0027,"},{"line_number":666,"context_line":"                autospecs\u003dobjects.Service.get_minimum_rpc_version,"}],"source_content_type":"text/x-python","patch_set":36,"id":"dada55a8_974887ce","line":663,"range":{"start_line":663,"start_character":16,"end_line":663,"end_character":25},"in_reply_to":"dada55a8_4625e759","updated":"2016-07-22 12:18:24.000000000","message":"Yes it is, but I have to remove it, because mock doesn\u0027t work as it should with classmethods  :-(","commit_id":"88e7ae1acfdadc6d39748580e4abf66eb4af4a45"},{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"91668881486caa709b67e0767ad92cd710ec09e9","unresolved":false,"context_lines":[{"line_number":663,"context_line":"                autospecs\u003dobjects.Service.get_minimum_rpc_version,"},{"line_number":664,"context_line":"                return_value\u003d\u00272.0\u0027)"},{"line_number":665,"context_line":"    @mock.patch(\u0027cinder.objects.service.Service.get_minimum_obj_version\u0027,"},{"line_number":666,"context_line":"                autospecs\u003dobjects.Service.get_minimum_rpc_version,"},{"line_number":667,"context_line":"                return_value\u003dobjects.base.OBJ_VERSIONS.get_current())"},{"line_number":668,"context_line":"    @mock.patch(\u0027cinder.db.service_get_all\u0027)"},{"line_number":669,"context_line":"    @mock.patch(\u0027cinder.backup.api.API._check_support_to_force_delete\u0027)"}],"source_content_type":"text/x-python","patch_set":36,"id":"dada55a8_66f74bd3","line":666,"range":{"start_line":666,"start_character":16,"end_line":666,"end_character":25},"updated":"2016-07-21 18:13:33.000000000","message":"ditto","commit_id":"88e7ae1acfdadc6d39748580e4abf66eb4af4a45"},{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"91668881486caa709b67e0767ad92cd710ec09e9","unresolved":false,"context_lines":[{"line_number":659,"context_line":"                          vac.validate_update,"},{"line_number":660,"context_line":"                          {\u0027status\u0027: \u0027creating\u0027})"},{"line_number":661,"context_line":""},{"line_number":662,"context_line":"    @mock.patch(\u0027cinder.objects.service.Service.get_minimum_rpc_version\u0027,"},{"line_number":663,"context_line":"                autospecs\u003dobjects.Service.get_minimum_rpc_version,"},{"line_number":664,"context_line":"                return_value\u003d\u00272.0\u0027)"},{"line_number":665,"context_line":"    @mock.patch(\u0027cinder.objects.service.Service.get_minimum_obj_version\u0027,"},{"line_number":666,"context_line":"                autospecs\u003dobjects.Service.get_minimum_rpc_version,"},{"line_number":667,"context_line":"                return_value\u003dobjects.base.OBJ_VERSIONS.get_current())"},{"line_number":668,"context_line":"    @mock.patch(\u0027cinder.db.service_get_all\u0027)"},{"line_number":669,"context_line":"    @mock.patch(\u0027cinder.backup.api.API._check_support_to_force_delete\u0027)"},{"line_number":670,"context_line":"    def _force_delete_backup_util(self, test_status, mock_check_support,"}],"source_content_type":"text/x-python","patch_set":36,"id":"dada55a8_26b6f3f8","line":667,"range":{"start_line":662,"start_character":0,"end_line":667,"end_character":69},"updated":"2016-07-21 18:13:33.000000000","message":"Can you explain briefly why we need these mocks?","commit_id":"88e7ae1acfdadc6d39748580e4abf66eb4af4a45"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"39eaf3fdfcfb38ea7623e0dcccc0dec8e98ba8df","unresolved":false,"context_lines":[{"line_number":659,"context_line":"                          vac.validate_update,"},{"line_number":660,"context_line":"                          {\u0027status\u0027: \u0027creating\u0027})"},{"line_number":661,"context_line":""},{"line_number":662,"context_line":"    @mock.patch(\u0027cinder.objects.service.Service.get_minimum_rpc_version\u0027,"},{"line_number":663,"context_line":"                autospecs\u003dobjects.Service.get_minimum_rpc_version,"},{"line_number":664,"context_line":"                return_value\u003d\u00272.0\u0027)"},{"line_number":665,"context_line":"    @mock.patch(\u0027cinder.objects.service.Service.get_minimum_obj_version\u0027,"},{"line_number":666,"context_line":"                autospecs\u003dobjects.Service.get_minimum_rpc_version,"},{"line_number":667,"context_line":"                return_value\u003dobjects.base.OBJ_VERSIONS.get_current())"},{"line_number":668,"context_line":"    @mock.patch(\u0027cinder.db.service_get_all\u0027)"},{"line_number":669,"context_line":"    @mock.patch(\u0027cinder.backup.api.API._check_support_to_force_delete\u0027)"},{"line_number":670,"context_line":"    def _force_delete_backup_util(self, test_status, mock_check_support,"}],"source_content_type":"text/x-python","patch_set":36,"id":"dada55a8_f7dbc21f","line":667,"range":{"start_line":662,"start_character":0,"end_line":667,"end_character":69},"in_reply_to":"dada55a8_26b6f3f8","updated":"2016-07-22 12:18:24.000000000","message":"Because it makes the test easier to read, as otherwise check at L691 would have to check 3 calls instead of 1.\n\nAnyway, since this is an unrelated change I have reduced this to the minimum in the next patch, which is just to mock the RPC call.","commit_id":"88e7ae1acfdadc6d39748580e4abf66eb4af4a45"}],"cinder/tests/unit/api/contrib/test_hosts.py":[{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"4cfb1109acbcba40defefb5d5457cdddcbb2c758","unresolved":false,"context_lines":[{"line_number":86,"context_line":"        super(HostTestCase, self).setUp()"},{"line_number":87,"context_line":"        self.controller \u003d os_hosts.HostController()"},{"line_number":88,"context_line":"        self.req \u003d FakeRequest()"},{"line_number":89,"context_line":"        self.patch(\u0027cinder.db.service_get_all\u0027, autospec\u003dTrue,"},{"line_number":90,"context_line":"                   return_value\u003dSERVICE_LIST)"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"        self.stubs.Set(timeutils, \u0027utcnow\u0027, stub_utcnow)"},{"line_number":93,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"fa0719c6_4789a674","line":90,"range":{"start_line":89,"start_character":0,"end_line":90,"end_character":45},"updated":"2016-03-23 12:38:42.000000000","message":"I guess this also can be class-wide decorator? But since you cannot get away from introducing TestCase.patch that\u0027s nothing serious.","commit_id":"7a1027ee562766b9b6fe389d4424d316687223db"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"20d565e3c42563c7cd911b53036e32e99aa56f9b","unresolved":false,"context_lines":[{"line_number":86,"context_line":"        super(HostTestCase, self).setUp()"},{"line_number":87,"context_line":"        self.controller \u003d os_hosts.HostController()"},{"line_number":88,"context_line":"        self.req \u003d FakeRequest()"},{"line_number":89,"context_line":"        self.patch(\u0027cinder.db.service_get_all\u0027, autospec\u003dTrue,"},{"line_number":90,"context_line":"                   return_value\u003dSERVICE_LIST)"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"        self.stubs.Set(timeutils, \u0027utcnow\u0027, stub_utcnow)"},{"line_number":93,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"da0c15f0_8cf2f36d","line":90,"range":{"start_line":89,"start_character":0,"end_line":90,"end_character":45},"in_reply_to":"fa0719c6_4789a674","updated":"2016-03-28 10:46:16.000000000","message":"I could always use a decorator and in the case where I really need to do the patch do the patching there instead of using a common function.","commit_id":"7a1027ee562766b9b6fe389d4424d316687223db"},{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"91668881486caa709b67e0767ad92cd710ec09e9","unresolved":false,"context_lines":[{"line_number":88,"context_line":"        self.patch(\u0027cinder.db.service_get_all\u0027, autospec\u003dTrue,"},{"line_number":89,"context_line":"                   return_value\u003dSERVICE_LIST)"},{"line_number":90,"context_line":""},{"line_number":91,"context_line":"        self.stubs.Set(timeutils, \u0027utcnow\u0027, stub_utcnow)"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"    def _test_host_update(self, host, key, val, expected_value):"},{"line_number":94,"context_line":"        body \u003d {key: val}"}],"source_content_type":"text/x-python","patch_set":36,"id":"dada55a8_4659678d","line":91,"range":{"start_line":91,"start_character":0,"end_line":91,"end_character":56},"updated":"2016-07-21 18:13:33.000000000","message":"I think this is for is_up purposes, so can we also convert it to mock here?","commit_id":"88e7ae1acfdadc6d39748580e4abf66eb4af4a45"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"39eaf3fdfcfb38ea7623e0dcccc0dec8e98ba8df","unresolved":false,"context_lines":[{"line_number":88,"context_line":"        self.patch(\u0027cinder.db.service_get_all\u0027, autospec\u003dTrue,"},{"line_number":89,"context_line":"                   return_value\u003dSERVICE_LIST)"},{"line_number":90,"context_line":""},{"line_number":91,"context_line":"        self.stubs.Set(timeutils, \u0027utcnow\u0027, stub_utcnow)"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":"    def _test_host_update(self, host, key, val, expected_value):"},{"line_number":94,"context_line":"        body \u003d {key: val}"}],"source_content_type":"text/x-python","patch_set":36,"id":"dada55a8_b7daea15","line":91,"range":{"start_line":91,"start_character":0,"end_line":91,"end_character":56},"in_reply_to":"dada55a8_4659678d","updated":"2016-07-22 12:18:24.000000000","message":"Sure!","commit_id":"88e7ae1acfdadc6d39748580e4abf66eb4af4a45"}],"cinder/tests/unit/api/contrib/test_services.py":[{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"a8ca3f1f364672b930c504d9b761aac6e3d4c753","unresolved":false,"context_lines":[{"line_number":181,"context_line":"    def setUp(self):"},{"line_number":182,"context_line":"        super(ServicesTest, self).setUp()"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"        self.patch(\u0027cinder.db.service_get_all\u0027, fake_service_get_all)"},{"line_number":185,"context_line":"        self.patch(\u0027cinder.db.service_get\u0027, fake_service_get)"},{"line_number":186,"context_line":""},{"line_number":187,"context_line":"        self.stubs.Set(timeutils, \"utcnow\", fake_utcnow)"},{"line_number":188,"context_line":"        self.stubs.Set(db, \"service_update\", fake_service_update)"}],"source_content_type":"text/x-python","patch_set":5,"id":"5aef4532_eb648f4a","line":185,"range":{"start_line":184,"start_character":0,"end_line":185,"end_character":61},"updated":"2016-03-07 13:19:13.000000000","message":"Isn\u0027t it easier to just use mock.patch decorator on whole class?","commit_id":"09b5591b683949c68db972a5660467766f4c9fd5"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"45b780b7db8371249852f5a56f0e8230ac936977","unresolved":false,"context_lines":[{"line_number":181,"context_line":"    def setUp(self):"},{"line_number":182,"context_line":"        super(ServicesTest, self).setUp()"},{"line_number":183,"context_line":""},{"line_number":184,"context_line":"        self.patch(\u0027cinder.db.service_get_all\u0027, fake_service_get_all)"},{"line_number":185,"context_line":"        self.patch(\u0027cinder.db.service_get\u0027, fake_service_get)"},{"line_number":186,"context_line":""},{"line_number":187,"context_line":"        self.stubs.Set(timeutils, \"utcnow\", fake_utcnow)"},{"line_number":188,"context_line":"        self.stubs.Set(db, \"service_update\", fake_service_update)"}],"source_content_type":"text/x-python","patch_set":5,"id":"5aef4532_c305fcc2","line":185,"range":{"start_line":184,"start_character":0,"end_line":185,"end_character":61},"in_reply_to":"5aef4532_eb648f4a","updated":"2016-03-08 13:35:38.000000000","message":"Yes I could change them to be a class decorator, but I thought it made more sense to keep all mock/stubs together.  Since I did it for consistency I\u0027ll just change all stubs to class level mocks.","commit_id":"09b5591b683949c68db972a5660467766f4c9fd5"},{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"4cfb1109acbcba40defefb5d5457cdddcbb2c758","unresolved":false,"context_lines":[{"line_number":174,"context_line":"    return datetime.datetime(2012, 10, 29, 13, 42, 11, tzinfo\u003dtzinfo)"},{"line_number":175,"context_line":""},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"@mock.patch(\u0027cinder.db.service_get_all\u0027, fake_service_get_all)"},{"line_number":178,"context_line":"@mock.patch(\u0027cinder.db.service_get\u0027, fake_service_get)"},{"line_number":179,"context_line":"@mock.patch(\u0027oslo_utils.timeutils.utcnow\u0027, fake_utcnow)"},{"line_number":180,"context_line":"@mock.patch(\u0027cinder.db.service_update\u0027, fake_service_update)"}],"source_content_type":"text/x-python","patch_set":13,"id":"fa0719c6_c74ad625","line":177,"range":{"start_line":177,"start_character":0,"end_line":177,"end_character":62},"updated":"2016-03-23 12:38:42.000000000","message":"I\u0027ve always did it that way:\n\n @mock.patch(\u0027cinder.db.service_get_all\u0027, side_effect\u003dfake_service_get_all)\n\nI don\u0027t really know if there\u0027s any difference or downside of each approach?","commit_id":"7a1027ee562766b9b6fe389d4424d316687223db"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"20d565e3c42563c7cd911b53036e32e99aa56f9b","unresolved":false,"context_lines":[{"line_number":174,"context_line":"    return datetime.datetime(2012, 10, 29, 13, 42, 11, tzinfo\u003dtzinfo)"},{"line_number":175,"context_line":""},{"line_number":176,"context_line":""},{"line_number":177,"context_line":"@mock.patch(\u0027cinder.db.service_get_all\u0027, fake_service_get_all)"},{"line_number":178,"context_line":"@mock.patch(\u0027cinder.db.service_get\u0027, fake_service_get)"},{"line_number":179,"context_line":"@mock.patch(\u0027oslo_utils.timeutils.utcnow\u0027, fake_utcnow)"},{"line_number":180,"context_line":"@mock.patch(\u0027cinder.db.service_update\u0027, fake_service_update)"}],"source_content_type":"text/x-python","patch_set":13,"id":"da0c15f0_ec6e0f00","line":177,"range":{"start_line":177,"start_character":0,"end_line":177,"end_character":62},"in_reply_to":"fa0719c6_c74ad625","updated":"2016-03-28 10:46:16.000000000","message":"There is significant difference, when you use side_effect a  Mock instance gets created and it will call the method you specified, but then you\u0027ll get the Mock instance in all your test methods.\n\nBy doing it this way you are saying that you want to replace the original object with provided object, therefore no new object will be created and no Mock instance passed to your test methods.\n\nSince we are not checking that the methods are called and which arguments they are passed this makes more sense in this case.","commit_id":"7a1027ee562766b9b6fe389d4424d316687223db"}],"cinder/tests/unit/api/v1/test_volume_metadata.py":[{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"a8ca3f1f364672b930c504d9b761aac6e3d4c753","unresolved":false,"context_lines":[{"line_number":137,"context_line":"        self.stubs.Set(volume.api.API, \u0027get\u0027, get_volume)"},{"line_number":138,"context_line":"        self.stubs.Set(cinder.db, \u0027volume_metadata_get\u0027,"},{"line_number":139,"context_line":"                       return_volume_metadata)"},{"line_number":140,"context_line":"        self.patch("},{"line_number":141,"context_line":"            \u0027cinder.db.service_get_all\u0027, autospec\u003dTrue,"},{"line_number":142,"context_line":"            return_value\u003dstubs.stub_service_get_all_by_topic(None, None))"},{"line_number":143,"context_line":""},{"line_number":144,"context_line":"        self.stubs.Set(self.volume_api, \u0027update_volume_metadata\u0027,"},{"line_number":145,"context_line":"                       fake_update_volume_metadata)"}],"source_content_type":"text/x-python","patch_set":5,"id":"5aef4532_4bd143cd","line":142,"range":{"start_line":140,"start_character":0,"end_line":142,"end_character":73},"updated":"2016-03-07 13:19:13.000000000","message":"Isn\u0027t it possible to do with @mock.patch decorator on whole class?","commit_id":"09b5591b683949c68db972a5660467766f4c9fd5"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"45b780b7db8371249852f5a56f0e8230ac936977","unresolved":false,"context_lines":[{"line_number":137,"context_line":"        self.stubs.Set(volume.api.API, \u0027get\u0027, get_volume)"},{"line_number":138,"context_line":"        self.stubs.Set(cinder.db, \u0027volume_metadata_get\u0027,"},{"line_number":139,"context_line":"                       return_volume_metadata)"},{"line_number":140,"context_line":"        self.patch("},{"line_number":141,"context_line":"            \u0027cinder.db.service_get_all\u0027, autospec\u003dTrue,"},{"line_number":142,"context_line":"            return_value\u003dstubs.stub_service_get_all_by_topic(None, None))"},{"line_number":143,"context_line":""},{"line_number":144,"context_line":"        self.stubs.Set(self.volume_api, \u0027update_volume_metadata\u0027,"},{"line_number":145,"context_line":"                       fake_update_volume_metadata)"}],"source_content_type":"text/x-python","patch_set":5,"id":"5aef4532_e34f59bb","line":142,"range":{"start_line":140,"start_character":0,"end_line":142,"end_character":73},"in_reply_to":"5aef4532_4bd143cd","updated":"2016-03-08 13:35:38.000000000","message":"If we do it at the class level, then L161 will fail because apparently class patching doesn\u0027t get into action until after setUp.  :-(","commit_id":"09b5591b683949c68db972a5660467766f4c9fd5"},{"author":{"_account_id":11600,"name":"Michał Dulko","email":"michal.dulko@gmail.com","username":"dulek"},"change_message_id":"91668881486caa709b67e0767ad92cd710ec09e9","unresolved":false,"context_lines":[{"line_number":147,"context_line":"                       return_volume_metadata)"},{"line_number":148,"context_line":"        self.patch("},{"line_number":149,"context_line":"            \u0027cinder.db.service_get_all\u0027, autospec\u003dTrue,"},{"line_number":150,"context_line":"            return_value\u003dstubs.stub_service_get_all_by_topic(None, None))"},{"line_number":151,"context_line":""},{"line_number":152,"context_line":"        self.ext_mgr \u003d extensions.ExtensionManager()"},{"line_number":153,"context_line":"        self.ext_mgr.extensions \u003d {}"}],"source_content_type":"text/x-python","patch_set":36,"id":"dada55a8_49085828","line":150,"range":{"start_line":150,"start_character":31,"end_line":150,"end_character":60},"updated":"2016-07-21 18:13:33.000000000","message":"Shouldn\u0027t we get rid of this stub and use stub_service_get_all instead? Same with the next file. Looks like these are all of the usages.","commit_id":"88e7ae1acfdadc6d39748580e4abf66eb4af4a45"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"39eaf3fdfcfb38ea7623e0dcccc0dec8e98ba8df","unresolved":false,"context_lines":[{"line_number":147,"context_line":"                       return_volume_metadata)"},{"line_number":148,"context_line":"        self.patch("},{"line_number":149,"context_line":"            \u0027cinder.db.service_get_all\u0027, autospec\u003dTrue,"},{"line_number":150,"context_line":"            return_value\u003dstubs.stub_service_get_all_by_topic(None, None))"},{"line_number":151,"context_line":""},{"line_number":152,"context_line":"        self.ext_mgr \u003d extensions.ExtensionManager()"},{"line_number":153,"context_line":"        self.ext_mgr.extensions \u003d {}"}],"source_content_type":"text/x-python","patch_set":36,"id":"dada55a8_5aabd3d6","line":150,"range":{"start_line":150,"start_character":31,"end_line":150,"end_character":60},"in_reply_to":"dada55a8_49085828","updated":"2016-07-22 12:18:24.000000000","message":"Well, this is API v1 and in v1 stubs we don\u0027t have that method, but I\u0027ll rename it in the stubs.","commit_id":"88e7ae1acfdadc6d39748580e4abf66eb4af4a45"}]}
