)]}'
{"nova/db/sqlalchemy/api.py":[{"author":{"_account_id":100,"name":"Johannes Erdfelt","email":"johannes@erdfelt.com","username":"johannes.erdfelt"},"change_message_id":"bda43bb77720321025068413a5ce9a69253047b2","unresolved":false,"context_lines":[{"line_number":2512,"context_line":"                            actual\u003dtask_state, expected\u003dexpected_task_states)"},{"line_number":2513,"context_line":"                else:"},{"line_number":2514,"context_line":"                    raise exception.UnexpectedTaskStateError("},{"line_number":2515,"context_line":"                            actual\u003dtask_state, expected\u003dexpected)"},{"line_number":2516,"context_line":""},{"line_number":2517,"context_line":"        if \u0027vm_state\u0027 in expected:"},{"line_number":2518,"context_line":"            vm_state \u003d instance[\u0027vm_state\u0027]"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a961159_2f7a21ba","line":2515,"updated":"2015-01-06 18:21:07.000000000","message":"Shouldn\u0027t this be \u0027expected\u003dexpected_task_states\u0027?","commit_id":"4368007e6c8c474f89bb66a1eaebbba58361029c"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"31570a8aeaf0bfdf19bc9878d0748cd520932bdb","unresolved":false,"context_lines":[{"line_number":2512,"context_line":"                            actual\u003dtask_state, expected\u003dexpected_task_states)"},{"line_number":2513,"context_line":"                else:"},{"line_number":2514,"context_line":"                    raise exception.UnexpectedTaskStateError("},{"line_number":2515,"context_line":"                            actual\u003dtask_state, expected\u003dexpected)"},{"line_number":2516,"context_line":""},{"line_number":2517,"context_line":"        if \u0027vm_state\u0027 in expected:"},{"line_number":2518,"context_line":"            vm_state \u003d instance[\u0027vm_state\u0027]"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a961159_d9e95680","line":2515,"in_reply_to":"3a961159_2f7a21ba","updated":"2015-01-07 10:22:04.000000000","message":"Done","commit_id":"4368007e6c8c474f89bb66a1eaebbba58361029c"},{"author":{"_account_id":100,"name":"Johannes Erdfelt","email":"johannes@erdfelt.com","username":"johannes.erdfelt"},"change_message_id":"bda43bb77720321025068413a5ce9a69253047b2","unresolved":false,"context_lines":[{"line_number":2533,"context_line":"    return True"},{"line_number":2534,"context_line":""},{"line_number":2535,"context_line":""},{"line_number":2536,"context_line":"@_retry_on_deadlock"},{"line_number":2537,"context_line":"def _instance_update(context, session, instance_uuid, values,"},{"line_number":2538,"context_line":"                     columns_to_join\u003dNone):"},{"line_number":2539,"context_line":"    if not uuidutils.is_uuid_like(instance_uuid):"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a961159_4f312d0a","line":2536,"updated":"2015-01-06 18:21:07.000000000","message":"Can this code still deadlock after this patch?","commit_id":"4368007e6c8c474f89bb66a1eaebbba58361029c"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"31570a8aeaf0bfdf19bc9878d0748cd520932bdb","unresolved":false,"context_lines":[{"line_number":2533,"context_line":"    return True"},{"line_number":2534,"context_line":""},{"line_number":2535,"context_line":""},{"line_number":2536,"context_line":"@_retry_on_deadlock"},{"line_number":2537,"context_line":"def _instance_update(context, session, instance_uuid, values,"},{"line_number":2538,"context_line":"                     columns_to_join\u003dNone):"},{"line_number":2539,"context_line":"    if not uuidutils.is_uuid_like(instance_uuid):"}],"source_content_type":"text/x-python","patch_set":6,"id":"3a961159_1c866cb9","line":2536,"in_reply_to":"3a961159_4f312d0a","updated":"2015-01-07 10:22:04.000000000","message":"AFAICT this patch doesn\u0027t fundamentally change the potential deadlock behaviour of this function. The previous function took 3 lock(ish)s:\n\n1. Various metadata rows\n\n2. Various system_metadata rows\n\n3. The instance row\n\nThis one does:\n\n1. The instance row\n\n2. Various metadata rows\n\n3. Various system_metadata rows\n\nSo only the lock order has changed. This can obviously affect deadlock, but with no defined locking semantics on anything, anywhere, and no indication of why _retry_on_deadlock was originally put there, I can\u0027t reasonably remove it without a thorough analysis of the entire Nova codebase.\n\nKilling these is something I\u0027d like to do, but not in this patch.","commit_id":"4368007e6c8c474f89bb66a1eaebbba58361029c"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"72e3fa46176668cd014bb4b155223d67600286d0","unresolved":false,"context_lines":[{"line_number":292,"context_line":""},{"line_number":293,"context_line":"    :param value: The value to be converted."},{"line_number":294,"context_line":"    \"\"\""},{"line_number":295,"context_line":"    if hasattr(value, \u0027__iter__\u0027):"},{"line_number":296,"context_line":"        return list(value)"},{"line_number":297,"context_line":"    return [value]"},{"line_number":298,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"3a961159_dd885724","line":295,"updated":"2015-01-15 23:14:01.000000000","message":"strings have `__iter__`, so this won\u0027t work.   The approach I have in https://review.openstack.org/gitweb?p\u003dopenstack/oslo.db.git;a\u003dblob;f\u003doslo_db/sqlalchemy/utils.py;h\u003dea1f9df5dc980175b68b79bfb38588667ac405e2;hb\u003d87d2cf2ee4d6239af4f4b15ba2e7b8af57f2c036#l189 is more like what\u0027s needed.","commit_id":"55c75a07e6df66b037d92c924c61a7ad1a4da645"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"b3e492f3cd41975f86308836b1c78681bb39cc73","unresolved":false,"context_lines":[{"line_number":2525,"context_line":"    _handle_objects_related_type_conversions(values)"},{"line_number":2526,"context_line":""},{"line_number":2527,"context_line":"    session \u003d get_session()"},{"line_number":2528,"context_line":"    with session.begin():"},{"line_number":2529,"context_line":"        # Base query references a single instance with no joins"},{"line_number":2530,"context_line":"        base_query \u003d model_query(context, models.Instance,"},{"line_number":2531,"context_line":"                                 project_only\u003dTrue, session\u003dsession).\\"}],"source_content_type":"text/x-python","patch_set":7,"id":"da86d52c_a67096dd","line":2528,"updated":"2015-02-13 17:00:58.000000000","message":"This is nested transaction when called from instance_update_and_get_original(), which causes a failure on MySQL. This failure wasn\u0027t caught running unit tests on sqlite, or running Tempest tests.","commit_id":"55c75a07e6df66b037d92c924c61a7ad1a4da645"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"17a416a2d869bfb9b785e4ce9707b64e154e33cb","unresolved":false,"context_lines":[{"line_number":2544,"context_line":"        # constraint violation during the update."},{"line_number":2545,"context_line":"        if \u0027hostname\u0027 in values:"},{"line_number":2546,"context_line":"            hostname_query \u003d _validate_unique_server_name_query("},{"line_number":2547,"context_line":"                context, session, values[\u0027hostname\u0027])"},{"line_number":2548,"context_line":"        else:"},{"line_number":2549,"context_line":"            hostname_query \u003d None"},{"line_number":2550,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"da86d52c_807b9679","line":2547,"updated":"2015-02-06 13:27:02.000000000","message":"This has passed a full battery of tempest tests at least once, but I\u0027m fairly sure this won\u0027t work on MySQL due to error 1093. See http://dev.mysql.com/doc/refman/5.0/en/subquery-errors.html\n\nHow can we get db test coverage across different backends?\n\nI don\u0027t see how it\u0027s possible to do this on MySQL without locking the instance table, which doesn\u0027t sound like a great idea. Alternatively, we could convert it into an actual unique constraint.","commit_id":"55c75a07e6df66b037d92c924c61a7ad1a4da645"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"9797931750fa471c562430f012324e0357a6e80e","unresolved":false,"context_lines":[{"line_number":2544,"context_line":"        # constraint violation during the update."},{"line_number":2545,"context_line":"        if \u0027hostname\u0027 in values:"},{"line_number":2546,"context_line":"            hostname_query \u003d _validate_unique_server_name_query("},{"line_number":2547,"context_line":"                context, session, values[\u0027hostname\u0027])"},{"line_number":2548,"context_line":"        else:"},{"line_number":2549,"context_line":"            hostname_query \u003d None"},{"line_number":2550,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"da86d52c_2ab9e4cb","line":2547,"in_reply_to":"da86d52c_0ab3404d","updated":"2015-02-06 14:45:06.000000000","message":"SQLite and Postgres both require the subquery.","commit_id":"55c75a07e6df66b037d92c924c61a7ad1a4da645"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"3ef08e1e2ef5ac430114296f4454349af1769d0c","unresolved":false,"context_lines":[{"line_number":2544,"context_line":"        # constraint violation during the update."},{"line_number":2545,"context_line":"        if \u0027hostname\u0027 in values:"},{"line_number":2546,"context_line":"            hostname_query \u003d _validate_unique_server_name_query("},{"line_number":2547,"context_line":"                context, session, values[\u0027hostname\u0027])"},{"line_number":2548,"context_line":"        else:"},{"line_number":2549,"context_line":"            hostname_query \u003d None"},{"line_number":2550,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"da86d52c_f916c847","line":2547,"in_reply_to":"da86d52c_0ab3404d","updated":"2015-02-06 16:09:45.000000000","message":"im surprised mysql even has \"dual\", it\u0027s valid SQL to say \"select 1\", but beyond that UPDATE .. JOIN isn\u0027t standard SQL and also I\u0027ve no idea what you\u0027re trying to achieve here.   As close as I can tell you\u0027re trying to UPDATE name where name is not already that value ?       There\u0027s definitely no reason an UPDATE has to look like that.","commit_id":"55c75a07e6df66b037d92c924c61a7ad1a4da645"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"04a079756ef5629e5915088669c437e751bdd58c","unresolved":false,"context_lines":[{"line_number":2544,"context_line":"        # constraint violation during the update."},{"line_number":2545,"context_line":"        if \u0027hostname\u0027 in values:"},{"line_number":2546,"context_line":"            hostname_query \u003d _validate_unique_server_name_query("},{"line_number":2547,"context_line":"                context, session, values[\u0027hostname\u0027])"},{"line_number":2548,"context_line":"        else:"},{"line_number":2549,"context_line":"            hostname_query \u003d None"},{"line_number":2550,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"da86d52c_6de776ac","line":2547,"in_reply_to":"da86d52c_2ab9e4cb","updated":"2015-02-06 14:59:00.000000000","message":"SQLAlchemy might actually be able to magic this for all 3:\n\nhttp://docs.sqlalchemy.org/en/rel_0_9/core/dml.html\n\nWould probably be clearer if it was constructed as a Table.update() with explicit where clauses.","commit_id":"55c75a07e6df66b037d92c924c61a7ad1a4da645"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"64487aff0b37736e9165cb62bb084f6f8bcbdae1","unresolved":false,"context_lines":[{"line_number":2544,"context_line":"        # constraint violation during the update."},{"line_number":2545,"context_line":"        if \u0027hostname\u0027 in values:"},{"line_number":2546,"context_line":"            hostname_query \u003d _validate_unique_server_name_query("},{"line_number":2547,"context_line":"                context, session, values[\u0027hostname\u0027])"},{"line_number":2548,"context_line":"        else:"},{"line_number":2549,"context_line":"            hostname_query \u003d None"},{"line_number":2550,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"da86d52c_0ab3404d","line":2547,"in_reply_to":"da86d52c_807b9679","updated":"2015-02-06 14:29:22.000000000","message":"Works on MySQL:\n\n  update\n  t1 join\n  (\n    select 1 from dual\n    where not exists (\n      select 1 from t1\n      where name \u003d \u0027asdfasdf\u0027  \n    )\n  ) as unq\n  set t1.name\u003d\u0027asdfasdf\u0027\n  where id\u003d1;\n\nHow about postgres and sqlite (no dual table)? MySQL requires dual table here for syntax. Will sqlalchemy play nice?","commit_id":"55c75a07e6df66b037d92c924c61a7ad1a4da645"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"b21067b51e5158a274fa3d3f1c0cb0f533810965","unresolved":false,"context_lines":[{"line_number":2544,"context_line":"        # constraint violation during the update."},{"line_number":2545,"context_line":"        if \u0027hostname\u0027 in values:"},{"line_number":2546,"context_line":"            hostname_query \u003d _validate_unique_server_name_query("},{"line_number":2547,"context_line":"                context, session, values[\u0027hostname\u0027])"},{"line_number":2548,"context_line":"        else:"},{"line_number":2549,"context_line":"            hostname_query \u003d None"},{"line_number":2550,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"da86d52c_3114b8e8","line":2547,"in_reply_to":"da86d52c_8481b74f","updated":"2015-02-16 09:24:09.000000000","message":"...and there it is. Managed to get the unit tests to run on MySQL, and it fails with error 1093:\n\nFAIL: nova.tests.unit.db.test_db_api.InstanceTestCase.test_instance_update_unique_name\n\n...\n\nOperationalError: (OperationalError) (1093, \"Table \u0027instances\u0027 is specified twice, both as a target for \u0027UPDATE\u0027 and as a separate source for data\") \u0027UPDATE instances SET updated_at\u003d%s, hostname\u003d%s WHERE instances.deleted \u003d %s AND instances.project_id \u003d %s AND instances.uuid \u003d %s AND NOT (EXISTS (SELECT 1 \\nFROM instances \\nWHERE instances.deleted \u003d %s AND lower(instances.hostname) \u003d %s))\u0027 (datetime.datetime(2015, 2, 16, 9, 19, 44, 844495), \u0027fake_name1\u0027, 0, \u0027p1\u0027, \u0027ddee46f2-2db2-47c7-b050-a56de67e130c\u0027, 0, \u0027fake_name1\u0027)","commit_id":"55c75a07e6df66b037d92c924c61a7ad1a4da645"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"e56cb6e9d304f91614e758e607b585de90c38eaa","unresolved":false,"context_lines":[{"line_number":2544,"context_line":"        # constraint violation during the update."},{"line_number":2545,"context_line":"        if \u0027hostname\u0027 in values:"},{"line_number":2546,"context_line":"            hostname_query \u003d _validate_unique_server_name_query("},{"line_number":2547,"context_line":"                context, session, values[\u0027hostname\u0027])"},{"line_number":2548,"context_line":"        else:"},{"line_number":2549,"context_line":"            hostname_query \u003d None"},{"line_number":2550,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"da86d52c_8481b74f","line":2547,"in_reply_to":"da86d52c_f916c847","updated":"2015-02-09 09:25:44.000000000","message":"The query is in lieu of a unique constraint on that field. It\u0027s inserting only if the value is not present in the table. Yeah, that\u0027s pretty awful. However, that\u0027s what it\u0027s doing.\n\nIncidentally, afaict the reason for this is that the scope of the uniqueness constraint is controlled by a config variable. What would be the feasibility of configuring a unique constraint dynamically based on a config variable? If the table had proper constraints this would be much simpler.\n\nRead MySQL error 1093, which I hit when trying to do something similiar which made me think of this. I\u0027m pretty sure some funky syntax is required to work round it.\n\nThe dual thing is odd. MySQL seems to require it in this subquery, but not in other contexts.\n\nIncidentally, I feel that the code above (in the patch, not the comment) is pretty readable. I just don\u0027t think it works on MySQL unless SQLAlchemy is automatically rewriting the query to something like what\u0027s in the comment. Given your response, I suspect that it isn\u0027t :)","commit_id":"55c75a07e6df66b037d92c924c61a7ad1a4da645"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"17a416a2d869bfb9b785e4ce9707b64e154e33cb","unresolved":false,"context_lines":[{"line_number":2551,"context_line":"        if hostname_query is not None:"},{"line_number":2552,"context_line":"            update_query \u003d update_query.filter(~hostname_query.exists())"},{"line_number":2553,"context_line":""},{"line_number":2554,"context_line":"        for i in range(0, 3):"},{"line_number":2555,"context_line":"            if _instance_update_try(update_query, base_query, hostname_query,"},{"line_number":2556,"context_line":"                                    instance_uuid, expected, values):"},{"line_number":2557,"context_line":"                break"}],"source_content_type":"text/x-python","patch_set":7,"id":"da86d52c_40d35e5f","line":2554,"updated":"2015-02-06 13:27:02.000000000","message":"This loop is redundant on MySQL as it uses repeatable reads by default, and we don\u0027t change it. I\u0027ll remove it.","commit_id":"55c75a07e6df66b037d92c924c61a7ad1a4da645"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"1ff6c85f11511b0bc144d64d8f57b4772e362018","unresolved":false,"context_lines":[{"line_number":2555,"context_line":""},{"line_number":2556,"context_line":"        # It\u0027s possible, but incredibly unlikely, that a second race above"},{"line_number":2557,"context_line":"        # could allow us to get here."},{"line_number":2558,"context_line":"        raise exception.InstanceUpdateFailed(instance_id\u003dinstance_uuid)"},{"line_number":2559,"context_line":""},{"line_number":2560,"context_line":"    if metadata is not None:"},{"line_number":2561,"context_line":"        _instance_metadata_update_in_place(context, instance_ref,"}],"source_content_type":"text/x-python","patch_set":9,"id":"7ad32947_17bb0f74","line":2558,"updated":"2015-04-28 13:02:30.000000000","message":"do we have a test case for this flow?","commit_id":"e9598010c224cb7ca318f7c0954c7e8edf739efd"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"fa61634923f4cffb9a08fe6c7d5f0313925c2675","unresolved":false,"context_lines":[{"line_number":2555,"context_line":""},{"line_number":2556,"context_line":"        # It\u0027s possible, but incredibly unlikely, that a second race above"},{"line_number":2557,"context_line":"        # could allow us to get here."},{"line_number":2558,"context_line":"        raise exception.InstanceUpdateFailed(instance_id\u003dinstance_uuid)"},{"line_number":2559,"context_line":""},{"line_number":2560,"context_line":"    if metadata is not None:"},{"line_number":2561,"context_line":"        _instance_metadata_update_in_place(context, instance_ref,"}],"source_content_type":"text/x-python","patch_set":9,"id":"5afe65bd_e34e8ac0","line":2558,"in_reply_to":"7ad32947_17bb0f74","updated":"2015-06-02 13:10:32.000000000","message":"Done","commit_id":"e9598010c224cb7ca318f7c0954c7e8edf739efd"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"4aa4ca510d234e8b8a04207875d4358f9c27df03","unresolved":false,"context_lines":[{"line_number":2446,"context_line":"    when the task state before update matches expected_task_state. Otherwise"},{"line_number":2447,"context_line":"    a UnexpectedTaskStateError is thrown."},{"line_number":2448,"context_line":""},{"line_number":2449,"context_line":"    :returns: a tuple of the form (old_instance_ref, new_instance_ref)"},{"line_number":2450,"context_line":""},{"line_number":2451,"context_line":"    Raises NotFound if instance does not exist."},{"line_number":2452,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":11,"id":"3afb71cf_eb79c930","line":2449,"updated":"2015-06-05 14:28:55.000000000","message":"is new_instance_ref bound to the session?  at the moment this doesn\u0027t matter because \"get_session()\" is local here. But w/ enginefacade.  is it the intent that the new ref is persistent (e.g. associated w/ the session?)   we\u0027ll need to document this here (but the docs will only be \"correct\" once there is a global session context).","commit_id":"1134916cc5177bd710a0883ff3820caec379d96c"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"f8682a1f7348be9541500e08d5f553b108c9f4ac","unresolved":false,"context_lines":[{"line_number":2446,"context_line":"    when the task state before update matches expected_task_state. Otherwise"},{"line_number":2447,"context_line":"    a UnexpectedTaskStateError is thrown."},{"line_number":2448,"context_line":""},{"line_number":2449,"context_line":"    :returns: a tuple of the form (old_instance_ref, new_instance_ref)"},{"line_number":2450,"context_line":""},{"line_number":2451,"context_line":"    Raises NotFound if instance does not exist."},{"line_number":2452,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":11,"id":"3afb71cf_de61fba9","line":2449,"in_reply_to":"3afb71cf_eb79c930","updated":"2015-06-08 09:16:05.000000000","message":"The intention is that new_instance_ref is associated with the session, and old_instance_ref is not. We should document this if we can\u0027t kill this weird api. It\u0027s not important here, though, as it\u0027s not a change in behaviour.","commit_id":"1134916cc5177bd710a0883ff3820caec379d96c"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"4aa4ca510d234e8b8a04207875d4358f9c27df03","unresolved":false,"context_lines":[{"line_number":2455,"context_line":"        instance_ref \u003d _instance_get_by_uuid(context, instance_uuid,"},{"line_number":2456,"context_line":"                                             columns_to_join\u003dcolumns_to_join,"},{"line_number":2457,"context_line":"                                             session\u003dsession)"},{"line_number":2458,"context_line":"        return (copy.copy(instance_ref),"},{"line_number":2459,"context_line":"                _instance_update(context, session, instance_uuid, values,"},{"line_number":2460,"context_line":"                                 instance_ref))"},{"line_number":2461,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"3afb71cf_abc5115c","line":2458,"updated":"2015-06-05 14:28:55.000000000","message":"this is \"safe\" because I implemented a magic `__copy__` on NovaBase.  This is a different issue but I *may* prefer if we had some explicit call for that, instead of the user thinking copy.copy() is normally a safe thing to do.  Or maybe this is the best way.   All I know is everytime I see copy.copy() around an ORM object I\u0027m always going to wince, whether or not it\u0027s been made to work.","commit_id":"1134916cc5177bd710a0883ff3820caec379d96c"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"f8682a1f7348be9541500e08d5f553b108c9f4ac","unresolved":false,"context_lines":[{"line_number":2455,"context_line":"        instance_ref \u003d _instance_get_by_uuid(context, instance_uuid,"},{"line_number":2456,"context_line":"                                             columns_to_join\u003dcolumns_to_join,"},{"line_number":2457,"context_line":"                                             session\u003dsession)"},{"line_number":2458,"context_line":"        return (copy.copy(instance_ref),"},{"line_number":2459,"context_line":"                _instance_update(context, session, instance_uuid, values,"},{"line_number":2460,"context_line":"                                 instance_ref))"},{"line_number":2461,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"3afb71cf_3e6daf98","line":2458,"in_reply_to":"3afb71cf_abc5115c","updated":"2015-06-08 09:16:05.000000000","message":"I remember :) Used knowingly. See above, I\u0027d prefer to kill the call entirely. Another day, though.","commit_id":"1134916cc5177bd710a0883ff3820caec379d96c"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"4aa4ca510d234e8b8a04207875d4358f9c27df03","unresolved":false,"context_lines":[{"line_number":2486,"context_line":""},{"line_number":2487,"context_line":""},{"line_number":2488,"context_line":"def _instance_update(context, session, instance_uuid, values,"},{"line_number":2489,"context_line":"                     instance_ref\u003dNone):"},{"line_number":2490,"context_line":"    if not uuidutils.is_uuid_like(instance_uuid):"},{"line_number":2491,"context_line":"        raise exception.InvalidUUID(instance_uuid)"},{"line_number":2492,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"3afb71cf_abe4f13a","line":2489,"updated":"2015-06-05 14:28:55.000000000","message":"we pass the instance_ref here....","commit_id":"1134916cc5177bd710a0883ff3820caec379d96c"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"4aa4ca510d234e8b8a04207875d4358f9c27df03","unresolved":false,"context_lines":[{"line_number":2514,"context_line":"        _validate_unique_server_name(context, session, values[\u0027hostname\u0027])"},{"line_number":2515,"context_line":""},{"line_number":2516,"context_line":"    try:"},{"line_number":2517,"context_line":"        instance_ref \u003d model_query(context, models.Instance,"},{"line_number":2518,"context_line":"                                   project_only\u003dTrue, session\u003dsession).\\"},{"line_number":2519,"context_line":"                       update_on_match(compare, \u0027uuid\u0027, values)"},{"line_number":2520,"context_line":"    except update_match.NoRowsMatched:"}],"source_content_type":"text/x-python","patch_set":11,"id":"3afb71cf_0b4c2541","line":2517,"updated":"2015-06-05 14:28:55.000000000","message":"and then we try to immediately replace it...","commit_id":"1134916cc5177bd710a0883ff3820caec379d96c"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"4aa4ca510d234e8b8a04207875d4358f9c27df03","unresolved":false,"context_lines":[{"line_number":2549,"context_line":"        # where additionally the intervening update creates the expected"},{"line_number":2550,"context_line":"        # conditions which previously failed. Again, we handle this safely by"},{"line_number":2551,"context_line":"        # falling through below."},{"line_number":2552,"context_line":"        if instance_ref is None:"},{"line_number":2553,"context_line":"            instance_ref \u003d _instance_get_by_uuid(context, instance_uuid,"},{"line_number":2554,"context_line":"                                                 session\u003dsession)"},{"line_number":2555,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"3afb71cf_2b5da1e9","line":2552,"updated":"2015-06-05 14:28:55.000000000","message":"I guess we are looking at that original instance_ref here....maybe name this \"original_instance_ref\" and do an assignment here?   would make this easier to understand","commit_id":"1134916cc5177bd710a0883ff3820caec379d96c"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"f8682a1f7348be9541500e08d5f553b108c9f4ac","unresolved":false,"context_lines":[{"line_number":2549,"context_line":"        # where additionally the intervening update creates the expected"},{"line_number":2550,"context_line":"        # conditions which previously failed. Again, we handle this safely by"},{"line_number":2551,"context_line":"        # falling through below."},{"line_number":2552,"context_line":"        if instance_ref is None:"},{"line_number":2553,"context_line":"            instance_ref \u003d _instance_get_by_uuid(context, instance_uuid,"},{"line_number":2554,"context_line":"                                                 session\u003dsession)"},{"line_number":2555,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"3afb71cf_1eed53ef","line":2552,"in_reply_to":"3afb71cf_2b5da1e9","updated":"2015-06-08 09:16:05.000000000","message":"Agreed, and this wasn\u0027t intentional. It works because the only way we get here is if the assignment didn\u0027t happen due to an exception, but it\u0027s fragile and hard to follow. Will update.","commit_id":"1134916cc5177bd710a0883ff3820caec379d96c"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"44852ccf63fd5c9ce998c209f51d2c03f18c2eb3","unresolved":false,"context_lines":[{"line_number":2523,"context_line":"        # when update_on_match executed. Having failed, we now have a hint that"},{"line_number":2524,"context_line":"        # the values are out of date and should check them."},{"line_number":2525,"context_line":""},{"line_number":2526,"context_line":"        # If were were called from instance_update_and_get_original, in by far"},{"line_number":2527,"context_line":"        # the most probable race scenario the original object we fetched was"},{"line_number":2528,"context_line":"        # already out of date. This means we can check it here to work out why"},{"line_number":2529,"context_line":"        # and raise the most specific exception possible. However, note that"}],"source_content_type":"text/x-python","patch_set":12,"id":"ba3cc151_472b4482","line":2526,"updated":"2015-07-09 13:28:55.000000000","message":"s/were were/we were/","commit_id":"420c14ef03300e292c8a0038d83262de41659e77"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"7647c9219914dd9ebfea179b2928f017e46bbe60","unresolved":false,"context_lines":[{"line_number":2523,"context_line":"        # when update_on_match executed. Having failed, we now have a hint that"},{"line_number":2524,"context_line":"        # the values are out of date and should check them."},{"line_number":2525,"context_line":""},{"line_number":2526,"context_line":"        # If were were called from instance_update_and_get_original, in by far"},{"line_number":2527,"context_line":"        # the most probable race scenario the original object we fetched was"},{"line_number":2528,"context_line":"        # already out of date. This means we can check it here to work out why"},{"line_number":2529,"context_line":"        # and raise the most specific exception possible. However, note that"}],"source_content_type":"text/x-python","patch_set":12,"id":"ba3cc151_cac19b81","line":2526,"in_reply_to":"ba3cc151_472b4482","updated":"2015-07-09 13:40:33.000000000","message":"Done","commit_id":"420c14ef03300e292c8a0038d83262de41659e77"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"44852ccf63fd5c9ce998c209f51d2c03f18c2eb3","unresolved":false,"context_lines":[{"line_number":2530,"context_line":"        # there is also a much less likely race between _instance_get_by_uuid"},{"line_number":2531,"context_line":"        # called by instance_update_and_get_original and update_on_match called"},{"line_number":2532,"context_line":"        # by this function. In this case, though, the original call to"},{"line_number":2533,"context_line":"        # _instance_get_by_uuid will have create a MySQL read view, which means"},{"line_number":2534,"context_line":"        # that fetching it again here will continue to return old data despite"},{"line_number":2535,"context_line":"        # update_on_match having failed due to new data we can\u0027t see."},{"line_number":2536,"context_line":"        # Consequently, fetching it again here in the same db session is"}],"source_content_type":"text/x-python","patch_set":12,"id":"ba3cc151_47526414","line":2533,"updated":"2015-07-09 13:28:55.000000000","message":"s/have create a/have created a/","commit_id":"420c14ef03300e292c8a0038d83262de41659e77"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"7647c9219914dd9ebfea179b2928f017e46bbe60","unresolved":false,"context_lines":[{"line_number":2530,"context_line":"        # there is also a much less likely race between _instance_get_by_uuid"},{"line_number":2531,"context_line":"        # called by instance_update_and_get_original and update_on_match called"},{"line_number":2532,"context_line":"        # by this function. In this case, though, the original call to"},{"line_number":2533,"context_line":"        # _instance_get_by_uuid will have create a MySQL read view, which means"},{"line_number":2534,"context_line":"        # that fetching it again here will continue to return old data despite"},{"line_number":2535,"context_line":"        # update_on_match having failed due to new data we can\u0027t see."},{"line_number":2536,"context_line":"        # Consequently, fetching it again here in the same db session is"}],"source_content_type":"text/x-python","patch_set":12,"id":"ba3cc151_8ab71320","line":2533,"in_reply_to":"ba3cc151_47526414","updated":"2015-07-09 13:40:33.000000000","message":"Done","commit_id":"420c14ef03300e292c8a0038d83262de41659e77"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"44852ccf63fd5c9ce998c209f51d2c03f18c2eb3","unresolved":false,"context_lines":[{"line_number":2569,"context_line":"        if \u0027vm_state\u0027 in expected:"},{"line_number":2570,"context_line":"            vm_state \u003d original[\u0027vm_state\u0027]"},{"line_number":2571,"context_line":"            expected_vm_states \u003d sqlalchemyutils.to_list("},{"line_number":2572,"context_line":"                    expected[\u0027vm_state\u0027])"},{"line_number":2573,"context_line":"            if vm_state not in expected_vm_states:"},{"line_number":2574,"context_line":"                raise exception.UnexpectedVMStateError("},{"line_number":2575,"context_line":"                    actual\u003dvm_state, expected\u003dexpected_vm_states)"}],"source_content_type":"text/x-python","patch_set":12,"id":"ba3cc151_87986c76","line":2572,"updated":"2015-07-09 13:28:55.000000000","message":"Why is this necessary, since you define expected[\u0027vm_state\u0027] above as:\n\n expected[\u0027vm_state\u0027] \u003d values.pop(\u0027expected_vm_state\u0027)\n\nWhy not just:\n\n expected_vm_states \u003d expected[\u0027vm_state\u0027] or list()\n\nSame for the task state above...","commit_id":"420c14ef03300e292c8a0038d83262de41659e77"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"7647c9219914dd9ebfea179b2928f017e46bbe60","unresolved":false,"context_lines":[{"line_number":2569,"context_line":"        if \u0027vm_state\u0027 in expected:"},{"line_number":2570,"context_line":"            vm_state \u003d original[\u0027vm_state\u0027]"},{"line_number":2571,"context_line":"            expected_vm_states \u003d sqlalchemyutils.to_list("},{"line_number":2572,"context_line":"                    expected[\u0027vm_state\u0027])"},{"line_number":2573,"context_line":"            if vm_state not in expected_vm_states:"},{"line_number":2574,"context_line":"                raise exception.UnexpectedVMStateError("},{"line_number":2575,"context_line":"                    actual\u003dvm_state, expected\u003dexpected_vm_states)"}],"source_content_type":"text/x-python","patch_set":12,"id":"ba3cc151_8a163347","line":2572,"in_reply_to":"ba3cc151_87986c76","updated":"2015-07-09 13:40:33.000000000","message":"It\u0027s because expected_vm_state in values above may be either a single value or a list. It\u0027s not pretty, but it\u0027s the existing calling convention. For consistency we coerce it to always be a list so we can use \u0027in\u0027 below.","commit_id":"420c14ef03300e292c8a0038d83262de41659e77"}],"nova/exception.py":[{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"1ff6c85f11511b0bc144d64d8f57b4772e362018","unresolved":false,"context_lines":[{"line_number":1513,"context_line":""},{"line_number":1514,"context_line":""},{"line_number":1515,"context_line":"class InstanceUpdateFailed(NovaException):"},{"line_number":1516,"context_line":"    msg_fmt \u003d _(\u0027Failed to update instance %(instance_id)s\u0027)"},{"line_number":1517,"context_line":""},{"line_number":1518,"context_line":""},{"line_number":1519,"context_line":"class UnsupportedObjectError(NovaException):"}],"source_content_type":"text/x-python","patch_set":9,"id":"7ad32947_17d66fc5","line":1516,"updated":"2015-04-28 13:02:30.000000000","message":"Can you please change instance_id to instance_uuid\nWhen I first read this I was wondering why we are passing the instance_id to the exception message","commit_id":"e9598010c224cb7ca318f7c0954c7e8edf739efd"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"fa61634923f4cffb9a08fe6c7d5f0313925c2675","unresolved":false,"context_lines":[{"line_number":1513,"context_line":""},{"line_number":1514,"context_line":""},{"line_number":1515,"context_line":"class InstanceUpdateFailed(NovaException):"},{"line_number":1516,"context_line":"    msg_fmt \u003d _(\u0027Failed to update instance %(instance_id)s\u0027)"},{"line_number":1517,"context_line":""},{"line_number":1518,"context_line":""},{"line_number":1519,"context_line":"class UnsupportedObjectError(NovaException):"}],"source_content_type":"text/x-python","patch_set":9,"id":"5afe65bd_43d67ec6","line":1516,"in_reply_to":"7ad32947_17d66fc5","updated":"2015-06-02 13:10:32.000000000","message":"Done","commit_id":"e9598010c224cb7ca318f7c0954c7e8edf739efd"}]}
