)]}'
{"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":"afe61c327d44fdb4886f84e25faa26875f055cf1","unresolved":false,"context_lines":[{"line_number":40,"context_line":"                                                    \u0027libvirt_instances.yaml\u0027)"},{"line_number":41,"context_line":"        self.metric_cache_file \u003d \"{0}/{1}\".format(self.init_config.get(\u0027cache_dir\u0027),"},{"line_number":42,"context_line":"                                                  \u0027libvirt_metrics.yaml\u0027)"},{"line_number":43,"context_line":"        self._update_instance_cache()"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    def _test_vm_probation(self, created):"},{"line_number":46,"context_line":"        \"\"\"Test to see if a VM was created within the probation period."}],"source_content_type":"text/x-python","patch_set":4,"id":"fa80f949_88da0b4b","line":43,"updated":"2015-11-05 23:42:44.000000000","message":"Maybe this should do a _load_instance_cache() instead of a _update_instance_cache()? The most common case should be that the cache is current. It seems pretty drastic to rebuild on every restart","commit_id":"54ef8a1ea23dfb027830caf8f1e8285e08a21e47"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"203ee02efde6ebe428a6429275cb232110cb2842","unresolved":false,"context_lines":[{"line_number":40,"context_line":"                                                    \u0027libvirt_instances.yaml\u0027)"},{"line_number":41,"context_line":"        self.metric_cache_file \u003d \"{0}/{1}\".format(self.init_config.get(\u0027cache_dir\u0027),"},{"line_number":42,"context_line":"                                                  \u0027libvirt_metrics.yaml\u0027)"},{"line_number":43,"context_line":"        self._update_instance_cache()"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    def _test_vm_probation(self, created):"},{"line_number":46,"context_line":"        \"\"\"Test to see if a VM was created within the probation period."}],"source_content_type":"text/x-python","patch_set":4,"id":"fa80f949_ab1b4972","line":43,"in_reply_to":"fa80f949_08261b15","updated":"2015-11-06 00:03:40.000000000","message":"The agent gets restarted for every plugin that gets configured and when things like host alive checks get configured.But maybe that isn\u0027t a big deal. Let\u0027s see what other people\u0027s opinions are.","commit_id":"54ef8a1ea23dfb027830caf8f1e8285e08a21e47"},{"author":{"_account_id":11155,"name":"Ryan Bak","email":"ryan.bak@twcable.com","username":"ryanmbak"},"change_message_id":"9d26ade6a03bed27d4db36d28fdb1cbf1e4165ef","unresolved":false,"context_lines":[{"line_number":40,"context_line":"                                                    \u0027libvirt_instances.yaml\u0027)"},{"line_number":41,"context_line":"        self.metric_cache_file \u003d \"{0}/{1}\".format(self.init_config.get(\u0027cache_dir\u0027),"},{"line_number":42,"context_line":"                                                  \u0027libvirt_metrics.yaml\u0027)"},{"line_number":43,"context_line":"        self._update_instance_cache()"},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"    def _test_vm_probation(self, created):"},{"line_number":46,"context_line":"        \"\"\"Test to see if a VM was created within the probation period."}],"source_content_type":"text/x-python","patch_set":4,"id":"fa80f949_08261b15","line":43,"in_reply_to":"fa80f949_88da0b4b","updated":"2015-11-05 23:51:53.000000000","message":"This was a preventative measure, to avoid hitting the errors that can be cause by calling _load_instance_cache.   It might be alright to leave this line out, but there\u0027s no need to call _load_instance_cache in it\u0027s place since the check will already load when it runs.  That said I wouldn\u0027t except frequent restarts, so I don\u0027t think this would have much of an impact.","commit_id":"54ef8a1ea23dfb027830caf8f1e8285e08a21e47"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"afe61c327d44fdb4886f84e25faa26875f055cf1","unresolved":false,"context_lines":[{"line_number":129,"context_line":"                    time_diff \u003d time.time() - instance_cache[\u0027last_update\u0027]"},{"line_number":130,"context_line":"                    if time_diff \u003e self.init_config.get(\u0027nova_refresh\u0027):"},{"line_number":131,"context_line":"                        self._update_instance_cache()"},{"line_number":132,"context_line":"        except (IOError, TypeError, ScannerError, ParserError):"},{"line_number":133,"context_line":"            # The file may not exist yet, or is corrupt.  Rebuild it now."},{"line_number":134,"context_line":"            self.log.warning(\"Instance cache missing or corrupt, rebuilding.\")"},{"line_number":135,"context_line":"            instance_cache \u003d self._update_instance_cache()"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa80f949_08205b47","line":132,"updated":"2015-11-05 23:42:44.000000000","message":"Maybe this should also delete the instance cache file since it is corrupt? That will prevent it from being reused if there is a problem building a new one","commit_id":"54ef8a1ea23dfb027830caf8f1e8285e08a21e47"},{"author":{"_account_id":11155,"name":"Ryan Bak","email":"ryan.bak@twcable.com","username":"ryanmbak"},"change_message_id":"9d26ade6a03bed27d4db36d28fdb1cbf1e4165ef","unresolved":false,"context_lines":[{"line_number":129,"context_line":"                    time_diff \u003d time.time() - instance_cache[\u0027last_update\u0027]"},{"line_number":130,"context_line":"                    if time_diff \u003e self.init_config.get(\u0027nova_refresh\u0027):"},{"line_number":131,"context_line":"                        self._update_instance_cache()"},{"line_number":132,"context_line":"        except (IOError, TypeError, ScannerError, ParserError):"},{"line_number":133,"context_line":"            # The file may not exist yet, or is corrupt.  Rebuild it now."},{"line_number":134,"context_line":"            self.log.warning(\"Instance cache missing or corrupt, rebuilding.\")"},{"line_number":135,"context_line":"            instance_cache \u003d self._update_instance_cache()"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa80f949_28975f3b","line":132,"in_reply_to":"fa80f949_08205b47","updated":"2015-11-05 23:51:53.000000000","message":"This calls _update_instance_cache which overwrites the current cache, so there shouldn\u0027t be any need to delete it first.","commit_id":"54ef8a1ea23dfb027830caf8f1e8285e08a21e47"},{"author":{"_account_id":11155,"name":"Ryan Bak","email":"ryan.bak@twcable.com","username":"ryanmbak"},"change_message_id":"4f8451bec003870723ac19ef2709fb7fd038ff16","unresolved":false,"context_lines":[{"line_number":129,"context_line":"                    time_diff \u003d time.time() - instance_cache[\u0027last_update\u0027]"},{"line_number":130,"context_line":"                    if time_diff \u003e self.init_config.get(\u0027nova_refresh\u0027):"},{"line_number":131,"context_line":"                        self._update_instance_cache()"},{"line_number":132,"context_line":"        except (IOError, TypeError, ScannerError, ParserError):"},{"line_number":133,"context_line":"            # The file may not exist yet, or is corrupt.  Rebuild it now."},{"line_number":134,"context_line":"            self.log.warning(\"Instance cache missing or corrupt, rebuilding.\")"},{"line_number":135,"context_line":"            instance_cache \u003d self._update_instance_cache()"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa80f949_04c90626","line":132,"in_reply_to":"fa80f949_0825bbbf","updated":"2015-11-06 15:36:53.000000000","message":"If this catches an exception, whether it deletes or not it still has a corrupt/empty cache and will continue to hit this error and try rebuilding until that\u0027s no longer the case.  If you have strong feelings about it I\u0027m happy to add a delete, I just don\u0027t see that it makes much of a difference.","commit_id":"54ef8a1ea23dfb027830caf8f1e8285e08a21e47"},{"author":{"_account_id":11809,"name":"Craig Bryant","email":"craig.bryant@hpe.com","username":"craig-bryant"},"change_message_id":"203ee02efde6ebe428a6429275cb232110cb2842","unresolved":false,"context_lines":[{"line_number":129,"context_line":"                    time_diff \u003d time.time() - instance_cache[\u0027last_update\u0027]"},{"line_number":130,"context_line":"                    if time_diff \u003e self.init_config.get(\u0027nova_refresh\u0027):"},{"line_number":131,"context_line":"                        self._update_instance_cache()"},{"line_number":132,"context_line":"        except (IOError, TypeError, ScannerError, ParserError):"},{"line_number":133,"context_line":"            # The file may not exist yet, or is corrupt.  Rebuild it now."},{"line_number":134,"context_line":"            self.log.warning(\"Instance cache missing or corrupt, rebuilding.\")"},{"line_number":135,"context_line":"            instance_cache \u003d self._update_instance_cache()"}],"source_content_type":"text/x-python","patch_set":4,"id":"fa80f949_0825bbbf","line":132,"in_reply_to":"fa80f949_28975f3b","updated":"2015-11-06 00:03:40.000000000","message":"Unless there is some problem rebuilding the cache.","commit_id":"54ef8a1ea23dfb027830caf8f1e8285e08a21e47"},{"author":{"_account_id":12443,"name":"David Schroeder","email":"openstack@a7n.net","username":"dschroeder"},"change_message_id":"88c544983049e30fae4d14bb2d0c102a3e613a05","unresolved":false,"context_lines":[{"line_number":153,"context_line":"            with open(self.metric_cache_file, \u0027r\u0027) as cache_yaml:"},{"line_number":154,"context_line":"                metric_cache \u003d yaml.safe_load(cache_yaml)"},{"line_number":155,"context_line":"            if self._is_cache_corrupt(metric_cache):"},{"line_number":156,"context_line":"                metric_cache \u003d {}"},{"line_number":157,"context_line":"        except IOError:"},{"line_number":158,"context_line":"            # The file may not exist yet."},{"line_number":159,"context_line":"            metric_cache \u003d {}"}],"source_content_type":"text/x-python","patch_set":4,"id":"da85f559_1744c518","line":156,"updated":"2015-11-11 18:27:32.000000000","message":"You would also need to catch TypeError, ScannerError, and ParserError exceptions here as well.  A corrupt metrics cache is more likely, given the larger file size over the instance cache.  I think it would make sense to include a self.log.warning() message that the metrics cache has been rebuilt, too.","commit_id":"54ef8a1ea23dfb027830caf8f1e8285e08a21e47"}]}
