)]}'
{"nova/objects/volume_usage.py":[{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"df7888e76daf8b104a046bd3dfa50fd0d1a2995d","unresolved":false,"context_lines":[{"line_number":47,"context_line":"        return vol_usage"},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"    @base.remotable_classmethod"},{"line_number":50,"context_line":"    def update(cls, context, volume_id, rd_req, rd_bytes, wr_req, wr_bytes,"},{"line_number":51,"context_line":"               instance, update_totals\u003dFalse):"},{"line_number":52,"context_line":"        db_vol_usage \u003d db.vol_usage_update("},{"line_number":53,"context_line":"            context, volume_id, rd_req, rd_bytes, wr_req, wr_bytes,"}],"source_content_type":"text/x-python","patch_set":1,"id":"1aca2d91_11bb2d74","line":50,"updated":"2015-05-06 14:04:30.000000000","message":"Is there any reason not to use save() or create() here? I know that the old method was called \"update\" but so was \"instance_update\" and we replaced it with save. I think consistency is good, so we should at least think about what we call this before we codify it to make sure it\u0027s what we want.\n\nOn the one hand, save seems more appropriate because of the update linkage. On the other hand, save usually means we\u0027re saving a thing that already exists in the DB, and these are just always creating new usage records, so maybe create() makes more sense.\n\nDo you think either of the above would be better, or is update() the right thing to use here?\n\nI guess this just feels really different from the rest of the objects, where when we create or save a thing, we instantiate the object, set the things we want, and then call create() or something.","commit_id":"2a514f2fa4f8de39af0fe691868d7403a7c851f9"},{"author":{"_account_id":6450,"name":"Hans Lindgren","email":"hanlind@kth.se","username":"hanlind"},"change_message_id":"ae913ecf2d8df58a6be5b878537bb2f5ce746507","unresolved":false,"context_lines":[{"line_number":47,"context_line":"        return vol_usage"},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"    @base.remotable_classmethod"},{"line_number":50,"context_line":"    def update(cls, context, volume_id, rd_req, rd_bytes, wr_req, wr_bytes,"},{"line_number":51,"context_line":"               instance, update_totals\u003dFalse):"},{"line_number":52,"context_line":"        db_vol_usage \u003d db.vol_usage_update("},{"line_number":53,"context_line":"            context, volume_id, rd_req, rd_bytes, wr_req, wr_bytes,"}],"source_content_type":"text/x-python","patch_set":1,"id":"1aca2d91_f734fdde","line":50,"in_reply_to":"1aca2d91_11bb2d74","updated":"2015-05-07 09:38:46.000000000","message":"So, the problem is that a lot of calculations are made in the db api for this call, so what is sent in is not what you get back as result. We could call the method save() as it will mostly update existing records (there is only a single record per volume_id), but it is really a update-or-create-if-not-exists call.\n\nLets play with the thought of making this similar to how we usually do objects:\n\n vol_usage \u003d objects.VolumeUsage(context)\n vol_usage.volume_id \u003d x\n vol_usage.instance_uuid \u003d instance.uuid\n ...\n vol_usage.tot_* (can\u0027t really fill those in)\n vol_usage_curr_* \u003d (some values)\n vol_usage.save(update_totals\u003d[True|False])\n\nNow, what we get back is a a completely different set of values.\n\n vol_usage.tot_* (these ones gets filled in)\n vol_usage_curr_* (these will either stay the same or become 0 depending on the value of update_totals)\n\nThis is kind of different to what we expect out of most objects, but maybe it is better. After writing this, I think it actually is. What do you think?","commit_id":"2a514f2fa4f8de39af0fe691868d7403a7c851f9"},{"author":{"_account_id":6450,"name":"Hans Lindgren","email":"hanlind@kth.se","username":"hanlind"},"change_message_id":"3b870ca7ea845dd7e3d0fa72a643206838c0e7d0","unresolved":false,"context_lines":[{"line_number":47,"context_line":"        return vol_usage"},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"    @base.remotable_classmethod"},{"line_number":50,"context_line":"    def update(cls, context, volume_id, rd_req, rd_bytes, wr_req, wr_bytes,"},{"line_number":51,"context_line":"               instance, update_totals\u003dFalse):"},{"line_number":52,"context_line":"        db_vol_usage \u003d db.vol_usage_update("},{"line_number":53,"context_line":"            context, volume_id, rd_req, rd_bytes, wr_req, wr_bytes,"}],"source_content_type":"text/x-python","patch_set":1,"id":"1aca2d91_77243fae","line":50,"in_reply_to":"1aca2d91_4522baba","updated":"2015-05-08 09:01:41.000000000","message":"I\u0027ll give it a try.","commit_id":"2a514f2fa4f8de39af0fe691868d7403a7c851f9"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"65a19c63104eefec74e8e16a0254e77ac2c10c7d","unresolved":false,"context_lines":[{"line_number":47,"context_line":"        return vol_usage"},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"    @base.remotable_classmethod"},{"line_number":50,"context_line":"    def update(cls, context, volume_id, rd_req, rd_bytes, wr_req, wr_bytes,"},{"line_number":51,"context_line":"               instance, update_totals\u003dFalse):"},{"line_number":52,"context_line":"        db_vol_usage \u003d db.vol_usage_update("},{"line_number":53,"context_line":"            context, volume_id, rd_req, rd_bytes, wr_req, wr_bytes,"}],"source_content_type":"text/x-python","patch_set":1,"id":"1aca2d91_4522baba","line":50,"in_reply_to":"1aca2d91_f734fdde","updated":"2015-05-07 23:39:16.000000000","message":"Okay, i see now.\n\nIt\u0027s not really that different. Most of them don\u0027t work that way, granted, but we do things like make the object with no id, call .create() and then know that the id is filled in at that point. We also do things like doing a .save() and checking that the values are still the same after the save to know if we won a race.\n\nThis is a little different because it\u0027s several values changing like you describe. However, I kinda think that given how most objects work, that\u0027s a little more consistent than the single .update() classmethod.\n\nSo, I guess I\u0027d prefer going with the revised approach you describe here, but I\u0027ll leave it up to you if you decide it\u0027s better to stick with what you\u0027ve got.","commit_id":"2a514f2fa4f8de39af0fe691868d7403a7c851f9"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"df7888e76daf8b104a046bd3dfa50fd0d1a2995d","unresolved":false,"context_lines":[{"line_number":48,"context_line":""},{"line_number":49,"context_line":"    @base.remotable_classmethod"},{"line_number":50,"context_line":"    def update(cls, context, volume_id, rd_req, rd_bytes, wr_req, wr_bytes,"},{"line_number":51,"context_line":"               instance, update_totals\u003dFalse):"},{"line_number":52,"context_line":"        db_vol_usage \u003d db.vol_usage_update("},{"line_number":53,"context_line":"            context, volume_id, rd_req, rd_bytes, wr_req, wr_bytes,"},{"line_number":54,"context_line":"            instance.uuid, instance.project_id, instance.user_id,"}],"source_content_type":"text/x-python","patch_set":1,"id":"1aca2d91_644d0172","line":51,"updated":"2015-05-06 14:04:30.000000000","message":"This furthers my feeling that it\u0027s confusing, when we take all the properties, including a full instance, to a remotable like this. I think people familiar with other objects may find it confusing that they don\u0027t create the object in the normal way.\n\nWhat about a classmethod like:\n\n @classmethod\n def init_from_instance(cls, instance):\n     ...\n\nThat would create an object, initialize the instance-sourced fields, let the caller put in the usage info and then call .save() or .create() on it. \n\nIf you think I\u0027m overcomplicating this, then say so. I just want to strive for a very consistent feel across all of them, when and where appropriate.","commit_id":"2a514f2fa4f8de39af0fe691868d7403a7c851f9"},{"author":{"_account_id":6450,"name":"Hans Lindgren","email":"hanlind@kth.se","username":"hanlind"},"change_message_id":"ae913ecf2d8df58a6be5b878537bb2f5ce746507","unresolved":false,"context_lines":[{"line_number":48,"context_line":""},{"line_number":49,"context_line":"    @base.remotable_classmethod"},{"line_number":50,"context_line":"    def update(cls, context, volume_id, rd_req, rd_bytes, wr_req, wr_bytes,"},{"line_number":51,"context_line":"               instance, update_totals\u003dFalse):"},{"line_number":52,"context_line":"        db_vol_usage \u003d db.vol_usage_update("},{"line_number":53,"context_line":"            context, volume_id, rd_req, rd_bytes, wr_req, wr_bytes,"},{"line_number":54,"context_line":"            instance.uuid, instance.project_id, instance.user_id,"}],"source_content_type":"text/x-python","patch_set":1,"id":"1aca2d91_973149a5","line":51,"in_reply_to":"1aca2d91_644d0172","updated":"2015-05-07 09:38:46.000000000","message":"If we go with the above, then maybe this is not needed.","commit_id":"2a514f2fa4f8de39af0fe691868d7403a7c851f9"},{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"34947ec907b08a24636a5b93db27b998f2967adb","unresolved":false,"context_lines":[{"line_number":23,"context_line":"        \u0027id\u0027: fields.IntegerField(read_only\u003dTrue),"},{"line_number":24,"context_line":"        \u0027volume_id\u0027: fields.UUIDField(),"},{"line_number":25,"context_line":"        \u0027instance_uuid\u0027: fields.UUIDField(nullable\u003dTrue),"},{"line_number":26,"context_line":"        \u0027project_id\u0027: fields.StringField(nullable\u003dTrue),"},{"line_number":27,"context_line":"        \u0027user_id\u0027: fields.StringField(nullable\u003dTrue),"},{"line_number":28,"context_line":"        \u0027availability_zone\u0027: fields.StringField(nullable\u003dTrue),"},{"line_number":29,"context_line":"        \u0027tot_last_refreshed\u0027: fields.DateTimeField(nullable\u003dTrue,"}],"source_content_type":"text/x-python","patch_set":3,"id":"9a0c5dc1_c7412c0d","line":26,"updated":"2015-05-13 15:57:15.000000000","message":"is it a UUID ?","commit_id":"094986812b0033a098064d44fd9518f8a087fd4c"},{"author":{"_account_id":6450,"name":"Hans Lindgren","email":"hanlind@kth.se","username":"hanlind"},"change_message_id":"3dc572580268d2c6ca436f672cff5aba550f4d23","unresolved":false,"context_lines":[{"line_number":23,"context_line":"        \u0027id\u0027: fields.IntegerField(read_only\u003dTrue),"},{"line_number":24,"context_line":"        \u0027volume_id\u0027: fields.UUIDField(),"},{"line_number":25,"context_line":"        \u0027instance_uuid\u0027: fields.UUIDField(nullable\u003dTrue),"},{"line_number":26,"context_line":"        \u0027project_id\u0027: fields.StringField(nullable\u003dTrue),"},{"line_number":27,"context_line":"        \u0027user_id\u0027: fields.StringField(nullable\u003dTrue),"},{"line_number":28,"context_line":"        \u0027availability_zone\u0027: fields.StringField(nullable\u003dTrue),"},{"line_number":29,"context_line":"        \u0027tot_last_refreshed\u0027: fields.DateTimeField(nullable\u003dTrue,"}],"source_content_type":"text/x-python","patch_set":3,"id":"9a0c5dc1_99cf0c7f","line":26,"in_reply_to":"9a0c5dc1_c7412c0d","updated":"2015-05-13 20:03:21.000000000","message":"Using same as instance object since thats where the values will come from.","commit_id":"094986812b0033a098064d44fd9518f8a087fd4c"}],"nova/tests/unit/objects/test_objects.py":[{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"df7888e76daf8b104a046bd3dfa50fd0d1a2995d","unresolved":false,"context_lines":[{"line_number":1296,"context_line":"    \u0027VirtCPUTopology\u0027: \u00271.0-fc694de72e20298f7c6bab1083fd4563\u0027,"},{"line_number":1297,"context_line":"    \u0027VirtualInterface\u0027: \u00271.0-d3d14066c99b8ae4d5204059fb147279\u0027,"},{"line_number":1298,"context_line":"    \u0027VirtualInterfaceList\u0027: \u00271.0-311365526cc6904e43ace844a794cb6b\u0027,"},{"line_number":1299,"context_line":"    \u0027VolumeUsage\u0027: \u00271.0-47f321d11420e3a7f382cb602b73bbdf\u0027"},{"line_number":1300,"context_line":"}"},{"line_number":1301,"context_line":""},{"line_number":1302,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"1aca2d91_3144e972","line":1299,"updated":"2015-05-06 14:04:30.000000000","message":"Can you add a trailing comma here? It should have been on the old line already and helps make this often-changing list cleaner.","commit_id":"2a514f2fa4f8de39af0fe691868d7403a7c851f9"},{"author":{"_account_id":6450,"name":"Hans Lindgren","email":"hanlind@kth.se","username":"hanlind"},"change_message_id":"ae913ecf2d8df58a6be5b878537bb2f5ce746507","unresolved":false,"context_lines":[{"line_number":1296,"context_line":"    \u0027VirtCPUTopology\u0027: \u00271.0-fc694de72e20298f7c6bab1083fd4563\u0027,"},{"line_number":1297,"context_line":"    \u0027VirtualInterface\u0027: \u00271.0-d3d14066c99b8ae4d5204059fb147279\u0027,"},{"line_number":1298,"context_line":"    \u0027VirtualInterfaceList\u0027: \u00271.0-311365526cc6904e43ace844a794cb6b\u0027,"},{"line_number":1299,"context_line":"    \u0027VolumeUsage\u0027: \u00271.0-47f321d11420e3a7f382cb602b73bbdf\u0027"},{"line_number":1300,"context_line":"}"},{"line_number":1301,"context_line":""},{"line_number":1302,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"1aca2d91_e1743ffe","line":1299,"in_reply_to":"1aca2d91_3144e972","updated":"2015-05-07 09:38:46.000000000","message":"consider it done","commit_id":"2a514f2fa4f8de39af0fe691868d7403a7c851f9"}]}
