)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":10343,"name":"Jim Rollenhagen","email":"jim@jimrollenhagen.com","username":"jimrollenhagen"},"change_message_id":"17c6d3b390e8f78cf76941910579508b62c7435c","unresolved":false,"context_lines":[{"line_number":9,"context_line":"This commit moves the cleanup code of ImageCache to a"},{"line_number":10,"context_line":"common place in image_cache.py so that it can be accessed"},{"line_number":11,"context_line":"from anywhere in the ironic source tree outside pxe driver."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Implements: blueprint cleanup-all-imagecaches"},{"line_number":14,"context_line":"Change-Id: Idb54cee6cc1eee4f52ff07f8ca6e1f83378b2296"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"baada198_802bba31","line":12,"updated":"2014-08-04 16:22:13.000000000","message":"I\u0027d like to see notes here about the new cleanup decorator etc.","commit_id":"363fd4aa51bb2799c6d4ee185176c22e3e5814b8"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"32f0275d4957d562d1c9a5fe72d3ece7393be071","unresolved":false,"context_lines":[{"line_number":9,"context_line":"This commit moves the cleanup code of ImageCache to a"},{"line_number":10,"context_line":"common place in image_cache.py so that it can be accessed"},{"line_number":11,"context_line":"from anywhere in the ironic source tree outside pxe driver."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Implements: blueprint cleanup-all-imagecaches"},{"line_number":14,"context_line":"Change-Id: Idb54cee6cc1eee4f52ff07f8ca6e1f83378b2296"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"baada198_8603d274","line":12,"in_reply_to":"baada198_802bba31","updated":"2014-08-05 16:42:21.000000000","message":"Done","commit_id":"363fd4aa51bb2799c6d4ee185176c22e3e5814b8"}],"ironic/drivers/modules/agent.py":[{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"0cfdf1d96a2b210dda91bc0f7955047060ec63a5","unresolved":false,"context_lines":[{"line_number":116,"context_line":"        node.save(task.context)"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"@image_cache.cleanup(priority\u003d50)"},{"line_number":120,"context_line":"class AgentTFTPImageCache(image_cache.ImageCache):"},{"line_number":121,"context_line":"    def __init__(self, image_service\u003dNone):"},{"line_number":122,"context_line":"        super(AgentTFTPImageCache, self).__init__("}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_d65cbcf2","line":119,"updated":"2014-08-11 12:03:02.000000000","message":"should be ~25, as it\u0027s TFTP","commit_id":"d7d08e619ee2c495d2fad76706f21bd4e1e7a857"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"58a516b24ca9f84c25c00507afea228b1453efb6","unresolved":false,"context_lines":[{"line_number":116,"context_line":"        node.save(task.context)"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":""},{"line_number":119,"context_line":"@image_cache.cleanup(priority\u003d50)"},{"line_number":120,"context_line":"class AgentTFTPImageCache(image_cache.ImageCache):"},{"line_number":121,"context_line":"    def __init__(self, image_service\u003dNone):"},{"line_number":122,"context_line":"        super(AgentTFTPImageCache, self).__init__("}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_825754f4","line":119,"in_reply_to":"baada198_d65cbcf2","updated":"2014-08-11 17:50:56.000000000","message":"Done","commit_id":"d7d08e619ee2c495d2fad76706f21bd4e1e7a857"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"dce0d2e7f611b31a6e61388972bdfa8099982752","unresolved":false,"context_lines":[{"line_number":141,"context_line":"    try:"},{"line_number":142,"context_line":"        image_cache.clean_up_caches(ctx, cache.master_dir, images_info)"},{"line_number":143,"context_line":"    except exception.InsufficientDiskSpace as e:"},{"line_number":144,"context_line":"        raise exception.InstanceDeployFailure(reason\u003dstr(e))"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"    # NOTE(dtantsur): This code can suffer from race condition,"},{"line_number":147,"context_line":"    # if disk space is used between the check and actual download."}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_bef53385","line":144,"updated":"2014-08-12 12:09:48.000000000","message":"nit: str() call is redundant","commit_id":"12a088512098652ec862543fdf4a36d356bda583"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"2eb263f12d63c8fe0cf329ca3e2f1d0b7fdb7d12","unresolved":false,"context_lines":[{"line_number":141,"context_line":"    try:"},{"line_number":142,"context_line":"        image_cache.clean_up_caches(ctx, cache.master_dir, images_info)"},{"line_number":143,"context_line":"    except exception.InsufficientDiskSpace as e:"},{"line_number":144,"context_line":"        raise exception.InstanceDeployFailure(reason\u003dstr(e))"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"    # NOTE(dtantsur): This code can suffer from race condition,"},{"line_number":147,"context_line":"    # if disk space is used between the check and actual download."}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_12128e54","line":144,"in_reply_to":"baada198_bef53385","updated":"2014-08-12 13:43:01.000000000","message":"Done","commit_id":"12a088512098652ec862543fdf4a36d356bda583"}],"ironic/drivers/modules/image_cache.py":[{"author":{"_account_id":10343,"name":"Jim Rollenhagen","email":"jim@jimrollenhagen.com","username":"jimrollenhagen"},"change_message_id":"17c6d3b390e8f78cf76941910579508b62c7435c","unresolved":false,"context_lines":[{"line_number":294,"context_line":"    :param ctx: context"},{"line_number":295,"context_line":"    :param cache: an instance of ImageCache() which is to be cleaned"},{"line_number":296,"context_line":"    :param images_info: a dict of image uuid-\u003epath to be downloaded"},{"line_number":297,"context_line":"    :returns: Nothing."},{"line_number":298,"context_line":"    \"\"\""},{"line_number":299,"context_line":"    total_size \u003d sum(images.download_size(ctx, uuid)"},{"line_number":300,"context_line":"                     for (uuid, path) in images_info)"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_a02efe3f","line":297,"updated":"2014-08-04 16:22:13.000000000","message":"I think this \"returns\" line can be removed, but not 100% sure what the convention is here.","commit_id":"363fd4aa51bb2799c6d4ee185176c22e3e5814b8"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"32f0275d4957d562d1c9a5fe72d3ece7393be071","unresolved":false,"context_lines":[{"line_number":294,"context_line":"    :param ctx: context"},{"line_number":295,"context_line":"    :param cache: an instance of ImageCache() which is to be cleaned"},{"line_number":296,"context_line":"    :param images_info: a dict of image uuid-\u003epath to be downloaded"},{"line_number":297,"context_line":"    :returns: Nothing."},{"line_number":298,"context_line":"    \"\"\""},{"line_number":299,"context_line":"    total_size \u003d sum(images.download_size(ctx, uuid)"},{"line_number":300,"context_line":"                     for (uuid, path) in images_info)"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_26cbe64a","line":297,"in_reply_to":"baada198_a02efe3f","updated":"2014-08-05 16:42:21.000000000","message":"Done","commit_id":"363fd4aa51bb2799c6d4ee185176c22e3e5814b8"},{"author":{"_account_id":10343,"name":"Jim Rollenhagen","email":"jim@jimrollenhagen.com","username":"jimrollenhagen"},"change_message_id":"17c6d3b390e8f78cf76941910579508b62c7435c","unresolved":false,"context_lines":[{"line_number":304,"context_line":"        # NOTE(dtantsur): filter caches, whose directory is on the same device"},{"line_number":305,"context_line":"        st_dev \u003d os.stat(cache.master_dir).st_dev"},{"line_number":306,"context_line":""},{"line_number":307,"context_line":"        caches_to_clean \u003d map(lambda x: x(), cache_cleanup_list)"},{"line_number":308,"context_line":"        caches \u003d [c for c in caches_to_clean"},{"line_number":309,"context_line":"                  if os.stat(c.master_dir).st_dev \u003d\u003d st_dev]"},{"line_number":310,"context_line":"        for cache_to_clean in caches:"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_c0213250","line":307,"updated":"2014-08-04 16:22:13.000000000","message":"Is this meant to use the _caches_to_clean method defined above? :)","commit_id":"363fd4aa51bb2799c6d4ee185176c22e3e5814b8"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"32f0275d4957d562d1c9a5fe72d3ece7393be071","unresolved":false,"context_lines":[{"line_number":304,"context_line":"        # NOTE(dtantsur): filter caches, whose directory is on the same device"},{"line_number":305,"context_line":"        st_dev \u003d os.stat(cache.master_dir).st_dev"},{"line_number":306,"context_line":""},{"line_number":307,"context_line":"        caches_to_clean \u003d map(lambda x: x(), cache_cleanup_list)"},{"line_number":308,"context_line":"        caches \u003d [c for c in caches_to_clean"},{"line_number":309,"context_line":"                  if os.stat(c.master_dir).st_dev \u003d\u003d st_dev]"},{"line_number":310,"context_line":"        for cache_to_clean in caches:"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_e6972e37","line":307,"in_reply_to":"baada198_c0213250","updated":"2014-08-05 16:42:21.000000000","message":"Done.  Thanks, I forgot to remove the function after realizing it is only 1 line.","commit_id":"363fd4aa51bb2799c6d4ee185176c22e3e5814b8"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"b5ba41756f2b51ecc83e542a467a23b17d3a1bfb","unresolved":false,"context_lines":[{"line_number":45,"context_line":"CONF \u003d cfg.CONF"},{"line_number":46,"context_line":"CONF.register_opts(img_cache_opts)"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"cache_cleanup_list \u003d []"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"class ImageCache(object):"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_479a26c5","line":48,"updated":"2014-08-07 08:50:09.000000000","message":"this should be private, i.e. begin with _","commit_id":"425705ed12079ab521f6504f0453c8985da60b4d"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"6909a309457cc215a2ee65c5e850ed2d2799d50c","unresolved":false,"context_lines":[{"line_number":45,"context_line":"CONF \u003d cfg.CONF"},{"line_number":46,"context_line":"CONF.register_opts(img_cache_opts)"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"cache_cleanup_list \u003d []"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"class ImageCache(object):"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_9956625d","line":48,"in_reply_to":"baada198_479a26c5","updated":"2014-08-08 08:54:40.000000000","message":"Done","commit_id":"425705ed12079ab521f6504f0453c8985da60b4d"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"b5ba41756f2b51ecc83e542a467a23b17d3a1bfb","unresolved":false,"context_lines":[{"line_number":288,"context_line":"    see if enough space can be freed."},{"line_number":289,"context_line":""},{"line_number":290,"context_line":"    :param ctx: context"},{"line_number":291,"context_line":"    :param cache: an instance of ImageCache() which is to be cleaned"},{"line_number":292,"context_line":"    :param images_info: a dict of image uuid-\u003epath to be downloaded"},{"line_number":293,"context_line":"    :returns: Nothing."},{"line_number":294,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_275a92f5","line":291,"updated":"2014-08-07 08:50:09.000000000","message":"I just realized, that you don\u0027t need a cache in this function, only it\u0027s master_dir. Maybe it\u0027s better to pass only it?","commit_id":"425705ed12079ab521f6504f0453c8985da60b4d"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"6909a309457cc215a2ee65c5e850ed2d2799d50c","unresolved":false,"context_lines":[{"line_number":288,"context_line":"    see if enough space can be freed."},{"line_number":289,"context_line":""},{"line_number":290,"context_line":"    :param ctx: context"},{"line_number":291,"context_line":"    :param cache: an instance of ImageCache() which is to be cleaned"},{"line_number":292,"context_line":"    :param images_info: a dict of image uuid-\u003epath to be downloaded"},{"line_number":293,"context_line":"    :returns: Nothing."},{"line_number":294,"context_line":"    \"\"\""}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_b9b5e67e","line":291,"in_reply_to":"baada198_275a92f5","updated":"2014-08-08 08:54:40.000000000","message":"Done","commit_id":"425705ed12079ab521f6504f0453c8985da60b4d"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"b5ba41756f2b51ecc83e542a467a23b17d3a1bfb","unresolved":false,"context_lines":[{"line_number":289,"context_line":""},{"line_number":290,"context_line":"    :param ctx: context"},{"line_number":291,"context_line":"    :param cache: an instance of ImageCache() which is to be cleaned"},{"line_number":292,"context_line":"    :param images_info: a dict of image uuid-\u003epath to be downloaded"},{"line_number":293,"context_line":"    :returns: Nothing."},{"line_number":294,"context_line":"    \"\"\""},{"line_number":295,"context_line":"    total_size \u003d sum(images.download_size(ctx, uuid)"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_07b02e3f","line":292,"updated":"2014-08-07 08:50:09.000000000","message":"\"to be downloaded\" this function does not download anything","commit_id":"425705ed12079ab521f6504f0453c8985da60b4d"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"6909a309457cc215a2ee65c5e850ed2d2799d50c","unresolved":false,"context_lines":[{"line_number":289,"context_line":""},{"line_number":290,"context_line":"    :param ctx: context"},{"line_number":291,"context_line":"    :param cache: an instance of ImageCache() which is to be cleaned"},{"line_number":292,"context_line":"    :param images_info: a dict of image uuid-\u003epath to be downloaded"},{"line_number":293,"context_line":"    :returns: Nothing."},{"line_number":294,"context_line":"    \"\"\""},{"line_number":295,"context_line":"    total_size \u003d sum(images.download_size(ctx, uuid)"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_7917ce53","line":292,"in_reply_to":"baada198_07b02e3f","updated":"2014-08-08 08:54:40.000000000","message":"Done","commit_id":"425705ed12079ab521f6504f0453c8985da60b4d"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"b5ba41756f2b51ecc83e542a467a23b17d3a1bfb","unresolved":false,"context_lines":[{"line_number":300,"context_line":"        # NOTE(dtantsur): filter caches, whose directory is on the same device"},{"line_number":301,"context_line":"        st_dev \u003d os.stat(cache.master_dir).st_dev"},{"line_number":302,"context_line":""},{"line_number":303,"context_line":"        caches_to_clean \u003d map(lambda x: x(), cache_cleanup_list)"},{"line_number":304,"context_line":"        caches \u003d [c for c in caches_to_clean"},{"line_number":305,"context_line":"                  if os.stat(c.master_dir).st_dev \u003d\u003d st_dev]"},{"line_number":306,"context_line":"        for cache_to_clean in caches:"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_4704e6c4","line":303,"updated":"2014-08-07 08:50:09.000000000","message":"pythonic nit:\n\n [x() for x in cache_cleanup_list]\n\nlooks more natural to me. Even better would be to avoid lists at all and convert both to generator expressions:\n\n caches_to_clean \u003d (x() for x in cache_cleanup_list)\n caches \u003d (c for c in caches_to_clean ...)\n\nas it\u0027s possible to break early here.","commit_id":"425705ed12079ab521f6504f0453c8985da60b4d"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"6abbdfc49ddf3b194b29dc25d60d4c8bfcadd172","unresolved":false,"context_lines":[{"line_number":300,"context_line":"        # NOTE(dtantsur): filter caches, whose directory is on the same device"},{"line_number":301,"context_line":"        st_dev \u003d os.stat(cache.master_dir).st_dev"},{"line_number":302,"context_line":""},{"line_number":303,"context_line":"        caches_to_clean \u003d map(lambda x: x(), cache_cleanup_list)"},{"line_number":304,"context_line":"        caches \u003d [c for c in caches_to_clean"},{"line_number":305,"context_line":"                  if os.stat(c.master_dir).st_dev \u003d\u003d st_dev]"},{"line_number":306,"context_line":"        for cache_to_clean in caches:"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_ec665a54","line":303,"in_reply_to":"baada198_2b0dd535","updated":"2014-08-11 09:58:51.000000000","message":"After working on the code, I felt there is not much use in converting L303 to generator expression because it would be completely iterated for sure on L304.  I am just keeping it as list and will get your thoughts on it.","commit_id":"425705ed12079ab521f6504f0453c8985da60b4d"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"6909a309457cc215a2ee65c5e850ed2d2799d50c","unresolved":false,"context_lines":[{"line_number":300,"context_line":"        # NOTE(dtantsur): filter caches, whose directory is on the same device"},{"line_number":301,"context_line":"        st_dev \u003d os.stat(cache.master_dir).st_dev"},{"line_number":302,"context_line":""},{"line_number":303,"context_line":"        caches_to_clean \u003d map(lambda x: x(), cache_cleanup_list)"},{"line_number":304,"context_line":"        caches \u003d [c for c in caches_to_clean"},{"line_number":305,"context_line":"                  if os.stat(c.master_dir).st_dev \u003d\u003d st_dev]"},{"line_number":306,"context_line":"        for cache_to_clean in caches:"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_2b0dd535","line":303,"in_reply_to":"baada198_4704e6c4","updated":"2014-08-08 08:54:40.000000000","message":"Done","commit_id":"425705ed12079ab521f6504f0453c8985da60b4d"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"b5ba41756f2b51ecc83e542a467a23b17d3a1bfb","unresolved":false,"context_lines":[{"line_number":314,"context_line":"            msg \u003d _(\"Disk volume where \u0027%(path)s\u0027 is located doesn\u0027t have \""},{"line_number":315,"context_line":"                    \"enough disk space. Required %(required)d MiB, \""},{"line_number":316,"context_line":"                    \"only %(actual)d MiB available space present.\")"},{"line_number":317,"context_line":"            raise exception.InstanceDeployFailure(reason\u003dmsg % {"},{"line_number":318,"context_line":"                \u0027path\u0027: cache.master_dir,"},{"line_number":319,"context_line":"                \u0027required\u0027: total_size / 1024 / 1024,"},{"line_number":320,"context_line":"                \u0027actual\u0027: free / 1024 / 1024"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_a7d86281","line":317,"updated":"2014-08-07 08:50:09.000000000","message":"I\u0027m not sure, if exception should still be InstanceDeployFailure, as it\u0027s generic code now (imagine it will be called from periodic callback). Probably it should be something specific and be converted to InstanceDeployFailure later.","commit_id":"425705ed12079ab521f6504f0453c8985da60b4d"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"6909a309457cc215a2ee65c5e850ed2d2799d50c","unresolved":false,"context_lines":[{"line_number":314,"context_line":"            msg \u003d _(\"Disk volume where \u0027%(path)s\u0027 is located doesn\u0027t have \""},{"line_number":315,"context_line":"                    \"enough disk space. Required %(required)d MiB, \""},{"line_number":316,"context_line":"                    \"only %(actual)d MiB available space present.\")"},{"line_number":317,"context_line":"            raise exception.InstanceDeployFailure(reason\u003dmsg % {"},{"line_number":318,"context_line":"                \u0027path\u0027: cache.master_dir,"},{"line_number":319,"context_line":"                \u0027required\u0027: total_size / 1024 / 1024,"},{"line_number":320,"context_line":"                \u0027actual\u0027: free / 1024 / 1024"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_6b134d59","line":317,"in_reply_to":"baada198_a7d86281","updated":"2014-08-08 08:54:40.000000000","message":"Done","commit_id":"425705ed12079ab521f6504f0453c8985da60b4d"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"b5ba41756f2b51ecc83e542a467a23b17d3a1bfb","unresolved":false,"context_lines":[{"line_number":324,"context_line":"def cleanup(priority):"},{"line_number":325,"context_line":"    \"\"\"Decorator method for adding cleanup priority to a class.\"\"\""},{"line_number":326,"context_line":"    def _add_property_to_class_func(cls):"},{"line_number":327,"context_line":"        cls.cleanup_priority \u003d priority"},{"line_number":328,"context_line":"        cache_cleanup_list.append(cls)"},{"line_number":329,"context_line":"        cache_cleanup_list.sort(key\u003dlambda x: x.cleanup_priority)"},{"line_number":330,"context_line":"        return cls"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_87b35e08","line":327,"updated":"2014-08-07 08:50:09.000000000","message":"not sure, but to avoid creating new attribute on unknown classes, you can store tuples (priority, class):\n\n cache_cleanup_list.append((priority, cls))\n cache_cleanup_list.sort(reverse\u003dTrue)\n\n(no need for key in sort due to how tuples are compared)","commit_id":"425705ed12079ab521f6504f0453c8985da60b4d"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"6909a309457cc215a2ee65c5e850ed2d2799d50c","unresolved":false,"context_lines":[{"line_number":324,"context_line":"def cleanup(priority):"},{"line_number":325,"context_line":"    \"\"\"Decorator method for adding cleanup priority to a class.\"\"\""},{"line_number":326,"context_line":"    def _add_property_to_class_func(cls):"},{"line_number":327,"context_line":"        cls.cleanup_priority \u003d priority"},{"line_number":328,"context_line":"        cache_cleanup_list.append(cls)"},{"line_number":329,"context_line":"        cache_cleanup_list.sort(key\u003dlambda x: x.cleanup_priority)"},{"line_number":330,"context_line":"        return cls"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_3cf3846e","line":327,"in_reply_to":"baada198_87b35e08","updated":"2014-08-08 08:54:40.000000000","message":"Done","commit_id":"425705ed12079ab521f6504f0453c8985da60b4d"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"b5ba41756f2b51ecc83e542a467a23b17d3a1bfb","unresolved":false,"context_lines":[{"line_number":326,"context_line":"    def _add_property_to_class_func(cls):"},{"line_number":327,"context_line":"        cls.cleanup_priority \u003d priority"},{"line_number":328,"context_line":"        cache_cleanup_list.append(cls)"},{"line_number":329,"context_line":"        cache_cleanup_list.sort(key\u003dlambda x: x.cleanup_priority)"},{"line_number":330,"context_line":"        return cls"},{"line_number":331,"context_line":""},{"line_number":332,"context_line":"    return _add_property_to_class_func"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_e79a5a6e","line":329,"updated":"2014-08-07 08:50:09.000000000","message":"also we decided, that classes with higher priority will be cleaned first (hence word \u0027priority\u0027), that means sorting in reverse order.","commit_id":"425705ed12079ab521f6504f0453c8985da60b4d"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"6909a309457cc215a2ee65c5e850ed2d2799d50c","unresolved":false,"context_lines":[{"line_number":326,"context_line":"    def _add_property_to_class_func(cls):"},{"line_number":327,"context_line":"        cls.cleanup_priority \u003d priority"},{"line_number":328,"context_line":"        cache_cleanup_list.append(cls)"},{"line_number":329,"context_line":"        cache_cleanup_list.sort(key\u003dlambda x: x.cleanup_priority)"},{"line_number":330,"context_line":"        return cls"},{"line_number":331,"context_line":""},{"line_number":332,"context_line":"    return _add_property_to_class_func"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_2fa1883a","line":329,"in_reply_to":"baada198_e79a5a6e","updated":"2014-08-08 08:54:40.000000000","message":"Done","commit_id":"425705ed12079ab521f6504f0453c8985da60b4d"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"0cfdf1d96a2b210dda91bc0f7955047060ec63a5","unresolved":false,"context_lines":[{"line_number":280,"context_line":""},{"line_number":281,"context_line":""},{"line_number":282,"context_line":"def clean_up_caches(ctx, directory, images_info):"},{"line_number":283,"context_line":"    \"\"\"Explicitly cleanup a cache and other caches(if required)."},{"line_number":284,"context_line":""},{"line_number":285,"context_line":"    This method allows cleanup a particular cache to free up the amount of"},{"line_number":286,"context_line":"    space required for the images in images_info. If enough space can\u0027t be"}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_96b88413","line":283,"updated":"2014-08-11 12:03:02.000000000","message":"nit: need space before (","commit_id":"d7d08e619ee2c495d2fad76706f21bd4e1e7a857"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"58a516b24ca9f84c25c00507afea228b1453efb6","unresolved":false,"context_lines":[{"line_number":280,"context_line":""},{"line_number":281,"context_line":""},{"line_number":282,"context_line":"def clean_up_caches(ctx, directory, images_info):"},{"line_number":283,"context_line":"    \"\"\"Explicitly cleanup a cache and other caches(if required)."},{"line_number":284,"context_line":""},{"line_number":285,"context_line":"    This method allows cleanup a particular cache to free up the amount of"},{"line_number":286,"context_line":"    space required for the images in images_info. If enough space can\u0027t be"}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_62b3204e","line":283,"in_reply_to":"baada198_96b88413","updated":"2014-08-11 17:50:56.000000000","message":"Done","commit_id":"d7d08e619ee2c495d2fad76706f21bd4e1e7a857"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"0cfdf1d96a2b210dda91bc0f7955047060ec63a5","unresolved":false,"context_lines":[{"line_number":285,"context_line":"    This method allows cleanup a particular cache to free up the amount of"},{"line_number":286,"context_line":"    space required for the images in images_info. If enough space can\u0027t be"},{"line_number":287,"context_line":"    freed in this cache, then all subclasses of ImageCache are searched to"},{"line_number":288,"context_line":"    see if enough space can be freed."},{"line_number":289,"context_line":""},{"line_number":290,"context_line":"    :param ctx: context"},{"line_number":291,"context_line":"    :param directory: the directory(of the cache) to be freed up."}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_56c26c86","line":288,"updated":"2014-08-11 12:03:02.000000000","message":"This paragraph is no longer correct. The procedure does not start with given cache, it start with high-priority cache. I suggest putting short explanation from the approved spec here on how this clean up works.","commit_id":"d7d08e619ee2c495d2fad76706f21bd4e1e7a857"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"58a516b24ca9f84c25c00507afea228b1453efb6","unresolved":false,"context_lines":[{"line_number":285,"context_line":"    This method allows cleanup a particular cache to free up the amount of"},{"line_number":286,"context_line":"    space required for the images in images_info. If enough space can\u0027t be"},{"line_number":287,"context_line":"    freed in this cache, then all subclasses of ImageCache are searched to"},{"line_number":288,"context_line":"    see if enough space can be freed."},{"line_number":289,"context_line":""},{"line_number":290,"context_line":"    :param ctx: context"},{"line_number":291,"context_line":"    :param directory: the directory(of the cache) to be freed up."}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_82ae74e2","line":288,"in_reply_to":"baada198_56c26c86","updated":"2014-08-11 17:50:56.000000000","message":"Done","commit_id":"d7d08e619ee2c495d2fad76706f21bd4e1e7a857"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"0cfdf1d96a2b210dda91bc0f7955047060ec63a5","unresolved":false,"context_lines":[{"line_number":288,"context_line":"    see if enough space can be freed."},{"line_number":289,"context_line":""},{"line_number":290,"context_line":"    :param ctx: context"},{"line_number":291,"context_line":"    :param directory: the directory(of the cache) to be freed up."},{"line_number":292,"context_line":"    :param images_info: a list of tuples of the form (image_uuid,path)"},{"line_number":293,"context_line":"        for which space is to be created in cache."},{"line_number":294,"context_line":"    :returns: Nothing."}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_16ee3421","line":291,"updated":"2014-08-11 12:03:02.000000000","message":"nit: need space before (","commit_id":"d7d08e619ee2c495d2fad76706f21bd4e1e7a857"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"58a516b24ca9f84c25c00507afea228b1453efb6","unresolved":false,"context_lines":[{"line_number":288,"context_line":"    see if enough space can be freed."},{"line_number":289,"context_line":""},{"line_number":290,"context_line":"    :param ctx: context"},{"line_number":291,"context_line":"    :param directory: the directory(of the cache) to be freed up."},{"line_number":292,"context_line":"    :param images_info: a list of tuples of the form (image_uuid,path)"},{"line_number":293,"context_line":"        for which space is to be created in cache."},{"line_number":294,"context_line":"    :returns: Nothing."}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_c2830c53","line":291,"in_reply_to":"baada198_16ee3421","updated":"2014-08-11 17:50:56.000000000","message":"Done","commit_id":"d7d08e619ee2c495d2fad76706f21bd4e1e7a857"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"ada8a83a44c62d8b964971b56ee5365f56925690","unresolved":false,"context_lines":[{"line_number":45,"context_line":"CONF \u003d cfg.CONF"},{"line_number":46,"context_line":"CONF.register_opts(img_cache_opts)"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"_cache_cleanup_list \u003d []"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"class ImageCache(object):"}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_28ce42b7","line":48,"updated":"2014-08-12 15:39:55.000000000","message":"Would be nice to add a comment about what this is, and what it contains.","commit_id":"dbd8e350b6c87a02d401a016674423ff9619e3bb"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"f3104d163a6960eace8d568ecea070fb264fdf6d","unresolved":false,"context_lines":[{"line_number":45,"context_line":"CONF \u003d cfg.CONF"},{"line_number":46,"context_line":"CONF.register_opts(img_cache_opts)"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"_cache_cleanup_list \u003d []"},{"line_number":49,"context_line":""},{"line_number":50,"context_line":""},{"line_number":51,"context_line":"class ImageCache(object):"}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_5e932c4d","line":48,"in_reply_to":"baada198_28ce42b7","updated":"2014-08-13 03:39:28.000000000","message":"Done","commit_id":"dbd8e350b6c87a02d401a016674423ff9619e3bb"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"ada8a83a44c62d8b964971b56ee5365f56925690","unresolved":false,"context_lines":[{"line_number":282,"context_line":"def clean_up_caches(ctx, directory, images_info):"},{"line_number":283,"context_line":"    \"\"\"Explicitly cleanup caches based on their priority (if required)."},{"line_number":284,"context_line":""},{"line_number":285,"context_line":"    This method allows to cleanup caches to free up the amount of space"},{"line_number":286,"context_line":"    required for the images in images_info. The caches are cleaned up one"},{"line_number":287,"context_line":"    after the other in the order of their priority.  If we still cannot free"},{"line_number":288,"context_line":"    up enough space after trying all the caches, this method throws exception."}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_484e166f","line":285,"updated":"2014-08-12 15:39:55.000000000","message":"how about \u0027This method allows to cleanup caches\u0027 -\u003e \u0027This cleans up the caches\u0027","commit_id":"dbd8e350b6c87a02d401a016674423ff9619e3bb"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"f3104d163a6960eace8d568ecea070fb264fdf6d","unresolved":false,"context_lines":[{"line_number":282,"context_line":"def clean_up_caches(ctx, directory, images_info):"},{"line_number":283,"context_line":"    \"\"\"Explicitly cleanup caches based on their priority (if required)."},{"line_number":284,"context_line":""},{"line_number":285,"context_line":"    This method allows to cleanup caches to free up the amount of space"},{"line_number":286,"context_line":"    required for the images in images_info. The caches are cleaned up one"},{"line_number":287,"context_line":"    after the other in the order of their priority.  If we still cannot free"},{"line_number":288,"context_line":"    up enough space after trying all the caches, this method throws exception."}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_9ecea459","line":285,"in_reply_to":"baada198_484e166f","updated":"2014-08-13 03:39:28.000000000","message":"Done","commit_id":"dbd8e350b6c87a02d401a016674423ff9619e3bb"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"ada8a83a44c62d8b964971b56ee5365f56925690","unresolved":false,"context_lines":[{"line_number":300,"context_line":""},{"line_number":301,"context_line":"    if total_size \u003e\u003d free:"},{"line_number":302,"context_line":"        # NOTE(dtantsur): filter caches, whose directory is on the same device"},{"line_number":303,"context_line":"        st_dev \u003d os.stat(dir).st_dev"},{"line_number":304,"context_line":""},{"line_number":305,"context_line":"        caches_to_clean \u003d [x[1]() for x in _cache_cleanup_list]"},{"line_number":306,"context_line":"        caches \u003d (c for c in caches_to_clean"}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_c5568f2a","line":303,"updated":"2014-08-12 15:39:55.000000000","message":"Where does \u0027dir\u0027 come from? Shouldn\u0027t that be \u0027directory\u0027?","commit_id":"dbd8e350b6c87a02d401a016674423ff9619e3bb"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"f3104d163a6960eace8d568ecea070fb264fdf6d","unresolved":false,"context_lines":[{"line_number":300,"context_line":""},{"line_number":301,"context_line":"    if total_size \u003e\u003d free:"},{"line_number":302,"context_line":"        # NOTE(dtantsur): filter caches, whose directory is on the same device"},{"line_number":303,"context_line":"        st_dev \u003d os.stat(dir).st_dev"},{"line_number":304,"context_line":""},{"line_number":305,"context_line":"        caches_to_clean \u003d [x[1]() for x in _cache_cleanup_list]"},{"line_number":306,"context_line":"        caches \u003d (c for c in caches_to_clean"}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_bef0c892","line":303,"in_reply_to":"baada198_c5568f2a","updated":"2014-08-13 03:39:28.000000000","message":"Thanks.  Big mistake.  Just noticed there were no test cases for it.  I will add them.","commit_id":"dbd8e350b6c87a02d401a016674423ff9619e3bb"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"cc4593cd0daccbf549a9ef8c0d4ea0d69e7cca5d","unresolved":false,"context_lines":[{"line_number":47,"context_line":""},{"line_number":48,"context_line":"# This would contain a sorted list of instances of ImageCache to be"},{"line_number":49,"context_line":"# considered for cleanup. This list will be kept sorted in non-increasing"},{"line_number":50,"context_line":"# order of priority."},{"line_number":51,"context_line":"_cache_cleanup_list \u003d []"},{"line_number":52,"context_line":""},{"line_number":53,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"baada198_c54c9978","line":50,"updated":"2014-08-13 14:01:40.000000000","message":"I was also looking for something like \u0027sorted list of tuples: (priority, ImageCache-instance)\u0027 ... Oh well.","commit_id":"1d522cc6a0c5a88d68e2e05781262b50c080047e"}],"ironic/drivers/modules/pxe.py":[{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"ada8a83a44c62d8b964971b56ee5365f56925690","unresolved":false,"context_lines":[{"line_number":313,"context_line":"    try:"},{"line_number":314,"context_line":"        image_cache.clean_up_caches(ctx, cache.master_dir, images_info)"},{"line_number":315,"context_line":"    except exception.InsufficientDiskSpace as e:"},{"line_number":316,"context_line":"        raise exception.InstanceDeployFailure(reason\u003dstr(e))"},{"line_number":317,"context_line":""},{"line_number":318,"context_line":"    # NOTE(dtantsur): This code can suffer from race condition,"},{"line_number":319,"context_line":"    # if disk space is used between the check and actual download."}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_88966e3b","line":316,"updated":"2014-08-12 15:39:55.000000000","message":"nit: you don\u0027t need str(e), just \u0027e\u0027 is fine.","commit_id":"dbd8e350b6c87a02d401a016674423ff9619e3bb"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"f3104d163a6960eace8d568ecea070fb264fdf6d","unresolved":false,"context_lines":[{"line_number":313,"context_line":"    try:"},{"line_number":314,"context_line":"        image_cache.clean_up_caches(ctx, cache.master_dir, images_info)"},{"line_number":315,"context_line":"    except exception.InsufficientDiskSpace as e:"},{"line_number":316,"context_line":"        raise exception.InstanceDeployFailure(reason\u003dstr(e))"},{"line_number":317,"context_line":""},{"line_number":318,"context_line":"    # NOTE(dtantsur): This code can suffer from race condition,"},{"line_number":319,"context_line":"    # if disk space is used between the check and actual download."}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_9e230405","line":316,"in_reply_to":"baada198_88966e3b","updated":"2014-08-13 03:39:28.000000000","message":"Done","commit_id":"dbd8e350b6c87a02d401a016674423ff9619e3bb"}],"ironic/tests/drivers/test_image_cache.py":[{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"b5ba41756f2b51ecc83e542a467a23b17d3a1bfb","unresolved":false,"context_lines":[{"line_number":285,"context_line":"        @image_cache.cleanup(priority\u003d1)"},{"line_number":286,"context_line":"        class Cache1(ParentCache):"},{"line_number":287,"context_line":"            def __init__(self):"},{"line_number":288,"context_line":"                super(Cache1, self).__init__()"},{"line_number":289,"context_line":""},{"line_number":290,"context_line":"        @image_cache.cleanup(priority\u003d2)"},{"line_number":291,"context_line":"        class Cache2(ParentCache):"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_e7717a46","line":288,"updated":"2014-08-07 08:50:09.000000000","message":"no need for __init__ that just call super","commit_id":"425705ed12079ab521f6504f0453c8985da60b4d"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"6909a309457cc215a2ee65c5e850ed2d2799d50c","unresolved":false,"context_lines":[{"line_number":285,"context_line":"        @image_cache.cleanup(priority\u003d1)"},{"line_number":286,"context_line":"        class Cache1(ParentCache):"},{"line_number":287,"context_line":"            def __init__(self):"},{"line_number":288,"context_line":"                super(Cache1, self).__init__()"},{"line_number":289,"context_line":""},{"line_number":290,"context_line":"        @image_cache.cleanup(priority\u003d2)"},{"line_number":291,"context_line":"        class Cache2(ParentCache):"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_cb19b977","line":288,"in_reply_to":"baada198_e7717a46","updated":"2014-08-08 08:54:40.000000000","message":"Done","commit_id":"425705ed12079ab521f6504f0453c8985da60b4d"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"b5ba41756f2b51ecc83e542a467a23b17d3a1bfb","unresolved":false,"context_lines":[{"line_number":290,"context_line":"        @image_cache.cleanup(priority\u003d2)"},{"line_number":291,"context_line":"        class Cache2(ParentCache):"},{"line_number":292,"context_line":"            def __init__(self):"},{"line_number":293,"context_line":"                super(Cache2, self).__init__()"},{"line_number":294,"context_line":""},{"line_number":295,"context_line":"        self.assertEqual(image_cache.cache_cleanup_list[0], Cache1)"},{"line_number":296,"context_line":"        self.assertEqual(image_cache.cache_cleanup_list[1], Cache2)"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_076d8e67","line":293,"updated":"2014-08-07 08:50:09.000000000","message":"ditto","commit_id":"425705ed12079ab521f6504f0453c8985da60b4d"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"6909a309457cc215a2ee65c5e850ed2d2799d50c","unresolved":false,"context_lines":[{"line_number":290,"context_line":"        @image_cache.cleanup(priority\u003d2)"},{"line_number":291,"context_line":"        class Cache2(ParentCache):"},{"line_number":292,"context_line":"            def __init__(self):"},{"line_number":293,"context_line":"                super(Cache2, self).__init__()"},{"line_number":294,"context_line":""},{"line_number":295,"context_line":"        self.assertEqual(image_cache.cache_cleanup_list[0], Cache1)"},{"line_number":296,"context_line":"        self.assertEqual(image_cache.cache_cleanup_list[1], Cache2)"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_eb1e7d5d","line":293,"in_reply_to":"baada198_076d8e67","updated":"2014-08-08 08:54:40.000000000","message":"Done","commit_id":"425705ed12079ab521f6504f0453c8985da60b4d"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"dce0d2e7f611b31a6e61388972bdfa8099982752","unresolved":false,"context_lines":[{"line_number":276,"context_line":"        self.cache.clean_up(amount\u003d15)"},{"line_number":277,"context_line":"        self.assertTrue(mock_log.called)"},{"line_number":278,"context_line":""},{"line_number":279,"context_line":"    def test_cleanup(self):"},{"line_number":280,"context_line":""},{"line_number":281,"context_line":"        class ParentCache(image_cache.ImageCache):"},{"line_number":282,"context_line":"            def __init__(self):"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_5e1337b6","line":279,"updated":"2014-08-12 12:09:48.000000000","message":"nit: better name would be test_cleanup_ordering, as this test does not check cleanup itself","commit_id":"12a088512098652ec862543fdf4a36d356bda583"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"2eb263f12d63c8fe0cf329ca3e2f1d0b7fdb7d12","unresolved":false,"context_lines":[{"line_number":276,"context_line":"        self.cache.clean_up(amount\u003d15)"},{"line_number":277,"context_line":"        self.assertTrue(mock_log.called)"},{"line_number":278,"context_line":""},{"line_number":279,"context_line":"    def test_cleanup(self):"},{"line_number":280,"context_line":""},{"line_number":281,"context_line":"        class ParentCache(image_cache.ImageCache):"},{"line_number":282,"context_line":"            def __init__(self):"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_d232d6f1","line":279,"in_reply_to":"baada198_5e1337b6","updated":"2014-08-12 13:43:01.000000000","message":"Done","commit_id":"12a088512098652ec862543fdf4a36d356bda583"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"ada8a83a44c62d8b964971b56ee5365f56925690","unresolved":false,"context_lines":[{"line_number":291,"context_line":"            pass"},{"line_number":292,"context_line":""},{"line_number":293,"context_line":"        self.assertEqual(image_cache._cache_cleanup_list[0][1], Cache2)"},{"line_number":294,"context_line":"        self.assertEqual(image_cache._cache_cleanup_list[1][1], Cache1)"},{"line_number":295,"context_line":""},{"line_number":296,"context_line":""},{"line_number":297,"context_line":"@mock.patch.object(image_cache, \u0027_cache_cleanup_list\u0027)"}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_680cba44","line":294,"updated":"2014-08-12 15:39:55.000000000","message":"Do you want a test to show what happens if the same priority is specified, or zero or negative numbers?","commit_id":"dbd8e350b6c87a02d401a016674423ff9619e3bb"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"f3104d163a6960eace8d568ecea070fb264fdf6d","unresolved":false,"context_lines":[{"line_number":291,"context_line":"            pass"},{"line_number":292,"context_line":""},{"line_number":293,"context_line":"        self.assertEqual(image_cache._cache_cleanup_list[0][1], Cache2)"},{"line_number":294,"context_line":"        self.assertEqual(image_cache._cache_cleanup_list[1][1], Cache1)"},{"line_number":295,"context_line":""},{"line_number":296,"context_line":""},{"line_number":297,"context_line":"@mock.patch.object(image_cache, \u0027_cache_cleanup_list\u0027)"}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_5eb08c8c","line":294,"in_reply_to":"baada198_680cba44","updated":"2014-08-13 03:39:28.000000000","message":"Negative number doesn\u0027t matter because it is just sorting in non-increasing order.  I will add a case for same priority.","commit_id":"dbd8e350b6c87a02d401a016674423ff9619e3bb"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"ada8a83a44c62d8b964971b56ee5365f56925690","unresolved":false,"context_lines":[{"line_number":327,"context_line":"    @mock.patch.object(os, \u0027stat\u0027)"},{"line_number":328,"context_line":"    def test_one_clean_up(self, mock_stat, mock_image_service, mock_statvfs,"},{"line_number":329,"context_line":"                          cache_cleanup_list_mock):"},{"line_number":330,"context_line":"        # Not enough space, instance cache clean up is enough"},{"line_number":331,"context_line":"        mock_stat.return_value.st_dev \u003d 1"},{"line_number":332,"context_line":"        mock_show \u003d mock_image_service.return_value.show"},{"line_number":333,"context_line":"        mock_show.return_value \u003d dict(size\u003d42)"}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_1bd1c62e","line":330,"updated":"2014-08-12 15:39:55.000000000","message":"this is fine, but maybe we should move away from \u0027instance cache\u0027 to eg \u0027first cache\u0027.","commit_id":"dbd8e350b6c87a02d401a016674423ff9619e3bb"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"f3104d163a6960eace8d568ecea070fb264fdf6d","unresolved":false,"context_lines":[{"line_number":327,"context_line":"    @mock.patch.object(os, \u0027stat\u0027)"},{"line_number":328,"context_line":"    def test_one_clean_up(self, mock_stat, mock_image_service, mock_statvfs,"},{"line_number":329,"context_line":"                          cache_cleanup_list_mock):"},{"line_number":330,"context_line":"        # Not enough space, instance cache clean up is enough"},{"line_number":331,"context_line":"        mock_stat.return_value.st_dev \u003d 1"},{"line_number":332,"context_line":"        mock_show \u003d mock_image_service.return_value.show"},{"line_number":333,"context_line":"        mock_show.return_value \u003d dict(size\u003d42)"}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_bf8269c5","line":330,"in_reply_to":"baada198_1bd1c62e","updated":"2014-08-13 03:39:28.000000000","message":"Done","commit_id":"dbd8e350b6c87a02d401a016674423ff9619e3bb"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"ada8a83a44c62d8b964971b56ee5365f56925690","unresolved":false,"context_lines":[{"line_number":344,"context_line":"        self.mock_instance_cache.return_value.clean_up.assert_called_once_with("},{"line_number":345,"context_line":"            amount\u003d(42 * 2 - 1))"},{"line_number":346,"context_line":"        self.assertFalse(self.mock_tftp_cache.return_value.clean_up.called)"},{"line_number":347,"context_line":"        self.assertEqual(2, mock_stat.call_count)"},{"line_number":348,"context_line":""},{"line_number":349,"context_line":"    @mock.patch.object(os, \u0027stat\u0027)"},{"line_number":350,"context_line":"    def test_clean_up_another_fs(self, mock_stat, mock_image_service,"}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_9b795632","line":347,"updated":"2014-08-12 15:39:55.000000000","message":"I didn\u0027t actually follow the code so I don\u0027t know if 2 is correct or not, but I see that the original test was 3, so just wanted to point it out.","commit_id":"dbd8e350b6c87a02d401a016674423ff9619e3bb"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"f3104d163a6960eace8d568ecea070fb264fdf6d","unresolved":false,"context_lines":[{"line_number":344,"context_line":"        self.mock_instance_cache.return_value.clean_up.assert_called_once_with("},{"line_number":345,"context_line":"            amount\u003d(42 * 2 - 1))"},{"line_number":346,"context_line":"        self.assertFalse(self.mock_tftp_cache.return_value.clean_up.called)"},{"line_number":347,"context_line":"        self.assertEqual(2, mock_stat.call_count)"},{"line_number":348,"context_line":""},{"line_number":349,"context_line":"    @mock.patch.object(os, \u0027stat\u0027)"},{"line_number":350,"context_line":"    def test_clean_up_another_fs(self, mock_stat, mock_image_service,"}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_def57c52","line":347,"in_reply_to":"baada198_9b795632","updated":"2014-08-13 03:39:28.000000000","message":"Yeah, the original it was 3.  We changed the below to a generator expression.  Changing to generator expression in the loop meant that we don\u0027t iterate over all the items if we break out of the loop inbetween.  In this specific case, we break out after cleaning up one cache, so we do stat only twice - one for the actual directory, and one for the first cache.\n\nhttps://review.openstack.org/#/c/110560/7/ironic/drivers/modules/image_cache.py    L306\n\nI have added a comment, and bettered the test case by asserting the calls made.","commit_id":"dbd8e350b6c87a02d401a016674423ff9619e3bb"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"ada8a83a44c62d8b964971b56ee5365f56925690","unresolved":false,"context_lines":[{"line_number":349,"context_line":"    @mock.patch.object(os, \u0027stat\u0027)"},{"line_number":350,"context_line":"    def test_clean_up_another_fs(self, mock_stat, mock_image_service,"},{"line_number":351,"context_line":"                                 mock_statvfs, cache_cleanup_list_mock):"},{"line_number":352,"context_line":"        # Not enough space, instance cache on another partition"},{"line_number":353,"context_line":"        mock_stat.side_effect \u003d [mock.Mock(st_dev\u003d1),"},{"line_number":354,"context_line":"                                 mock.Mock(st_dev\u003d2),"},{"line_number":355,"context_line":"                                 mock.Mock(st_dev\u003d1)]"}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_7be482de","line":352,"updated":"2014-08-12 15:39:55.000000000","message":"nit: instead of \u0027instance cache\u0027, can be \u0027first cache\u0027.","commit_id":"dbd8e350b6c87a02d401a016674423ff9619e3bb"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"f3104d163a6960eace8d568ecea070fb264fdf6d","unresolved":false,"context_lines":[{"line_number":349,"context_line":"    @mock.patch.object(os, \u0027stat\u0027)"},{"line_number":350,"context_line":"    def test_clean_up_another_fs(self, mock_stat, mock_image_service,"},{"line_number":351,"context_line":"                                 mock_statvfs, cache_cleanup_list_mock):"},{"line_number":352,"context_line":"        # Not enough space, instance cache on another partition"},{"line_number":353,"context_line":"        mock_stat.side_effect \u003d [mock.Mock(st_dev\u003d1),"},{"line_number":354,"context_line":"                                 mock.Mock(st_dev\u003d2),"},{"line_number":355,"context_line":"                                 mock.Mock(st_dev\u003d1)]"}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_df663d56","line":352,"in_reply_to":"baada198_7be482de","updated":"2014-08-13 03:39:28.000000000","message":"Done","commit_id":"dbd8e350b6c87a02d401a016674423ff9619e3bb"}],"ironic/tests/drivers/test_pxe.py":[{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"dce0d2e7f611b31a6e61388972bdfa8099982752","unresolved":false,"context_lines":[{"line_number":433,"context_line":""},{"line_number":434,"context_line":"        exc \u003d exception.InsufficientDiskSpace(path\u003d\u0027a\u0027,"},{"line_number":435,"context_line":"                required\u003d2,"},{"line_number":436,"context_line":"                actual\u003d1)"},{"line_number":437,"context_line":""},{"line_number":438,"context_line":"        mock_cache \u003d mock.MagicMock()"},{"line_number":439,"context_line":"        mock_clean_up_caches.side_effect \u003d [exc]"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_3e5e8379","line":436,"updated":"2014-08-12 12:09:48.000000000","message":"nit: better to indent in line with (","commit_id":"12a088512098652ec862543fdf4a36d356bda583"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"2eb263f12d63c8fe0cf329ca3e2f1d0b7fdb7d12","unresolved":false,"context_lines":[{"line_number":433,"context_line":""},{"line_number":434,"context_line":"        exc \u003d exception.InsufficientDiskSpace(path\u003d\u0027a\u0027,"},{"line_number":435,"context_line":"                required\u003d2,"},{"line_number":436,"context_line":"                actual\u003d1)"},{"line_number":437,"context_line":""},{"line_number":438,"context_line":"        mock_cache \u003d mock.MagicMock()"},{"line_number":439,"context_line":"        mock_clean_up_caches.side_effect \u003d [exc]"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_12852e52","line":436,"in_reply_to":"baada198_3e5e8379","updated":"2014-08-12 13:43:01.000000000","message":"Done","commit_id":"12a088512098652ec862543fdf4a36d356bda583"},{"author":{"_account_id":10239,"name":"Dmitry Tantsur","email":"dtantsur@protonmail.com","username":"dtantsur"},"change_message_id":"dce0d2e7f611b31a6e61388972bdfa8099982752","unresolved":false,"context_lines":[{"line_number":441,"context_line":"                pxe._fetch_images,"},{"line_number":442,"context_line":"                None,"},{"line_number":443,"context_line":"                mock_cache,"},{"line_number":444,"context_line":"                [(\u0027uuid\u0027, \u0027path\u0027)])"},{"line_number":445,"context_line":""},{"line_number":446,"context_line":""},{"line_number":447,"context_line":"class PXEDriverTestCase(db_base.DbTestCase):"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_fe708b0a","line":444,"updated":"2014-08-12 12:09:48.000000000","message":"ditto","commit_id":"12a088512098652ec862543fdf4a36d356bda583"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"2eb263f12d63c8fe0cf329ca3e2f1d0b7fdb7d12","unresolved":false,"context_lines":[{"line_number":441,"context_line":"                pxe._fetch_images,"},{"line_number":442,"context_line":"                None,"},{"line_number":443,"context_line":"                mock_cache,"},{"line_number":444,"context_line":"                [(\u0027uuid\u0027, \u0027path\u0027)])"},{"line_number":445,"context_line":""},{"line_number":446,"context_line":""},{"line_number":447,"context_line":"class PXEDriverTestCase(db_base.DbTestCase):"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_32e79247","line":444,"in_reply_to":"baada198_fe708b0a","updated":"2014-08-12 13:43:01.000000000","message":"Done","commit_id":"12a088512098652ec862543fdf4a36d356bda583"},{"author":{"_account_id":6618,"name":"Ruby Loo","email":"opensrloo@gmail.com","username":"rloo"},"change_message_id":"ada8a83a44c62d8b964971b56ee5365f56925690","unresolved":false,"context_lines":[{"line_number":441,"context_line":"                          pxe._fetch_images,"},{"line_number":442,"context_line":"                          None,"},{"line_number":443,"context_line":"                          mock_cache,"},{"line_number":444,"context_line":"                          [(\u0027uuid\u0027, \u0027path\u0027)])"},{"line_number":445,"context_line":""},{"line_number":446,"context_line":""},{"line_number":447,"context_line":"class PXEDriverTestCase(db_base.DbTestCase):"}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_68e2fa9c","line":444,"updated":"2014-08-12 15:39:55.000000000","message":"Would it be good to check that mock_clean_up_caches was called? Otherwise, maybe this failed for some other reason.","commit_id":"dbd8e350b6c87a02d401a016674423ff9619e3bb"},{"author":{"_account_id":9315,"name":"ramesh","email":"rameshg87@gmail.com","username":"rameshg87"},"change_message_id":"f3104d163a6960eace8d568ecea070fb264fdf6d","unresolved":false,"context_lines":[{"line_number":441,"context_line":"                          pxe._fetch_images,"},{"line_number":442,"context_line":"                          None,"},{"line_number":443,"context_line":"                          mock_cache,"},{"line_number":444,"context_line":"                          [(\u0027uuid\u0027, \u0027path\u0027)])"},{"line_number":445,"context_line":""},{"line_number":446,"context_line":""},{"line_number":447,"context_line":"class PXEDriverTestCase(db_base.DbTestCase):"}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_3fdc99e1","line":444,"in_reply_to":"baada198_68e2fa9c","updated":"2014-08-13 03:39:28.000000000","message":"Done","commit_id":"dbd8e350b6c87a02d401a016674423ff9619e3bb"}]}
