)]}'
{"monasca_agent/collector/checks_d/libvirt.py":[{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"47650f7e6d2cbefabcaee5e519d7f615fc249d50","unresolved":false,"context_lines":[{"line_number":319,"context_line":"                dims_customer \u003d dims_base.copy()"},{"line_number":320,"context_line":"                dims_customer[\u0027resource_id\u0027] \u003d instance_cache.get(inst_name)[\u0027instance_uuid\u0027]"},{"line_number":321,"context_line":"                dims_customer[\u0027zone\u0027] \u003d instance_cache.get(inst_name)[\u0027zone\u0027]"},{"line_number":322,"context_line":"                dims_customer[\u0027scale_group\u0027] \u003d instance_cache.get(inst_name)[\u0027scale_group\u0027]"},{"line_number":323,"context_line":"                # Add dimensions that would be helpful for operations"},{"line_number":324,"context_line":"                dims_operations \u003d dims_customer.copy()"},{"line_number":325,"context_line":"                dims_operations[\u0027tenant_id\u0027] \u003d instance_cache.get(inst_name)[\u0027tenant_id\u0027]"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a2fa921_076a5d81","line":322,"updated":"2015-10-08 16:58:27.000000000","message":"Dimensions must have a non-empty value. So, you need to not send scale_group if it is empty which it can be from the code above if the scale_group metadata is not set","commit_id":"c222434db837a6f4a8e05cc9cad3f4fb26831c29"},{"author":{"_account_id":10487,"name":"Kanagaraj Manickam","email":"mkr1481@gmail.com","username":"kanagarajm"},"change_message_id":"45b139752b9bfd87cae381731d27a769a8e09cdc","unresolved":false,"context_lines":[{"line_number":322,"context_line":"                dims_customer[\u0027resource_id\u0027] \u003d instance_cache.get(inst_name)[\u0027instance_uuid\u0027]"},{"line_number":323,"context_line":"                dims_customer[\u0027zone\u0027] \u003d instance_cache.get(inst_name)[\u0027zone\u0027]"},{"line_number":324,"context_line":"                dims_customer[\u0027scale_group\u0027] \u003d instance_cache.get("},{"line_number":325,"context_line":"                    inst_name)[\u0027scale_group\u0027]"},{"line_number":326,"context_line":"                # Add dimensions that would be helpful for operations"},{"line_number":327,"context_line":"                dims_operations \u003d dims_customer.copy()"},{"line_number":328,"context_line":"                dims_operations[\u0027tenant_id\u0027] \u003d instance_cache.get(inst_name)[\u0027tenant_id\u0027]"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a2fa921_c705457a","line":325,"updated":"2015-10-08 17:05:59.000000000","message":"one question, should we add scale_group in both places here ?","commit_id":"1200177699852df6799277bf596e184f9951f071"},{"author":{"_account_id":2419,"name":"Roland Hochmuth","email":"roland.hochmuth@hpe.com","username":"roland-hochmuth-s"},"change_message_id":"190c30bb837002b1e885cc983ac662e68d91337a","unresolved":false,"context_lines":[{"line_number":90,"context_line":"                                   \u0027disk\u0027: inst_flavor.disk,"},{"line_number":91,"context_line":"                                   \u0027scale_group\u0027: nova_client.servers.get("},{"line_number":92,"context_line":"                                       instance.id).metadata.get("},{"line_number":93,"context_line":"                                       \u0027scale_group\u0027) or \u0027\u0027}"},{"line_number":94,"context_line":"            # Try to add private_ip to id_cache[inst_name].  This may fail on ERROR\u0027ed VMs."},{"line_number":95,"context_line":"            try:"},{"line_number":96,"context_line":"                id_cache[inst_name][\u0027private_ip\u0027] \u003d instance.addresses[\u0027private\u0027][0][\u0027addr\u0027]"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a2ca52d_8709bbdf","line":93,"updated":"2015-10-15 14:23:01.000000000","message":"Sorry I didn\u0027t see this sooner, but I\u0027ve reviewed this again and will have to modify to a -1. I had originally +1\u0027d. \n\nThe code will functionally work. However, it will introduce performance problems as the cache isn\u0027t being used correctly.\n\nIf you look at the way flavor\u0027s are retrieved, the cache is first checked. If the value is in the cache it is used. If it isn\u0027t, then the nova client is used to get the flavor and store it in the cache.\n\nWe need to do the same thing with meta data. If it doesn\u0027t exist, get it and add to the cache. If it does exist, then get the value from the cache. \n\nThe problem the way the code is written is that it will query nova for every instance which we know will cause problems in the system. The Agent collection time will take a long time. We will hit the nova API a lot.\n\nYou should replicate the code above for inst_flavor above, for meta data.","commit_id":"e6afd7e9221b08dbffb68149fa6b0bc8ac0583ee"},{"author":{"_account_id":12809,"name":"Sripadwallabha Dattatraya Kollur","email":"sripadwallabha.d.kollur@hp.com","username":"sripadwallabha-d-kollur"},"change_message_id":"77410ea7b261229bc4058c4d7c5212cb6a0dacd9","unresolved":false,"context_lines":[{"line_number":90,"context_line":"                                   \u0027disk\u0027: inst_flavor.disk,"},{"line_number":91,"context_line":"                                   \u0027scale_group\u0027: nova_client.servers.get("},{"line_number":92,"context_line":"                                       instance.id).metadata.get("},{"line_number":93,"context_line":"                                       \u0027scale_group\u0027) or \u0027\u0027}"},{"line_number":94,"context_line":"            # Try to add private_ip to id_cache[inst_name].  This may fail on ERROR\u0027ed VMs."},{"line_number":95,"context_line":"            try:"},{"line_number":96,"context_line":"                id_cache[inst_name][\u0027private_ip\u0027] \u003d instance.addresses[\u0027private\u0027][0][\u0027addr\u0027]"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a2ca52d_4b414e37","line":93,"in_reply_to":"5a2ca52d_8709bbdf","updated":"2015-10-16 03:20:43.000000000","message":"Every VM has an associated flavor and each flavor is uniquely identified by its \u0027id\u0027, It is possible that more than one VM might have same associated flavor. The flavor_cache is used for storing all unique flavors so that we can avoid calling nova_client.flavors.get(flavor_id) for every VM to query its flavor details.\n\nWe can\u0027t do same optimization with VM metadata. the nova_client.servers.list() method does not return any information about VM metadata. we have to call nova_client.servers.get(instance.id).metadata.get(\u0027scale_group\u0027) to fetch its scale_group metadata. If nova_client.servers.list() method returns metadata of VM then we can optimze this code as you suggested, but it is not the case.\n\nAlso _update_instance_cache() is not called for every polling interval unless cache does not exist or it is corrupt or new instance got added after last polling interval. So this patch won\u0027t cause performance issue unless VMs are created every polling interval, which I think is not a usual case.","commit_id":"e6afd7e9221b08dbffb68149fa6b0bc8ac0583ee"}]}
