)]}'
{"nova/tests/virt/vmwareapi/test_vmops.py":[{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"6fc1d6ab67ed4f9ccf616bb080a12bb3a703f83d","unresolved":false,"context_lines":[{"line_number":228,"context_line":"            self.assertTrue(get_dc.called)"},{"line_number":229,"context_line":"            self.assertTrue(call_method.called)"},{"line_number":230,"context_line":"            wait.assert_called_with(fake_return)"},{"line_number":231,"context_line":"            self.assertEqual(vm_util.vm_ref_cache_get("},{"line_number":232,"context_line":"                             \"fake-uuid-133243523-orig\"),"},{"line_number":233,"context_line":"                             \"vm_ref_orig\")"},{"line_number":234,"context_line":"            self.assertEqual(vm_util.vm_ref_cache_get("}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAWH%2F%2Ffwg%3D","line":231,"updated":"2014-03-17 15:01:59.000000000","message":"in general the expected value should be first","commit_id":"4b7eb578e5e27dc58e2a82e4c717f2db8101201f"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"6fc1d6ab67ed4f9ccf616bb080a12bb3a703f83d","unresolved":false,"context_lines":[{"line_number":231,"context_line":"            self.assertEqual(vm_util.vm_ref_cache_get("},{"line_number":232,"context_line":"                             \"fake-uuid-133243523-orig\"),"},{"line_number":233,"context_line":"                             \"vm_ref_orig\")"},{"line_number":234,"context_line":"            self.assertEqual(vm_util.vm_ref_cache_get("},{"line_number":235,"context_line":"                             \"fake-uuid-133243523\"),"},{"line_number":236,"context_line":"                             \"vm_ref_new\")"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAWH%2F%2FfwQ%3D","line":234,"updated":"2014-03-17 15:01:59.000000000","message":"ditto","commit_id":"4b7eb578e5e27dc58e2a82e4c717f2db8101201f"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"20fd38943d00ab73b010c373cc8fdd33f2008741","unresolved":false,"context_lines":[{"line_number":205,"context_line":"            self.assertEqual(\"fake_snapshot_ref\", snap)"},{"line_number":206,"context_line":"            _wait_for_task.assert_has_calls(["},{"line_number":207,"context_line":"                   mock.call(\u0027fake_snapshot_task\u0027)])"},{"line_number":208,"context_line":""},{"line_number":209,"context_line":"    def test_confirm_migration(self):"},{"line_number":210,"context_line":"        ops \u003d vmops.VMwareVMOps(mock.Mock(), mock.Mock(), mock.Mock())"},{"line_number":211,"context_line":"        with contextlib.nested("}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAWH%2F%2FX2E%3D","line":208,"updated":"2014-03-18 09:56:55.000000000","message":"I think it\u0027s worth adding a test for the failure case.","commit_id":"3ed7c4c88ddda4447c098dfa474cbfc4bc7abf31"},{"author":{"_account_id":7629,"name":"Shawn Hartsock","email":"hartsock@acm.org","username":"hartsocks"},"change_message_id":"28471b04cf96539d5f7f89928b43678c208eeabd","unresolved":false,"context_lines":[{"line_number":205,"context_line":"            self.assertEqual(\"fake_snapshot_ref\", snap)"},{"line_number":206,"context_line":"            _wait_for_task.assert_has_calls(["},{"line_number":207,"context_line":"                   mock.call(\u0027fake_snapshot_task\u0027)])"},{"line_number":208,"context_line":""},{"line_number":209,"context_line":"    def test_confirm_migration(self):"},{"line_number":210,"context_line":"        ops \u003d vmops.VMwareVMOps(mock.Mock(), mock.Mock(), mock.Mock())"},{"line_number":211,"context_line":"        with contextlib.nested("}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAWH%2F%2FC8s%3D","line":208,"in_reply_to":"AAAAWH%2F%2FX2E%3D","updated":"2014-03-21 04:16:54.000000000","message":"agreement here","commit_id":"3ed7c4c88ddda4447c098dfa474cbfc4bc7abf31"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"20fd38943d00ab73b010c373cc8fdd33f2008741","unresolved":false,"context_lines":[{"line_number":258,"context_line":"                def __init__(self, client):"},{"line_number":259,"context_line":"                    self.client \u003d client"},{"line_number":260,"context_line":""},{"line_number":261,"context_line":"            fake_vim \u003d FakeVim(FakeClient(\"fatctory1\"))"},{"line_number":262,"context_line":""},{"line_number":263,"context_line":"            get_vm_ref.return_value \u003d \"vm_ref_orig\""},{"line_number":264,"context_line":"            wait.return_value \u003d FakeResult(\"vm_ref_new\")"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAWH%2F%2FX4M%3D","line":261,"updated":"2014-03-18 09:56:55.000000000","message":"Nit: factory1","commit_id":"3ed7c4c88ddda4447c098dfa474cbfc4bc7abf31"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"20fd38943d00ab73b010c373cc8fdd33f2008741","unresolved":false,"context_lines":[{"line_number":283,"context_line":"            self.assertTrue(clone_spec.called)"},{"line_number":284,"context_line":"            self.assertTrue(get_dc.called)"},{"line_number":285,"context_line":"            self.assertTrue(call_method.called)"},{"line_number":286,"context_line":"            wait.assert_called_with(fake_return)"},{"line_number":287,"context_line":"            self.assertEqual(\"vm_ref_orig\","},{"line_number":288,"context_line":"                             vm_util.vm_ref_cache_get("},{"line_number":289,"context_line":"                                 \"fake-uuid-133243523-orig\"))"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAWH%2F%2FX20%3D","line":286,"updated":"2014-03-18 09:56:55.000000000","message":"I\u0027m not convinced it\u0027s worth testing much of this implementation detail. It seems to me it\u0027s just likely to make the test fail unnecessarily if the details change later. I would focus on testing the inputs and outputs. In this case, the test seems to be specifically interested in the effect of migrate_disk_and_power_off on the cache. I\u0027d stick to that.\n\nThis is just a suggestion, though. I won\u0027t get hung up on this.","commit_id":"3ed7c4c88ddda4447c098dfa474cbfc4bc7abf31"}],"nova/virt/vmwareapi/vm_util.py":[{"author":{"_account_id":9533,"name":"Eiichi Aikawa","email":"aikawa@mxk.nes.nec.co.jp","username":"EiichiAikawa"},"change_message_id":"50abaa101a940288d7db0f15f8c2deacd6a9ec29","unresolved":false,"context_lines":[{"line_number":838,"context_line":""},{"line_number":839,"context_line":""},{"line_number":840,"context_line":"def get_vm_ref_for_resize(session, instance):"},{"line_number":841,"context_line":"    \"\"\""},{"line_number":842,"context_line":"    Get VM reference for resize action and"},{"line_number":843,"context_line":"    update it to cache"},{"line_number":844,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2By7A%3D","line":841,"updated":"2014-03-12 04:46:38.000000000","message":"According to error on log, this line should be as following.\n””” Get VM reference for resize action and","commit_id":"f2bef89d0358154a7d56554c9d862f7bdcd63e57"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"4e6a908ab54ca9eade3eda16551f6c7edcb2c76a","unresolved":false,"context_lines":[{"line_number":840,"context_line":"def get_vm_ref_for_resize(session, instance):"},{"line_number":841,"context_line":"    \"\"\"Get VM reference for resize action"},{"line_number":842,"context_line":"    and update it to cache."},{"line_number":843,"context_line":"    \"\"\""},{"line_number":844,"context_line":"    uuid \u003d instance[\u0027uuid\u0027]"},{"line_number":845,"context_line":"    vm_ref \u003d _get_vm_ref_from_uuid(session, uuid)"},{"line_number":846,"context_line":"    vm_ref_cache_update(uuid, vm_ref)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAVn%2F%2Bwzg%3D","line":843,"updated":"2014-03-12 10:37:15.000000000","message":"Can you please add a comment here indicating that do not use _get_vm_ref_from_vm_uuid and _get_vm_ref_from_extraconfig\nDue to the fact that they are based on config spec properties that we do not and should not update.","commit_id":"dbab0fc7590844d10dbe6ce2f19b018f2397bbbe"},{"author":{"_account_id":7400,"name":"Tracy Jones","email":"tjones@vmware.com","username":"tracyajones"},"change_message_id":"7b73fdcfa901328e929b907c536740343d8d8223","unresolved":false,"context_lines":[{"line_number":94,"context_line":"    def wrapper(session, vm_ref, newName, oldName):"},{"line_number":95,"context_line":"        func(session, vm_ref, newName)"},{"line_number":96,"context_line":"        vm_ref_cache_update(newName, vm_ref)"},{"line_number":97,"context_line":"        vm_ref_cache_delete(oldName)"},{"line_number":98,"context_line":"    return wrapper"},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"def vm_ref_cache_for_clone(func):"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAWH%2F%2B7vs%3D","line":97,"updated":"2014-03-21 15:29:09.000000000","message":"I think we have a potential race here.  I would either just delete it (and comment why) or move the delete above the rename","commit_id":"ddcc9f8d4983f2bb61d9750b47f5f66dbe2b3c4e"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"d446fc3b2114620f35698e1988624e4b40177c20","unresolved":false,"context_lines":[{"line_number":94,"context_line":"    def wrapper(session, vm_ref, newName, oldName):"},{"line_number":95,"context_line":"        func(session, vm_ref, newName)"},{"line_number":96,"context_line":"        vm_ref_cache_update(newName, vm_ref)"},{"line_number":97,"context_line":"        vm_ref_cache_delete(oldName)"},{"line_number":98,"context_line":"    return wrapper"},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"def vm_ref_cache_for_clone(func):"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAWH%2F%2B7V4%3D","line":97,"in_reply_to":"AAAAWH%2F%2B7i8%3D","updated":"2014-03-21 16:22:29.000000000","message":"Agreed, delete first would be better. However, it seems really (really) odd to have this behavior in a decorator. Is this going to be applied to multiple things? If anything, a cache update decorator could determine if the name was changed as part of the action it wraps and do the cache update properly.","commit_id":"ddcc9f8d4983f2bb61d9750b47f5f66dbe2b3c4e"},{"author":{"_account_id":7400,"name":"Tracy Jones","email":"tjones@vmware.com","username":"tracyajones"},"change_message_id":"02dce036d2ba8e1e85a837426a01cc70c27435f0","unresolved":false,"context_lines":[{"line_number":94,"context_line":"    def wrapper(session, vm_ref, newName, oldName):"},{"line_number":95,"context_line":"        func(session, vm_ref, newName)"},{"line_number":96,"context_line":"        vm_ref_cache_update(newName, vm_ref)"},{"line_number":97,"context_line":"        vm_ref_cache_delete(oldName)"},{"line_number":98,"context_line":"    return wrapper"},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"def vm_ref_cache_for_clone(func):"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAWH%2F%2B7UM%3D","line":97,"in_reply_to":"AAAAWH%2F%2B7i8%3D","updated":"2014-03-21 16:27:24.000000000","message":"if there are 2 threads executing and one does a rename and gets to update the name and then a different thread runs and does a cache lookup there were be 2 entries with the same name","commit_id":"ddcc9f8d4983f2bb61d9750b47f5f66dbe2b3c4e"},{"author":{"_account_id":10327,"name":"Feng Xi Yan","email":"yanfengxi@cn.ibm.com","username":"yanfengxi"},"change_message_id":"8c290102515142109e8f082c0164bb026a38f01e","unresolved":false,"context_lines":[{"line_number":94,"context_line":"    def wrapper(session, vm_ref, newName, oldName):"},{"line_number":95,"context_line":"        func(session, vm_ref, newName)"},{"line_number":96,"context_line":"        vm_ref_cache_update(newName, vm_ref)"},{"line_number":97,"context_line":"        vm_ref_cache_delete(oldName)"},{"line_number":98,"context_line":"    return wrapper"},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"def vm_ref_cache_for_clone(func):"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAWH%2F%2B7i8%3D","line":97,"in_reply_to":"AAAAWH%2F%2B7vs%3D","updated":"2014-03-21 15:53:49.000000000","message":"What do you mean with \"potential race\"?\nAnd, could you tell me why you would like delete L97 or move it above?","commit_id":"ddcc9f8d4983f2bb61d9750b47f5f66dbe2b3c4e"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"d446fc3b2114620f35698e1988624e4b40177c20","unresolved":false,"context_lines":[{"line_number":109,"context_line":"    def wrapper(session, vm_ref, instance_name):"},{"line_number":110,"context_line":"        func(session, vm_ref, instance_name)"},{"line_number":111,"context_line":"        vm_ref_cache_delete(instance_name)"},{"line_number":112,"context_line":"    return wrapper"},{"line_number":113,"context_line":""},{"line_number":114,"context_line":"def get_vm_create_spec(client_factory, instance, name, data_store_name,"},{"line_number":115,"context_line":"                       vif_infos, os_type\u003d\"otherGuest\"):"}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAWH%2F%2B7VY%3D","line":112,"updated":"2014-03-21 16:22:29.000000000","message":"Same for these. Having purpose-built decorators is very strange. Either a cache update decorator that ensures that the cache is consistent, or just put this code in the thing that is doing the work.","commit_id":"ddcc9f8d4983f2bb61d9750b47f5f66dbe2b3c4e"},{"author":{"_account_id":7400,"name":"Tracy Jones","email":"tjones@vmware.com","username":"tracyajones"},"change_message_id":"7b73fdcfa901328e929b907c536740343d8d8223","unresolved":false,"context_lines":[{"line_number":178,"context_line":"    resize_spec.memoryMB \u003d int(instance[\u0027memory_mb\u0027])"},{"line_number":179,"context_line":"    return resize_spec"},{"line_number":180,"context_line":""},{"line_number":181,"context_line":""},{"line_number":182,"context_line":"@vm_ref_cache_for_rename"},{"line_number":183,"context_line":"def rename_vm(session, vm_ref, new_name, old_name):"},{"line_number":184,"context_line":"    rename_task \u003d session._call_method("}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAWH%2F%2B7vY%3D","line":181,"updated":"2014-03-21 15:29:09.000000000","message":"please consider moving the decorators down to here so you don\u0027t have to search up the file to see them","commit_id":"ddcc9f8d4983f2bb61d9750b47f5f66dbe2b3c4e"},{"author":{"_account_id":7400,"name":"Tracy Jones","email":"tjones@vmware.com","username":"tracyajones"},"change_message_id":"02dce036d2ba8e1e85a837426a01cc70c27435f0","unresolved":false,"context_lines":[{"line_number":178,"context_line":"    resize_spec.memoryMB \u003d int(instance[\u0027memory_mb\u0027])"},{"line_number":179,"context_line":"    return resize_spec"},{"line_number":180,"context_line":""},{"line_number":181,"context_line":""},{"line_number":182,"context_line":"@vm_ref_cache_for_rename"},{"line_number":183,"context_line":"def rename_vm(session, vm_ref, new_name, old_name):"},{"line_number":184,"context_line":"    rename_task \u003d session._call_method("}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAWH%2F%2B7TU%3D","line":181,"in_reply_to":"AAAAWH%2F%2B7Wc%3D","updated":"2014-03-21 16:27:24.000000000","message":"oh ok - i just didn\u0027t like having to search for them...","commit_id":"ddcc9f8d4983f2bb61d9750b47f5f66dbe2b3c4e"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"d446fc3b2114620f35698e1988624e4b40177c20","unresolved":false,"context_lines":[{"line_number":178,"context_line":"    resize_spec.memoryMB \u003d int(instance[\u0027memory_mb\u0027])"},{"line_number":179,"context_line":"    return resize_spec"},{"line_number":180,"context_line":""},{"line_number":181,"context_line":""},{"line_number":182,"context_line":"@vm_ref_cache_for_rename"},{"line_number":183,"context_line":"def rename_vm(session, vm_ref, new_name, old_name):"},{"line_number":184,"context_line":"    rename_task \u003d session._call_method("}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAWH%2F%2B7Wc%3D","line":181,"in_reply_to":"AAAAWH%2F%2B7vY%3D","updated":"2014-03-21 16:22:29.000000000","message":"It\u0027s pretty typical to place all the decorators at the top.","commit_id":"ddcc9f8d4983f2bb61d9750b47f5f66dbe2b3c4e"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"9b23f028c4fcea479ed6a11771ccd954d70c1655","unresolved":false,"context_lines":[{"line_number":65,"context_line":"    \"\"\""},{"line_number":66,"context_line":"    keys \u003d [key for key, val in list(_VM_REFS_CACHE.items()) if val \u003d\u003d vm_ref]"},{"line_number":67,"context_line":"    for key in keys:"},{"line_number":68,"context_line":"        _VM_REFS_CACHE.pop(key, None)"},{"line_number":69,"context_line":""},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"def vm_ref_cache_update(id, vm_ref):"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAAWH%2F%2B5oU%3D","line":68,"updated":"2014-03-21 20:52:59.000000000","message":"This is a really heavyweight thing to do when we know the id? Why not just something like\n\n VM_REFS_CACHE.pop(vm_ref.id)\n\n? Also for the \u003dNone case, which I assume you meant as \"delete everything\" it would be much (much) more efficient to just do:\n\n VM_REFS_CACHE \u003d {}\n\nSurely there\u0027s something I\u0027m missing?","commit_id":"02b2e98c0e706fc04a1dee75a6d2052ade7c4b0d"},{"author":{"_account_id":10327,"name":"Feng Xi Yan","email":"yanfengxi@cn.ibm.com","username":"yanfengxi"},"change_message_id":"337503547a113a91e8085b2a3deab2da1a529597","unresolved":false,"context_lines":[{"line_number":87,"context_line":"    @functools.wraps(func)"},{"line_number":88,"context_line":"    def wrapper(session, instance, *args, **kw):"},{"line_number":89,"context_line":"        id \u003d instance[\u0027uuid\u0027]"},{"line_number":90,"context_line":"        if len(args) \u003e 0 and args[0] is not None:"},{"line_number":91,"context_line":"            vm_ref_cache_delete(id)"},{"line_number":92,"context_line":"            id \u003d args[0]"},{"line_number":93,"context_line":"        return _vm_ref_cache(id, func, session, instance, *args, **kw)"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B4ls%3D","line":90,"updated":"2014-03-22 00:38:28.000000000","message":"Why not just put it like:\nif args and args[0]:","commit_id":"35bef01a3f0aff4d5cd6587c49f07980ffeaccc8"},{"author":{"_account_id":7629,"name":"Shawn Hartsock","email":"hartsock@acm.org","username":"hartsocks"},"change_message_id":"00b53abeccac74106bb281b54abf777c94836e75","unresolved":false,"context_lines":[{"line_number":87,"context_line":"    @functools.wraps(func)"},{"line_number":88,"context_line":"    def wrapper(session, instance, *args, **kw):"},{"line_number":89,"context_line":"        id \u003d instance[\u0027uuid\u0027]"},{"line_number":90,"context_line":"        if len(args) \u003e 0 and args[0] is not None:"},{"line_number":91,"context_line":"            vm_ref_cache_delete(id)"},{"line_number":92,"context_line":"            id \u003d args[0]"},{"line_number":93,"context_line":"        return _vm_ref_cache(id, func, session, instance, *args, **kw)"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B4co%3D","line":90,"in_reply_to":"AAAAWH%2F%2B4ls%3D","updated":"2014-03-22 01:10:40.000000000","message":"We want to check for length of at least 1 on args. args can be not None and still have no zeroth index.\n\nI had to change that line from if args adn args[0] after some tests.\n\nyou want to check an argument against None directly and not rely on a non-false value. It\u0027s a common thing to get a -1 on.","commit_id":"35bef01a3f0aff4d5cd6587c49f07980ffeaccc8"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"0bc4a006ea4494b410809f33f592078f839dca39","unresolved":false,"context_lines":[{"line_number":88,"context_line":"    def wrapper(session, instance, *args, **kw):"},{"line_number":89,"context_line":"        id \u003d instance[\u0027uuid\u0027]"},{"line_number":90,"context_line":"        if len(args) \u003e 0 and args[0] is not None:"},{"line_number":91,"context_line":"            vm_ref_cache_delete(id)"},{"line_number":92,"context_line":"            id \u003d args[0]"},{"line_number":93,"context_line":"        return _vm_ref_cache(id, func, session, instance, *args, **kw)"},{"line_number":94,"context_line":"    return wrapper"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B3FI%3D","line":91,"updated":"2014-03-22 16:41:38.000000000","message":"Which case will this be done. Pease clarify. From what I see if deletes the cache antry and populates with the same one again - this causes a costly roudtrip to the backend that may not be necessary","commit_id":"35bef01a3f0aff4d5cd6587c49f07980ffeaccc8"},{"author":{"_account_id":7629,"name":"Shawn Hartsock","email":"hartsock@acm.org","username":"hartsocks"},"change_message_id":"33a0c3af9b3e62fbd63263c4d258f9434b1914f3","unresolved":false,"context_lines":[{"line_number":88,"context_line":"    def wrapper(session, instance, *args, **kw):"},{"line_number":89,"context_line":"        id \u003d instance[\u0027uuid\u0027]"},{"line_number":90,"context_line":"        if len(args) \u003e 0 and args[0] is not None:"},{"line_number":91,"context_line":"            vm_ref_cache_delete(id)"},{"line_number":92,"context_line":"            id \u003d args[0]"},{"line_number":93,"context_line":"        return _vm_ref_cache(id, func, session, instance, *args, **kw)"},{"line_number":94,"context_line":"    return wrapper"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B2z8%3D","line":91,"in_reply_to":"AAAAWH%2F%2B3FI%3D","updated":"2014-03-22 21:31:03.000000000","message":"vm_ref \u003d vm_util.get_vm_ref(session, {\u0027uuid\u0027: \u0027a\u0027}, \u0027b\u0027)\n\nIn this instance... which vm_ref is right? The one associated with a? The one associated with \u0027b\u0027? What does that even mean?\n\nBetter to remove the key and find out what the right answer is.","commit_id":"35bef01a3f0aff4d5cd6587c49f07980ffeaccc8"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"0bc4a006ea4494b410809f33f592078f839dca39","unresolved":false,"context_lines":[{"line_number":98,"context_line":"VNC_CONFIG_KEY \u003d \u0027config.extraConfig[\"RemoteDisplay.vnc.port\"]\u0027"},{"line_number":99,"context_line":""},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"def vm_ref_cache_flush(func):"},{"line_number":102,"context_line":"    \"\"\"Decorate a method that forces a flush of all vm_ref mapping."},{"line_number":103,"context_line":"    \"\"\""},{"line_number":104,"context_line":"    @functools.wraps(func)"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B3FE%3D","line":101,"updated":"2014-03-22 16:41:38.000000000","message":"This is not related to this bug fix and should not be in the this patch set.","commit_id":"35bef01a3f0aff4d5cd6587c49f07980ffeaccc8"},{"author":{"_account_id":7629,"name":"Shawn Hartsock","email":"hartsock@acm.org","username":"hartsocks"},"change_message_id":"33a0c3af9b3e62fbd63263c4d258f9434b1914f3","unresolved":false,"context_lines":[{"line_number":98,"context_line":"VNC_CONFIG_KEY \u003d \u0027config.extraConfig[\"RemoteDisplay.vnc.port\"]\u0027"},{"line_number":99,"context_line":""},{"line_number":100,"context_line":""},{"line_number":101,"context_line":"def vm_ref_cache_flush(func):"},{"line_number":102,"context_line":"    \"\"\"Decorate a method that forces a flush of all vm_ref mapping."},{"line_number":103,"context_line":"    \"\"\""},{"line_number":104,"context_line":"    @functools.wraps(func)"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B2z4%3D","line":101,"in_reply_to":"AAAAWH%2F%2B3FE%3D","updated":"2014-03-22 21:31:03.000000000","message":"I tried a number of things. I\u0027ll admit this is a bit ham-handed but several unit tests simply wouldn\u0027t work until I flushed empty the cache like this.\n\nI\u0027ll try again to produce a version that\u0027s more subtle and see what happens.","commit_id":"35bef01a3f0aff4d5cd6587c49f07980ffeaccc8"},{"author":{"_account_id":10327,"name":"Feng Xi Yan","email":"yanfengxi@cn.ibm.com","username":"yanfengxi"},"change_message_id":"337503547a113a91e8085b2a3deab2da1a529597","unresolved":false,"context_lines":[{"line_number":211,"context_line":"    session._wait_for_task(rename_task)"},{"line_number":212,"context_line":""},{"line_number":213,"context_line":""},{"line_number":214,"context_line":"@vm_ref_cache_invalidate"},{"line_number":215,"context_line":"def clone_vm(session, instance, vm_ref, folder, instance_name, clone_spec):"},{"line_number":216,"context_line":"    # old_uuid is needed for cache invalidation"},{"line_number":217,"context_line":"    vm_clone_task \u003d session._call_method("}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B4jA%3D","line":214,"updated":"2014-03-22 00:38:28.000000000","message":"There is no need to validate cache for clone task. Cache validation is only suitable for rename_vm and destory_vm.\nBecause clone_vm returns a new vm_ref, maybe we should consider to update it into cache.","commit_id":"35bef01a3f0aff4d5cd6587c49f07980ffeaccc8"},{"author":{"_account_id":7629,"name":"Shawn Hartsock","email":"hartsock@acm.org","username":"hartsocks"},"change_message_id":"33a0c3af9b3e62fbd63263c4d258f9434b1914f3","unresolved":false,"context_lines":[{"line_number":211,"context_line":"    session._wait_for_task(rename_task)"},{"line_number":212,"context_line":""},{"line_number":213,"context_line":""},{"line_number":214,"context_line":"@vm_ref_cache_invalidate"},{"line_number":215,"context_line":"def clone_vm(session, instance, vm_ref, folder, instance_name, clone_spec):"},{"line_number":216,"context_line":"    # old_uuid is needed for cache invalidation"},{"line_number":217,"context_line":"    vm_clone_task \u003d session._call_method("}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B2ws%3D","line":214,"in_reply_to":"AAAAWH%2F%2B3FA%3D","updated":"2014-03-22 21:31:03.000000000","message":"You were on the phone call where you discussed those plans. I\u0027m surprised you don\u0027t remember. I plan on bringing this forward in the weekly meeting in IRC and we\u0027ll start formal planning then.","commit_id":"35bef01a3f0aff4d5cd6587c49f07980ffeaccc8"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"0bc4a006ea4494b410809f33f592078f839dca39","unresolved":false,"context_lines":[{"line_number":211,"context_line":"    session._wait_for_task(rename_task)"},{"line_number":212,"context_line":""},{"line_number":213,"context_line":""},{"line_number":214,"context_line":"@vm_ref_cache_invalidate"},{"line_number":215,"context_line":"def clone_vm(session, instance, vm_ref, folder, instance_name, clone_spec):"},{"line_number":216,"context_line":"    # old_uuid is needed for cache invalidation"},{"line_number":217,"context_line":"    vm_clone_task \u003d session._call_method("}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B3FA%3D","line":214,"in_reply_to":"AAAAWH%2F%2B4cM%3D","updated":"2014-03-22 16:41:38.000000000","message":"It would be nice to hear about these plans that we have. Please share","commit_id":"35bef01a3f0aff4d5cd6587c49f07980ffeaccc8"},{"author":{"_account_id":7629,"name":"Shawn Hartsock","email":"hartsock@acm.org","username":"hartsocks"},"change_message_id":"00b53abeccac74106bb281b54abf777c94836e75","unresolved":false,"context_lines":[{"line_number":211,"context_line":"    session._wait_for_task(rename_task)"},{"line_number":212,"context_line":""},{"line_number":213,"context_line":""},{"line_number":214,"context_line":"@vm_ref_cache_invalidate"},{"line_number":215,"context_line":"def clone_vm(session, instance, vm_ref, folder, instance_name, clone_spec):"},{"line_number":216,"context_line":"    # old_uuid is needed for cache invalidation"},{"line_number":217,"context_line":"    vm_clone_task \u003d session._call_method("}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B4cM%3D","line":214,"in_reply_to":"AAAAWH%2F%2B4jA%3D","updated":"2014-03-22 01:10:40.000000000","message":"We actually want to force the lookup methods to do their job fresh. If we presume too much about how different components behave, then we have to be aware of how they should act and keep all the different parts working the same.\n\nWe have plans to change how the vm_ref lookup works in the future and that may eliminate the need for this cache.","commit_id":"35bef01a3f0aff4d5cd6587c49f07980ffeaccc8"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"c1fa01915c2bc6ffc884f1faf7263c8f67f18505","unresolved":false,"context_lines":[{"line_number":850,"context_line":"                                    _get_object_for_value)"},{"line_number":851,"context_line":""},{"line_number":852,"context_line":""},{"line_number":853,"context_line":"@vm_ref_cache_flush"},{"line_number":854,"context_line":"def get_vm_ref_from_name(session, instance, vm_name):"},{"line_number":855,"context_line":"    # TODO(hartsocks): This method should be deprecated. Do not use."},{"line_number":856,"context_line":"    return (_get_vm_ref_from_vm_uuid(session, vm_name) or"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B4Gw%3D","line":853,"updated":"2014-03-22 04:38:28.000000000","message":"You are resetting the entire cache here. This.is problematic. Why not just invalidate the specific entry? Say you have thousand of Vm\u0027s running there will be a nova CPU spike.\nThis also does not have any relation to this path set.\nThis may also cause resize problems:-\n1. Vm x calls this func\n2. Vm y is in resize\nThis method invokes the get cm ref functions fail as the old vm ref is returned - either by nvp uuid or instance uuid \nT","commit_id":"35bef01a3f0aff4d5cd6587c49f07980ffeaccc8"},{"author":{"_account_id":7629,"name":"Shawn Hartsock","email":"hartsock@acm.org","username":"hartsocks"},"change_message_id":"33a0c3af9b3e62fbd63263c4d258f9434b1914f3","unresolved":false,"context_lines":[{"line_number":850,"context_line":"                                    _get_object_for_value)"},{"line_number":851,"context_line":""},{"line_number":852,"context_line":""},{"line_number":853,"context_line":"@vm_ref_cache_flush"},{"line_number":854,"context_line":"def get_vm_ref_from_name(session, instance, vm_name):"},{"line_number":855,"context_line":"    # TODO(hartsocks): This method should be deprecated. Do not use."},{"line_number":856,"context_line":"    return (_get_vm_ref_from_vm_uuid(session, vm_name) or"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B2zg%3D","line":853,"in_reply_to":"AAAAWH%2F%2B3HA%3D","updated":"2014-03-22 21:31:03.000000000","message":"I\u0027ll try a more subtle approach and see if the unit tests and minesweeper will handle it well.","commit_id":"35bef01a3f0aff4d5cd6587c49f07980ffeaccc8"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"8fba8c71c8e1aaef70d11fa01fa017fa6d005672","unresolved":false,"context_lines":[{"line_number":850,"context_line":"                                    _get_object_for_value)"},{"line_number":851,"context_line":""},{"line_number":852,"context_line":""},{"line_number":853,"context_line":"@vm_ref_cache_flush"},{"line_number":854,"context_line":"def get_vm_ref_from_name(session, instance, vm_name):"},{"line_number":855,"context_line":"    # TODO(hartsocks): This method should be deprecated. Do not use."},{"line_number":856,"context_line":"    return (_get_vm_ref_from_vm_uuid(session, vm_name) or"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B3HA%3D","line":853,"in_reply_to":"AAAAWH%2F%2B4Gw%3D","updated":"2014-03-22 16:15:38.000000000","message":"You should use vm_ref_cache_invalidate here","commit_id":"35bef01a3f0aff4d5cd6587c49f07980ffeaccc8"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"8fba8c71c8e1aaef70d11fa01fa017fa6d005672","unresolved":false,"context_lines":[{"line_number":1012,"context_line":"        return p.val"},{"line_number":1013,"context_line":""},{"line_number":1014,"context_line":""},{"line_number":1015,"context_line":"@vm_ref_cache_flush"},{"line_number":1016,"context_line":"def get_vm_state_from_name(session, instance, instance_name):"},{"line_number":1017,"context_line":"    # NOTE(hartsocks): force a network round trip here to ensure we have"},{"line_number":1018,"context_line":"    # the correct vm_ref to check power state on."}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B3HE%3D","line":1015,"updated":"2014-03-22 16:15:38.000000000","message":"This is really bad. For a specific VM you are deleting the entire cache.\nThis is not related to the bug and should maybe be addressed in a seperate patch (if necessary, but I do not think so)\nWhy not use vm_ref_cache_invalidate?","commit_id":"35bef01a3f0aff4d5cd6587c49f07980ffeaccc8"},{"author":{"_account_id":7629,"name":"Shawn Hartsock","email":"hartsock@acm.org","username":"hartsocks"},"change_message_id":"33a0c3af9b3e62fbd63263c4d258f9434b1914f3","unresolved":false,"context_lines":[{"line_number":1012,"context_line":"        return p.val"},{"line_number":1013,"context_line":""},{"line_number":1014,"context_line":""},{"line_number":1015,"context_line":"@vm_ref_cache_flush"},{"line_number":1016,"context_line":"def get_vm_state_from_name(session, instance, instance_name):"},{"line_number":1017,"context_line":"    # NOTE(hartsocks): force a network round trip here to ensure we have"},{"line_number":1018,"context_line":"    # the correct vm_ref to check power state on."}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2B2z0%3D","line":1015,"in_reply_to":"AAAAWH%2F%2B3HE%3D","updated":"2014-03-22 21:31:03.000000000","message":"I could not get the tests to pass without this. It\u0027s ham-handed but it worked. Minesweeper is still unhappy. That means we have several unit tests that do not reflect reality AND/OR we are missing significant code-coverage.\n\nI\u0027ll try something softer now that I\u0027ve had a night to sleep on it.","commit_id":"35bef01a3f0aff4d5cd6587c49f07980ffeaccc8"}],"nova/virt/vmwareapi/vmops.py":[{"author":{"_account_id":7148,"name":"Zhu Zhu","email":"bjzzu.zz@gmail.com","username":"zhuzhubj"},"change_message_id":"0045a6c291640f62844801781584e736355c048c","unresolved":false,"context_lines":[{"line_number":1335,"context_line":"        \"\"\"Completes a resize, turning on the migrated instance.\"\"\""},{"line_number":1336,"context_line":"        if resize_instance:"},{"line_number":1337,"context_line":"            client_factory \u003d self._session._get_vim().client.factory"},{"line_number":1338,"context_line":"            vm_ref \u003d vm_util.get_vm_ref_for_resize(self._session, instance)"},{"line_number":1339,"context_line":"            vm_resize_spec \u003d vm_util.get_vm_resize_spec(client_factory,"},{"line_number":1340,"context_line":"                                                        instance)"},{"line_number":1341,"context_line":"            reconfig_task \u003d self._session._call_method("}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAVn%2F%2Bw7A%3D","line":1338,"updated":"2014-03-12 10:17:03.000000000","message":"is it more suitable to get this cache updated ahead. such as in migrate_disk_and_power_off method after clone VM?","commit_id":"dbab0fc7590844d10dbe6ce2f19b018f2397bbbe"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"6778e58ef3850add6f2e6e8b2cb7ab521c7c60d9","unresolved":false,"context_lines":[{"line_number":1335,"context_line":"        \"\"\"Completes a resize, turning on the migrated instance.\"\"\""},{"line_number":1336,"context_line":"        if resize_instance:"},{"line_number":1337,"context_line":"            client_factory \u003d self._session._get_vim().client.factory"},{"line_number":1338,"context_line":"            vm_ref \u003d vm_util.get_vm_ref_for_resize(self._session, instance)"},{"line_number":1339,"context_line":"            vm_resize_spec \u003d vm_util.get_vm_resize_spec(client_factory,"},{"line_number":1340,"context_line":"                                                        instance)"},{"line_number":1341,"context_line":"            reconfig_task \u003d self._session._call_method("}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAVn%2F%2BwxI%3D","line":1338,"in_reply_to":"AAAAVn%2F%2Bw7A%3D","updated":"2014-03-12 10:41:15.000000000","message":"purging the cache does not help here. the reason for this is two fold:\n1. the cloned VM does not have a insatnceUuid set - which it actually should have\n2. the search _get_vm_ref_from_extraconfig may also lead to a false positive as it will return the first one","commit_id":"dbab0fc7590844d10dbe6ce2f19b018f2397bbbe"},{"author":{"_account_id":10327,"name":"Feng Xi Yan","email":"yanfengxi@cn.ibm.com","username":"yanfengxi"},"change_message_id":"5057f09dc8135c9a544fded8c0668a4eeadc8041","unresolved":false,"context_lines":[{"line_number":1335,"context_line":"        \"\"\"Completes a resize, turning on the migrated instance.\"\"\""},{"line_number":1336,"context_line":"        if resize_instance:"},{"line_number":1337,"context_line":"            client_factory \u003d self._session._get_vim().client.factory"},{"line_number":1338,"context_line":"            vm_ref \u003d vm_util.get_vm_ref_for_resize(self._session, instance)"},{"line_number":1339,"context_line":"            vm_resize_spec \u003d vm_util.get_vm_resize_spec(client_factory,"},{"line_number":1340,"context_line":"                                                        instance)"},{"line_number":1341,"context_line":"            reconfig_task \u003d self._session._call_method("}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAWH%2F%2F56c%3D","line":1338,"in_reply_to":"AAAAVn%2F%2BwxI%3D","updated":"2014-03-13 02:03:09.000000000","message":"Actually, we can update the cache after  rename_task. For example:\n\n_VM_REFS_CACHE[\"*****-orign\"]\u003d_VM_REFS_CACHE[\"******\"]\n\n_VM_REFS_CACHE[\"*****\"] \u003d None","commit_id":"dbab0fc7590844d10dbe6ce2f19b018f2397bbbe"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"80ed46d05d3942cc9ab531a97e60507ca1ba167e","unresolved":false,"context_lines":[{"line_number":1335,"context_line":"        \"\"\"Completes a resize, turning on the migrated instance.\"\"\""},{"line_number":1336,"context_line":"        if resize_instance:"},{"line_number":1337,"context_line":"            client_factory \u003d self._session._get_vim().client.factory"},{"line_number":1338,"context_line":"            vm_ref \u003d vm_util.get_vm_ref_for_resize(self._session, instance)"},{"line_number":1339,"context_line":"            vm_resize_spec \u003d vm_util.get_vm_resize_spec(client_factory,"},{"line_number":1340,"context_line":"                                                        instance)"},{"line_number":1341,"context_line":"            reconfig_task \u003d self._session._call_method("}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAWH%2F%2F4Hk%3D","line":1338,"in_reply_to":"AAAAWH%2F%2F56c%3D","updated":"2014-03-13 07:48:46.000000000","message":"That is a good idea. You can even do this a little earlier and not even touch the code here. \n\nIn https://github.com/openstack/nova/blob/master/nova/virt/vmwareapi/vmops.py#L1260 we should update the for the original VM\n\nAnd the clone task should return the VM_ref for the new VM (which can be added to the cache).\n\nPlease see https://review.openstack.org/#/c/71581/ that does this for the create task. You can do the same with the CloneVM_task","commit_id":"dbab0fc7590844d10dbe6ce2f19b018f2397bbbe"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"83f92191d6b8e6d5c498bd3ca5c67f86857f9d33","unresolved":false,"context_lines":[{"line_number":1262,"context_line":"                            \"Rename_Task\", vm_ref, newName\u003dname_label)"},{"line_number":1263,"context_line":"        self._session._wait_for_task(rename_task)"},{"line_number":1264,"context_line":"        # Update VM REF CACHE to add the new item keyed by name_label"},{"line_number":1265,"context_line":"        # as this will be used when do confirm resize"},{"line_number":1266,"context_line":"        vm_util.vm_ref_cache_update(name_label, vm_ref)"},{"line_number":1267,"context_line":"        LOG.debug(_(\"Renamed the VM to %s\") % name_label,"},{"line_number":1268,"context_line":"                  instance\u003dinstance)"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAWH%2F%2FlZs%3D","line":1265,"updated":"2014-03-16 05:59:13.000000000","message":"do \u003d\u003e doing the","commit_id":"048a30cdb3440ebe932537789bbb159acd3688ff"},{"author":{"_account_id":9555,"name":"Matthew Booth","email":"mbooth@redhat.com","username":"MatthewBooth"},"change_message_id":"20fd38943d00ab73b010c373cc8fdd33f2008741","unresolved":false,"context_lines":[{"line_number":1281,"context_line":"        self._session._wait_for_task(rename_task)"},{"line_number":1282,"context_line":"        # Update VM REF CACHE to add the new item keyed by name_label"},{"line_number":1283,"context_line":"        # as this will be used when do confirm resize"},{"line_number":1284,"context_line":"        vm_util.vm_ref_cache_update(name_label, vm_ref)"},{"line_number":1285,"context_line":"        LOG.debug(_(\"Renamed the VM to %s\") % name_label,"},{"line_number":1286,"context_line":"                  instance\u003dinstance)"},{"line_number":1287,"context_line":"        self._update_instance_progress(context, instance,"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAWH%2F%2FX9s%3D","line":1284,"updated":"2014-03-18 09:56:55.000000000","message":"You need a corresponding cache update in finish_revert_migration in case it fails.","commit_id":"3ed7c4c88ddda4447c098dfa474cbfc4bc7abf31"},{"author":{"_account_id":7629,"name":"Shawn Hartsock","email":"hartsock@acm.org","username":"hartsocks"},"change_message_id":"28471b04cf96539d5f7f89928b43678c208eeabd","unresolved":false,"context_lines":[{"line_number":1281,"context_line":"        self._session._wait_for_task(rename_task)"},{"line_number":1282,"context_line":"        # Update VM REF CACHE to add the new item keyed by name_label"},{"line_number":1283,"context_line":"        # as this will be used when do confirm resize"},{"line_number":1284,"context_line":"        vm_util.vm_ref_cache_update(name_label, vm_ref)"},{"line_number":1285,"context_line":"        LOG.debug(_(\"Renamed the VM to %s\") % name_label,"},{"line_number":1286,"context_line":"                  instance\u003dinstance)"},{"line_number":1287,"context_line":"        self._update_instance_progress(context, instance,"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAWH%2F%2B%2Fq4%3D","line":1284,"in_reply_to":"AAAAWH%2F%2FAAk%3D","updated":"2014-03-21 04:16:54.000000000","message":"That\u0027s not a bad idea. I would like to see a refactor make use of the normal cache decorators and invalidation decorators.\n\nUnfortunately this is a custom data structure based cache with no aging facility. We need this fixed quickly.\n\nThat means invalidate the cache and let the methods that understand how to do the lookups do their work.\n\nI do not like mixing logic like this.","commit_id":"3ed7c4c88ddda4447c098dfa474cbfc4bc7abf31"},{"author":{"_account_id":7629,"name":"Shawn Hartsock","email":"hartsock@acm.org","username":"hartsocks"},"change_message_id":"572c337bbf18f1653508dd4a27d5140ccec46cab","unresolved":false,"context_lines":[{"line_number":1281,"context_line":"        self._session._wait_for_task(rename_task)"},{"line_number":1282,"context_line":"        # Update VM REF CACHE to add the new item keyed by name_label"},{"line_number":1283,"context_line":"        # as this will be used when do confirm resize"},{"line_number":1284,"context_line":"        vm_util.vm_ref_cache_update(name_label, vm_ref)"},{"line_number":1285,"context_line":"        LOG.debug(_(\"Renamed the VM to %s\") % name_label,"},{"line_number":1286,"context_line":"                  instance\u003dinstance)"},{"line_number":1287,"context_line":"        self._update_instance_progress(context, instance,"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAWH%2F%2FDAI%3D","line":1284,"in_reply_to":"AAAAWH%2F%2FIo8%3D","updated":"2014-03-20 17:14:37.000000000","message":"I may have to let my objection slide. I it looks like nothing is exercising the decorators now. We should probably look at a later refactor to address this issue.\n\nI understand your desire to performance tune by pushing the vm_ref update into the cache here... but as Matthew Booth points out above this is going to produce a bug in finish_revert_migration\n\nI would rather take the performance hit and just \"invalidate\" the name_label at this point.\n\nThat goes for lines 1311 and 1335 below. If you instead invalidate you don\u0027t have to worry about \"what is the right value later\" if I\u0027m wrong I\u0027d appreciate the education.","commit_id":"3ed7c4c88ddda4447c098dfa474cbfc4bc7abf31"},{"author":{"_account_id":7148,"name":"Zhu Zhu","email":"bjzzu.zz@gmail.com","username":"zhuzhubj"},"change_message_id":"5963dda67c53a650326946279aade9e5e787c5c9","unresolved":false,"context_lines":[{"line_number":1281,"context_line":"        self._session._wait_for_task(rename_task)"},{"line_number":1282,"context_line":"        # Update VM REF CACHE to add the new item keyed by name_label"},{"line_number":1283,"context_line":"        # as this will be used when do confirm resize"},{"line_number":1284,"context_line":"        vm_util.vm_ref_cache_update(name_label, vm_ref)"},{"line_number":1285,"context_line":"        LOG.debug(_(\"Renamed the VM to %s\") % name_label,"},{"line_number":1286,"context_line":"                  instance\u003dinstance)"},{"line_number":1287,"context_line":"        self._update_instance_progress(context, instance,"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAWH%2F%2FAAk%3D","line":1284,"in_reply_to":"AAAAWH%2F%2FIo8%3D","updated":"2014-03-21 01:59:30.000000000","message":"what about moving the rename method into vm_utils. And having a rename cache update decorator for it? And same can apply to cache delete.","commit_id":"3ed7c4c88ddda4447c098dfa474cbfc4bc7abf31"},{"author":{"_account_id":10327,"name":"Feng Xi Yan","email":"yanfengxi@cn.ibm.com","username":"yanfengxi"},"change_message_id":"3ce11ba07a7b6eefd3b354a033525648713bb884","unresolved":false,"context_lines":[{"line_number":1281,"context_line":"        self._session._wait_for_task(rename_task)"},{"line_number":1282,"context_line":"        # Update VM REF CACHE to add the new item keyed by name_label"},{"line_number":1283,"context_line":"        # as this will be used when do confirm resize"},{"line_number":1284,"context_line":"        vm_util.vm_ref_cache_update(name_label, vm_ref)"},{"line_number":1285,"context_line":"        LOG.debug(_(\"Renamed the VM to %s\") % name_label,"},{"line_number":1286,"context_line":"                  instance\u003dinstance)"},{"line_number":1287,"context_line":"        self._update_instance_progress(context, instance,"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAWH%2F%2FIo8%3D","line":1284,"in_reply_to":"AAAAWH%2F%2FMKo%3D","updated":"2014-03-20 01:11:23.000000000","message":"Thanks for your concern. Do you have some suggestions to replace my ugly method?","commit_id":"3ed7c4c88ddda4447c098dfa474cbfc4bc7abf31"},{"author":{"_account_id":7629,"name":"Shawn Hartsock","email":"hartsock@acm.org","username":"hartsocks"},"change_message_id":"0d9629e0d1c379ac53b6f2bd8c7a344eea1b089d","unresolved":false,"context_lines":[{"line_number":1281,"context_line":"        self._session._wait_for_task(rename_task)"},{"line_number":1282,"context_line":"        # Update VM REF CACHE to add the new item keyed by name_label"},{"line_number":1283,"context_line":"        # as this will be used when do confirm resize"},{"line_number":1284,"context_line":"        vm_util.vm_ref_cache_update(name_label, vm_ref)"},{"line_number":1285,"context_line":"        LOG.debug(_(\"Renamed the VM to %s\") % name_label,"},{"line_number":1286,"context_line":"                  instance\u003dinstance)"},{"line_number":1287,"context_line":"        self._update_instance_progress(context, instance,"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAWH%2F%2FMKo%3D","line":1284,"in_reply_to":"AAAAWH%2F%2FObQ%3D","updated":"2014-03-19 16:07:51.000000000","message":"This strikes me as bad design for the cache. You shouldn\u0027t have to do this.","commit_id":"3ed7c4c88ddda4447c098dfa474cbfc4bc7abf31"},{"author":{"_account_id":7629,"name":"Shawn Hartsock","email":"hartsock@acm.org","username":"hartsocks"},"change_message_id":"f52fd3f7d2e6e844d870571a1382402470e398e7","unresolved":false,"context_lines":[{"line_number":1281,"context_line":"        self._session._wait_for_task(rename_task)"},{"line_number":1282,"context_line":"        # Update VM REF CACHE to add the new item keyed by name_label"},{"line_number":1283,"context_line":"        # as this will be used when do confirm resize"},{"line_number":1284,"context_line":"        vm_util.vm_ref_cache_update(name_label, vm_ref)"},{"line_number":1285,"context_line":"        LOG.debug(_(\"Renamed the VM to %s\") % name_label,"},{"line_number":1286,"context_line":"                  instance\u003dinstance)"},{"line_number":1287,"context_line":"        self._update_instance_progress(context, instance,"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAWH%2F%2FXtg%3D","line":1284,"in_reply_to":"AAAAWH%2F%2FX9s%3D","updated":"2014-03-18 10:13:20.000000000","message":"Is there a reason that this method couldn\u0027t return the name_label and the vm_ref to a decorator that could then update the vm_ref_cache?\n\nI would like to follow a rule of consistency in making these kinds of updates.","commit_id":"3ed7c4c88ddda4447c098dfa474cbfc4bc7abf31"},{"author":{"_account_id":10327,"name":"Feng Xi Yan","email":"yanfengxi@cn.ibm.com","username":"yanfengxi"},"change_message_id":"a0001f1ad001cb2c7144ec2b8704f97f76bafb24","unresolved":false,"context_lines":[{"line_number":1281,"context_line":"        self._session._wait_for_task(rename_task)"},{"line_number":1282,"context_line":"        # Update VM REF CACHE to add the new item keyed by name_label"},{"line_number":1283,"context_line":"        # as this will be used when do confirm resize"},{"line_number":1284,"context_line":"        vm_util.vm_ref_cache_update(name_label, vm_ref)"},{"line_number":1285,"context_line":"        LOG.debug(_(\"Renamed the VM to %s\") % name_label,"},{"line_number":1286,"context_line":"                  instance\u003dinstance)"},{"line_number":1287,"context_line":"        self._update_instance_progress(context, instance,"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAWH%2F%2FObQ%3D","line":1284,"in_reply_to":"AAAAWH%2F%2FXtg%3D","updated":"2014-03-19 10:08:47.000000000","message":"Because the original VM is renamed to uuid-orig, it\u0027s vm_ref cache should keyed by uuid-orig, but now it\u0027s still keyed by uuid.\nThe reason is that the cache is not aware of the renaming task.\nSo now we have to update the cache mid-process rudely.","commit_id":"3ed7c4c88ddda4447c098dfa474cbfc4bc7abf31"},{"author":{"_account_id":7629,"name":"Shawn Hartsock","email":"hartsock@acm.org","username":"hartsocks"},"change_message_id":"f52fd3f7d2e6e844d870571a1382402470e398e7","unresolved":false,"context_lines":[{"line_number":1308,"context_line":"        taskinfo \u003d self._session._wait_for_task(vm_clone_task)"},{"line_number":1309,"context_line":"        # Update the VM REF CACHE, to update the vm_ref keyed"},{"line_number":1310,"context_line":"        # by instance[\u0027uuid\u0027]"},{"line_number":1311,"context_line":"        vm_util.vm_ref_cache_update(instance[\u0027uuid\u0027], taskinfo.result)"},{"line_number":1312,"context_line":"        LOG.debug(_(\"Cloned VM to host %s\") % dest, instance\u003dinstance)"},{"line_number":1313,"context_line":"        self._update_instance_progress(context, instance,"},{"line_number":1314,"context_line":"                                       step\u003d3,"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAWH%2F%2FXvo%3D","line":1311,"updated":"2014-03-18 10:13:20.000000000","message":"Is there a reason this method couldn\u0027t return the uuid and vm_ref and update the cache via a decorator?\n\nSee the already existing @vm_ref_cache_from_name found in the vm_util.py ... I would prefer keeping cache operations together in that file.","commit_id":"3ed7c4c88ddda4447c098dfa474cbfc4bc7abf31"},{"author":{"_account_id":7629,"name":"Shawn Hartsock","email":"hartsock@acm.org","username":"hartsocks"},"change_message_id":"f52fd3f7d2e6e844d870571a1382402470e398e7","unresolved":false,"context_lines":[{"line_number":1332,"context_line":"            self._session._wait_for_task(destroy_task)"},{"line_number":1333,"context_line":"            # Delete the outdated VM REF from cache, because"},{"line_number":1334,"context_line":"            # it will never be used again"},{"line_number":1335,"context_line":"            vm_util.vm_ref_cache_delete(instance_name)"},{"line_number":1336,"context_line":"            LOG.debug(_(\"Destroyed the VM\"), instance\u003dinstance)"},{"line_number":1337,"context_line":"        except Exception as excep:"},{"line_number":1338,"context_line":"            LOG.warn(_(\"In vmwareapi:vmops:confirm_migration, got this \""}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAWH%2F%2FXwg%3D","line":1335,"updated":"2014-03-18 10:13:20.000000000","message":"I would prefer this was a cache invalidation decorator.","commit_id":"3ed7c4c88ddda4447c098dfa474cbfc4bc7abf31"}]}
