)]}'
{"nova/scheduler/chance.py":[{"author":{"_account_id":706,"name":"Brian Lamar","email":"brian.lamar@rackspace.com","username":"blamar"},"change_message_id":"1b0f7439300d597a18af0e4501442948e781fad3","unresolved":false,"context_lines":[{"line_number":23,"context_line":""},{"line_number":24,"context_line":"import random"},{"line_number":25,"context_line":"import os"},{"line_number":26,"context_line":"import errno"},{"line_number":27,"context_line":"from nova import db"},{"line_number":28,"context_line":"from nova import log as logging"},{"line_number":29,"context_line":"from nova import flags"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2B%2BU%3D","line":26,"updated":"2011-11-11 14:46:36.000000000","message":"Please update to:\n\n    import errno\n    import os\n    import random\n\n    from nova import db\n    from nova import flags\n    from nova import log as logging","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"5f4a96296da7a324fa9797b8ca92ce0b2f1bbde4","unresolved":false,"context_lines":[{"line_number":23,"context_line":""},{"line_number":24,"context_line":"import random"},{"line_number":25,"context_line":"import os"},{"line_number":26,"context_line":"import errno"},{"line_number":27,"context_line":"from nova import db"},{"line_number":28,"context_line":"from nova import log as logging"},{"line_number":29,"context_line":"from nova import flags"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2Bms%3D","line":26,"in_reply_to":"AAAACn%2F%2F%2B%2BU%3D","updated":"2011-11-14 18:13:33.000000000","message":"Done","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":706,"name":"Brian Lamar","email":"brian.lamar@rackspace.com","username":"blamar"},"change_message_id":"1b0f7439300d597a18af0e4501442948e781fad3","unresolved":false,"context_lines":[{"line_number":54,"context_line":""},{"line_number":55,"context_line":"    def schedule(self, context, topic, method, *_args, **kwargs):"},{"line_number":56,"context_line":"        \"\"\"Picks a host that is up at random if it cannot find"},{"line_number":57,"context_line":"        a file-defined host for the particular user.\"\"\""},{"line_number":58,"context_line":"        host \u003d self._get_file_defined_host(context) or \\"},{"line_number":59,"context_line":"            self._schedule(context, topic, **kwargs)"},{"line_number":60,"context_line":"        driver.cast_to_host(context, topic, host, method, **kwargs)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2B%2BQ%3D","line":57,"updated":"2011-11-11 14:46:36.000000000","message":"According to project standards (HACKING file), this docstring should be formatted:\n\n    \"\"\"Picks a host that is up at random.\n\n    If a \u0027schedulable host\u0027 file is present for a particular user, then\n    that hose will be used.\n\n    \"\"\"\n\nI attempted to re-word it a bit, because I\u0027m not exactly clear on what is happening, but I\u0027ll have specific questions in other places :)","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"5f4a96296da7a324fa9797b8ca92ce0b2f1bbde4","unresolved":false,"context_lines":[{"line_number":54,"context_line":""},{"line_number":55,"context_line":"    def schedule(self, context, topic, method, *_args, **kwargs):"},{"line_number":56,"context_line":"        \"\"\"Picks a host that is up at random if it cannot find"},{"line_number":57,"context_line":"        a file-defined host for the particular user.\"\"\""},{"line_number":58,"context_line":"        host \u003d self._get_file_defined_host(context) or \\"},{"line_number":59,"context_line":"            self._schedule(context, topic, **kwargs)"},{"line_number":60,"context_line":"        driver.cast_to_host(context, topic, host, method, **kwargs)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2Bmo%3D","line":57,"in_reply_to":"AAAACn%2F%2F%2B%2BQ%3D","updated":"2011-11-14 18:13:33.000000000","message":"Done","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":706,"name":"Brian Lamar","email":"brian.lamar@rackspace.com","username":"blamar"},"change_message_id":"1b0f7439300d597a18af0e4501442948e781fad3","unresolved":false,"context_lines":[{"line_number":61,"context_line":""},{"line_number":62,"context_line":"    def schedule_run_instance(self, context, request_spec, *_args, **kwargs):"},{"line_number":63,"context_line":"        \"\"\"Create and run an instance or instances to the user defined host,"},{"line_number":64,"context_line":"        or using the random algorithm if not defined.\"\"\""},{"line_number":65,"context_line":"        elevated \u003d context.elevated()"},{"line_number":66,"context_line":"        num_instances \u003d request_spec.get(\u0027num_instances\u0027, 1)"},{"line_number":67,"context_line":"        instances \u003d []"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2B%2BI%3D","line":64,"updated":"2011-11-11 14:46:36.000000000","message":"This should also be formatted according to project standards, with a single line description, followed by a blank line, followed by a detailed description, followed by a blank line.","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"5f4a96296da7a324fa9797b8ca92ce0b2f1bbde4","unresolved":false,"context_lines":[{"line_number":61,"context_line":""},{"line_number":62,"context_line":"    def schedule_run_instance(self, context, request_spec, *_args, **kwargs):"},{"line_number":63,"context_line":"        \"\"\"Create and run an instance or instances to the user defined host,"},{"line_number":64,"context_line":"        or using the random algorithm if not defined.\"\"\""},{"line_number":65,"context_line":"        elevated \u003d context.elevated()"},{"line_number":66,"context_line":"        num_instances \u003d request_spec.get(\u0027num_instances\u0027, 1)"},{"line_number":67,"context_line":"        instances \u003d []"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2BmY%3D","line":64,"in_reply_to":"AAAACn%2F%2F%2B%2BI%3D","updated":"2011-11-14 18:13:33.000000000","message":"Done","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":706,"name":"Brian Lamar","email":"brian.lamar@rackspace.com","username":"blamar"},"change_message_id":"1b0f7439300d597a18af0e4501442948e781fad3","unresolved":false,"context_lines":[{"line_number":79,"context_line":"        \"\"\"Picks the host defined in the first line of the user file."},{"line_number":80,"context_line":"        If the file does not exist, returns None."},{"line_number":81,"context_line":"        It there is any problem with the host defined in the file"},{"line_number":82,"context_line":"        (host does not exist or is down) I raise a NoValidHost exception\"\"\""},{"line_number":83,"context_line":"        userid \u003d context.user_id"},{"line_number":84,"context_line":"        projectid \u003d context.project_id"},{"line_number":85,"context_line":"        sch_host \u003d self._read_first_line_of_user_file(userid)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2B%2BE%3D","line":82,"updated":"2011-11-11 14:46:36.000000000","message":"See above for docstring standards.","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"5f4a96296da7a324fa9797b8ca92ce0b2f1bbde4","unresolved":false,"context_lines":[{"line_number":79,"context_line":"        \"\"\"Picks the host defined in the first line of the user file."},{"line_number":80,"context_line":"        If the file does not exist, returns None."},{"line_number":81,"context_line":"        It there is any problem with the host defined in the file"},{"line_number":82,"context_line":"        (host does not exist or is down) I raise a NoValidHost exception\"\"\""},{"line_number":83,"context_line":"        userid \u003d context.user_id"},{"line_number":84,"context_line":"        projectid \u003d context.project_id"},{"line_number":85,"context_line":"        sch_host \u003d self._read_first_line_of_user_file(userid)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2BmU%3D","line":82,"in_reply_to":"AAAACn%2F%2F%2B%2BE%3D","updated":"2011-11-14 18:13:33.000000000","message":"Done","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"a2543cc1eeba5aca9ff5f5bd3bf7a01d71c25bda","unresolved":false,"context_lines":[{"line_number":100,"context_line":"            if self.service_is_up(comp_ser):"},{"line_number":101,"context_line":"                LOG.info(_(\"scheduling to host %(sch_host)s ... \") % locals())"},{"line_number":102,"context_line":"                return sch_host"},{"line_number":103,"context_line":"            else:"},{"line_number":104,"context_line":"                # the user defined host is down"},{"line_number":105,"context_line":"                msg \u003d _(\"Host %(sch_host)s is down\") % locals()"},{"line_number":106,"context_line":"                LOG.error(msg)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2Bq8%3D","line":103,"updated":"2011-11-14 14:30:44.000000000","message":"Don\u0027t need the else: again.","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"5f4a96296da7a324fa9797b8ca92ce0b2f1bbde4","unresolved":false,"context_lines":[{"line_number":100,"context_line":"            if self.service_is_up(comp_ser):"},{"line_number":101,"context_line":"                LOG.info(_(\"scheduling to host %(sch_host)s ... \") % locals())"},{"line_number":102,"context_line":"                return sch_host"},{"line_number":103,"context_line":"            else:"},{"line_number":104,"context_line":"                # the user defined host is down"},{"line_number":105,"context_line":"                msg \u003d _(\"Host %(sch_host)s is down\") % locals()"},{"line_number":106,"context_line":"                LOG.error(msg)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2Bns%3D","line":103,"in_reply_to":"AAAACn%2F%2F%2Bq8%3D","updated":"2011-11-14 18:13:33.000000000","message":"the idea at this point is to check if the service is up, and return the host in this case. Otherwise, we raise a NoValidHost exception. My understanding is that the return will be only executed if self.service_is_up(...) is true, otherwise the code under the else will be executed.","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":706,"name":"Brian Lamar","email":"brian.lamar@rackspace.com","username":"blamar"},"change_message_id":"1b0f7439300d597a18af0e4501442948e781fad3","unresolved":false,"context_lines":[{"line_number":108,"context_line":""},{"line_number":109,"context_line":"    def _read_first_line_of_user_file(self, user):"},{"line_number":110,"context_line":"        \"\"\"Read the first line of the user file, and return it."},{"line_number":111,"context_line":"        If the file does not exist, return None\"\"\""},{"line_number":112,"context_line":"        fname \u003d os.path.join(FLAGS.sch_hosts_path, user)"},{"line_number":113,"context_line":"        try:"},{"line_number":114,"context_line":"            f \u003d open(fname, \u0027r\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2B98%3D","line":111,"updated":"2011-11-11 14:46:36.000000000","message":"See above for docstring standards.","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"5f4a96296da7a324fa9797b8ca92ce0b2f1bbde4","unresolved":false,"context_lines":[{"line_number":108,"context_line":""},{"line_number":109,"context_line":"    def _read_first_line_of_user_file(self, user):"},{"line_number":110,"context_line":"        \"\"\"Read the first line of the user file, and return it."},{"line_number":111,"context_line":"        If the file does not exist, return None\"\"\""},{"line_number":112,"context_line":"        fname \u003d os.path.join(FLAGS.sch_hosts_path, user)"},{"line_number":113,"context_line":"        try:"},{"line_number":114,"context_line":"            f \u003d open(fname, \u0027r\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2BmQ%3D","line":111,"in_reply_to":"AAAACn%2F%2F%2B98%3D","updated":"2011-11-14 18:13:33.000000000","message":"Done","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":706,"name":"Brian Lamar","email":"brian.lamar@rackspace.com","username":"blamar"},"change_message_id":"1b0f7439300d597a18af0e4501442948e781fad3","unresolved":false,"context_lines":[{"line_number":115,"context_line":"            LOG.debug(_(\"reading the scheduler host definition\""},{"line_number":116,"context_line":"                        \" file: %(fname)s ...\") % locals())"},{"line_number":117,"context_line":"            return f.readline().rstrip()"},{"line_number":118,"context_line":"        except IOError, e:"},{"line_number":119,"context_line":"            if e.errno \u003d\u003d errno.ENOENT:"},{"line_number":120,"context_line":"                return None  # file doesn\u0027t exist"},{"line_number":121,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2B94%3D","line":118,"updated":"2011-11-11 14:46:36.000000000","message":"Try to avoid single character variables. In this case you might be able to avoid this altogether if you actively check if the file exists with os.path.exists()","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"5f4a96296da7a324fa9797b8ca92ce0b2f1bbde4","unresolved":false,"context_lines":[{"line_number":115,"context_line":"            LOG.debug(_(\"reading the scheduler host definition\""},{"line_number":116,"context_line":"                        \" file: %(fname)s ...\") % locals())"},{"line_number":117,"context_line":"            return f.readline().rstrip()"},{"line_number":118,"context_line":"        except IOError, e:"},{"line_number":119,"context_line":"            if e.errno \u003d\u003d errno.ENOENT:"},{"line_number":120,"context_line":"                return None  # file doesn\u0027t exist"},{"line_number":121,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2Brg%3D","line":118,"in_reply_to":"AAAACn%2F%2F%2B94%3D","updated":"2011-11-14 18:13:33.000000000","message":"We decided to use the try: except: instead of os.path.exists() in case the file is deleted just after running os.path.exists(), that would cause an exception. I can change the name of the exception object so it isn\u0027t a single character variable.","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"5f4a96296da7a324fa9797b8ca92ce0b2f1bbde4","unresolved":false,"context_lines":[{"line_number":116,"context_line":"                        \" file: %(fname)s ...\") % locals())"},{"line_number":117,"context_line":"            return f.readline().rstrip()"},{"line_number":118,"context_line":"        except IOError, e:"},{"line_number":119,"context_line":"            if e.errno \u003d\u003d errno.ENOENT:"},{"line_number":120,"context_line":"                return None  # file doesn\u0027t exist"},{"line_number":121,"context_line":"            else:"},{"line_number":122,"context_line":"                msg \u003d _(\"Problem reading file %(fname)s: %(e)s\") % locals()"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2Bnk%3D","line":119,"updated":"2011-11-14 18:13:33.000000000","message":"My understanding is that ENOENT error means that the file does not exist. The idea is that we return None if the file doesn\u0027t exist (this is a valid scenario). Any other Exception (including different IOExceptions) mean that the file exists but something else is wrong: in this case we raise a NoValidHost exception.","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"a2543cc1eeba5aca9ff5f5bd3bf7a01d71c25bda","unresolved":false,"context_lines":[{"line_number":116,"context_line":"                        \" file: %(fname)s ...\") % locals())"},{"line_number":117,"context_line":"            return f.readline().rstrip()"},{"line_number":118,"context_line":"        except IOError, e:"},{"line_number":119,"context_line":"            if e.errno \u003d\u003d errno.ENOENT:"},{"line_number":120,"context_line":"                return None  # file doesn\u0027t exist"},{"line_number":121,"context_line":"            else:"},{"line_number":122,"context_line":"                msg \u003d _(\"Problem reading file %(fname)s: %(e)s\") % locals()"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2BrA%3D","line":119,"updated":"2011-11-14 14:30:44.000000000","message":"What if it\u0027s another IOError? Isn\u0027t that equally bad?","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"a2543cc1eeba5aca9ff5f5bd3bf7a01d71c25bda","unresolved":false,"context_lines":[{"line_number":117,"context_line":"            return f.readline().rstrip()"},{"line_number":118,"context_line":"        except IOError, e:"},{"line_number":119,"context_line":"            if e.errno \u003d\u003d errno.ENOENT:"},{"line_number":120,"context_line":"                return None  # file doesn\u0027t exist"},{"line_number":121,"context_line":"            else:"},{"line_number":122,"context_line":"                msg \u003d _(\"Problem reading file %(fname)s: %(e)s\") % locals()"},{"line_number":123,"context_line":"                LOG.error(msg)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2BrE%3D","line":120,"updated":"2011-11-14 14:30:44.000000000","message":"Bogus comment.","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"5f4a96296da7a324fa9797b8ca92ce0b2f1bbde4","unresolved":false,"context_lines":[{"line_number":117,"context_line":"            return f.readline().rstrip()"},{"line_number":118,"context_line":"        except IOError, e:"},{"line_number":119,"context_line":"            if e.errno \u003d\u003d errno.ENOENT:"},{"line_number":120,"context_line":"                return None  # file doesn\u0027t exist"},{"line_number":121,"context_line":"            else:"},{"line_number":122,"context_line":"                msg \u003d _(\"Problem reading file %(fname)s: %(e)s\") % locals()"},{"line_number":123,"context_line":"                LOG.error(msg)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2BmA%3D","line":120,"in_reply_to":"AAAACn%2F%2F%2BrE%3D","updated":"2011-11-14 18:13:33.000000000","message":"My understanding is that ENOENT error means that the file does not exist. Is that right?","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"a2543cc1eeba5aca9ff5f5bd3bf7a01d71c25bda","unresolved":false,"context_lines":[{"line_number":118,"context_line":"        except IOError, e:"},{"line_number":119,"context_line":"            if e.errno \u003d\u003d errno.ENOENT:"},{"line_number":120,"context_line":"                return None  # file doesn\u0027t exist"},{"line_number":121,"context_line":"            else:"},{"line_number":122,"context_line":"                msg \u003d _(\"Problem reading file %(fname)s: %(e)s\") % locals()"},{"line_number":123,"context_line":"                LOG.error(msg)"},{"line_number":124,"context_line":"                raise driver.NoValidHost(msg)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2BrI%3D","line":121,"updated":"2011-11-14 14:30:44.000000000","message":"Again, don\u0027t need the else if it returns.","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"5f4a96296da7a324fa9797b8ca92ce0b2f1bbde4","unresolved":false,"context_lines":[{"line_number":118,"context_line":"        except IOError, e:"},{"line_number":119,"context_line":"            if e.errno \u003d\u003d errno.ENOENT:"},{"line_number":120,"context_line":"                return None  # file doesn\u0027t exist"},{"line_number":121,"context_line":"            else:"},{"line_number":122,"context_line":"                msg \u003d _(\"Problem reading file %(fname)s: %(e)s\") % locals()"},{"line_number":123,"context_line":"                LOG.error(msg)"},{"line_number":124,"context_line":"                raise driver.NoValidHost(msg)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2BnY%3D","line":121,"in_reply_to":"AAAACn%2F%2F%2BrI%3D","updated":"2011-11-14 18:13:33.000000000","message":"according to my understanding, the return will not be executed if the errno was not ENOENT, so the NoValidHost exception is raised in that case.","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"a2543cc1eeba5aca9ff5f5bd3bf7a01d71c25bda","unresolved":false,"context_lines":[{"line_number":121,"context_line":"            else:"},{"line_number":122,"context_line":"                msg \u003d _(\"Problem reading file %(fname)s: %(e)s\") % locals()"},{"line_number":123,"context_line":"                LOG.error(msg)"},{"line_number":124,"context_line":"                raise driver.NoValidHost(msg)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2BrM%3D","line":124,"updated":"2011-11-14 14:30:44.000000000","message":"Should this be no valid host when the file is wrong?","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"5f4a96296da7a324fa9797b8ca92ce0b2f1bbde4","unresolved":false,"context_lines":[{"line_number":121,"context_line":"            else:"},{"line_number":122,"context_line":"                msg \u003d _(\"Problem reading file %(fname)s: %(e)s\") % locals()"},{"line_number":123,"context_line":"                LOG.error(msg)"},{"line_number":124,"context_line":"                raise driver.NoValidHost(msg)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAACn%2F%2F%2Bl4%3D","line":124,"in_reply_to":"AAAACn%2F%2F%2BrM%3D","updated":"2011-11-14 18:13:33.000000000","message":"We want to simplify the exceptions raised by the scheduler. If the file has been created, but there is something wrong, we raise the NoValidHost exception to tell the user that the host defined in the file, or the file itself, is wrong.","commit_id":"3dc7ae44e398b325a548cdfd0527074e8f09e68e"}],"nova/scheduler/hostfile.py":[{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"986abe297c62a9b62bfd5562a780fa0315952802","unresolved":false,"context_lines":[{"line_number":96,"context_line":"        userid \u003d context.user_id"},{"line_number":97,"context_line":"        sch_host \u003d self._get_cached_host(userid) or \\"},{"line_number":98,"context_line":"            self._read_first_line_of_user_file(userid)"},{"line_number":99,"context_line":"        if sch_host is None:"},{"line_number":100,"context_line":"            # Scheduler host definition file not found"},{"line_number":101,"context_line":"            return None"},{"line_number":102,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2BjA%3D","line":99,"updated":"2011-11-14 19:40:31.000000000","message":"if not sch_host:","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"27eb216f994673f16f0ffb71baa02443930e7f3a","unresolved":false,"context_lines":[{"line_number":96,"context_line":"        userid \u003d context.user_id"},{"line_number":97,"context_line":"        sch_host \u003d self._get_cached_host(userid) or \\"},{"line_number":98,"context_line":"            self._read_first_line_of_user_file(userid)"},{"line_number":99,"context_line":"        if sch_host is None:"},{"line_number":100,"context_line":"            # Scheduler host definition file not found"},{"line_number":101,"context_line":"            return None"},{"line_number":102,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2Bc4%3D","line":99,"in_reply_to":"AAAACn%2F%2F%2BjA%3D","updated":"2011-11-15 15:12:37.000000000","message":"Done","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"986abe297c62a9b62bfd5562a780fa0315952802","unresolved":false,"context_lines":[{"line_number":99,"context_line":"        if sch_host is None:"},{"line_number":100,"context_line":"            # Scheduler host definition file not found"},{"line_number":101,"context_line":"            return None"},{"line_number":102,"context_line":"        else:"},{"line_number":103,"context_line":"            LOG.debug(_(\"Scheduler host defined in file: { user \u003d %(userid)s ;\""},{"line_number":104,"context_line":"                        \" host \u003d %(sch_host)s}\") % locals())"},{"line_number":105,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2BjY%3D","line":102,"updated":"2011-11-14 19:40:31.000000000","message":"Don\u0027t need else: since other branch does return","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"27eb216f994673f16f0ffb71baa02443930e7f3a","unresolved":false,"context_lines":[{"line_number":99,"context_line":"        if sch_host is None:"},{"line_number":100,"context_line":"            # Scheduler host definition file not found"},{"line_number":101,"context_line":"            return None"},{"line_number":102,"context_line":"        else:"},{"line_number":103,"context_line":"            LOG.debug(_(\"Scheduler host defined in file: { user \u003d %(userid)s ;\""},{"line_number":104,"context_line":"                        \" host \u003d %(sch_host)s}\") % locals())"},{"line_number":105,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2Bc0%3D","line":102,"in_reply_to":"AAAACn%2F%2F%2BjY%3D","updated":"2011-11-15 15:12:37.000000000","message":"I didn\u0027t understand your comment last time: if the if is executed nothing after the return will be executed, so we do not need the else. I agree.","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"986abe297c62a9b62bfd5562a780fa0315952802","unresolved":false,"context_lines":[{"line_number":109,"context_line":"                # the user defined host does not exist"},{"line_number":110,"context_line":"                msg \u003d _(\"Host %(sch_host)s not found in DB. %(ex)s\") % locals()"},{"line_number":111,"context_line":"                LOG.error(msg)"},{"line_number":112,"context_line":"                raise exception.NoValidHost(msg)"},{"line_number":113,"context_line":"            if self.service_is_up(comp_ser):"},{"line_number":114,"context_line":"                LOG.info(_(\"scheduling to host %(sch_host)s ... \") % locals())"},{"line_number":115,"context_line":"                self._cache_mapping(userid, sch_host)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2Bi8%3D","line":112,"updated":"2011-11-14 19:40:31.000000000","message":"Exception is hiding the actual problem","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"27eb216f994673f16f0ffb71baa02443930e7f3a","unresolved":false,"context_lines":[{"line_number":109,"context_line":"                # the user defined host does not exist"},{"line_number":110,"context_line":"                msg \u003d _(\"Host %(sch_host)s not found in DB. %(ex)s\") % locals()"},{"line_number":111,"context_line":"                LOG.error(msg)"},{"line_number":112,"context_line":"                raise exception.NoValidHost(msg)"},{"line_number":113,"context_line":"            if self.service_is_up(comp_ser):"},{"line_number":114,"context_line":"                LOG.info(_(\"scheduling to host %(sch_host)s ... \") % locals())"},{"line_number":115,"context_line":"                self._cache_mapping(userid, sch_host)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2BcY%3D","line":112,"in_reply_to":"AAAACn%2F%2F%2Bi8%3D","updated":"2011-11-15 15:12:37.000000000","message":"created a subclass of NoValidHost for this particular case.","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"986abe297c62a9b62bfd5562a780fa0315952802","unresolved":false,"context_lines":[{"line_number":114,"context_line":"                LOG.info(_(\"scheduling to host %(sch_host)s ... \") % locals())"},{"line_number":115,"context_line":"                self._cache_mapping(userid, sch_host)"},{"line_number":116,"context_line":"                return sch_host"},{"line_number":117,"context_line":"            else:"},{"line_number":118,"context_line":"                # the user defined host is down"},{"line_number":119,"context_line":"                msg \u003d _(\"Host %(sch_host)s is down\") % locals()"},{"line_number":120,"context_line":"                LOG.error(msg)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2BjU%3D","line":117,"updated":"2011-11-14 19:40:31.000000000","message":"don\u0027t need else:","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"27eb216f994673f16f0ffb71baa02443930e7f3a","unresolved":false,"context_lines":[{"line_number":114,"context_line":"                LOG.info(_(\"scheduling to host %(sch_host)s ... \") % locals())"},{"line_number":115,"context_line":"                self._cache_mapping(userid, sch_host)"},{"line_number":116,"context_line":"                return sch_host"},{"line_number":117,"context_line":"            else:"},{"line_number":118,"context_line":"                # the user defined host is down"},{"line_number":119,"context_line":"                msg \u003d _(\"Host %(sch_host)s is down\") % locals()"},{"line_number":120,"context_line":"                LOG.error(msg)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2Bcw%3D","line":117,"in_reply_to":"AAAACn%2F%2F%2BjU%3D","updated":"2011-11-15 15:12:37.000000000","message":"Done","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"986abe297c62a9b62bfd5562a780fa0315952802","unresolved":false,"context_lines":[{"line_number":130,"context_line":"        if FLAGS.hostfile_cache_expire \u003c\u003d 0:"},{"line_number":131,"context_line":"            # cache disabled"},{"line_number":132,"context_line":"            return None"},{"line_number":133,"context_line":"        else:"},{"line_number":134,"context_line":"            if user in user_host_mapping:"},{"line_number":135,"context_line":"                # host-user mapping cached"},{"line_number":136,"context_line":"                now \u003d utils.utcnow()"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2BjQ%3D","line":133,"updated":"2011-11-14 19:40:31.000000000","message":"Don\u0027t need else:","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"27eb216f994673f16f0ffb71baa02443930e7f3a","unresolved":false,"context_lines":[{"line_number":130,"context_line":"        if FLAGS.hostfile_cache_expire \u003c\u003d 0:"},{"line_number":131,"context_line":"            # cache disabled"},{"line_number":132,"context_line":"            return None"},{"line_number":133,"context_line":"        else:"},{"line_number":134,"context_line":"            if user in user_host_mapping:"},{"line_number":135,"context_line":"                # host-user mapping cached"},{"line_number":136,"context_line":"                now \u003d utils.utcnow()"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2Bcs%3D","line":133,"in_reply_to":"AAAACn%2F%2F%2BjQ%3D","updated":"2011-11-15 15:12:37.000000000","message":"Done","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"986abe297c62a9b62bfd5562a780fa0315952802","unresolved":false,"context_lines":[{"line_number":140,"context_line":"                    LOG.debug(_(\"Using cached host: %s\")"},{"line_number":141,"context_line":"                              % user_host_mapping[user])"},{"line_number":142,"context_line":"                    return user_host_mapping[user][\u0027host\u0027]"},{"line_number":143,"context_line":"                else:"},{"line_number":144,"context_line":"                    # cache expired:"},{"line_number":145,"context_line":"                    LOG.debug(_(\"Cached host: %s expired\")"},{"line_number":146,"context_line":"                              % user_host_mapping[user])"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2BjM%3D","line":143,"updated":"2011-11-14 19:40:31.000000000","message":"don\u0027t need else:","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"27eb216f994673f16f0ffb71baa02443930e7f3a","unresolved":false,"context_lines":[{"line_number":140,"context_line":"                    LOG.debug(_(\"Using cached host: %s\")"},{"line_number":141,"context_line":"                              % user_host_mapping[user])"},{"line_number":142,"context_line":"                    return user_host_mapping[user][\u0027host\u0027]"},{"line_number":143,"context_line":"                else:"},{"line_number":144,"context_line":"                    # cache expired:"},{"line_number":145,"context_line":"                    LOG.debug(_(\"Cached host: %s expired\")"},{"line_number":146,"context_line":"                              % user_host_mapping[user])"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2Bco%3D","line":143,"in_reply_to":"AAAACn%2F%2F%2BjM%3D","updated":"2011-11-15 15:12:37.000000000","message":"Done","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"986abe297c62a9b62bfd5562a780fa0315952802","unresolved":false,"context_lines":[{"line_number":167,"context_line":"        except IOError, ex:"},{"line_number":168,"context_line":"            if ex.errno \u003d\u003d errno.ENOENT:"},{"line_number":169,"context_line":"                return None  # file doesn\u0027t exist"},{"line_number":170,"context_line":"            else:"},{"line_number":171,"context_line":"                msg \u003d _(\"Problem reading file %(fname)s: %s\") % ex"},{"line_number":172,"context_line":"                LOG.error(msg)"},{"line_number":173,"context_line":"                raise exception.NoValidHost(msg)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2BjE%3D","line":170,"updated":"2011-11-14 19:40:31.000000000","message":"else: not needed","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"27eb216f994673f16f0ffb71baa02443930e7f3a","unresolved":false,"context_lines":[{"line_number":167,"context_line":"        except IOError, ex:"},{"line_number":168,"context_line":"            if ex.errno \u003d\u003d errno.ENOENT:"},{"line_number":169,"context_line":"                return None  # file doesn\u0027t exist"},{"line_number":170,"context_line":"            else:"},{"line_number":171,"context_line":"                msg \u003d _(\"Problem reading file %(fname)s: %s\") % ex"},{"line_number":172,"context_line":"                LOG.error(msg)"},{"line_number":173,"context_line":"                raise exception.NoValidHost(msg)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2Bck%3D","line":170,"in_reply_to":"AAAACn%2F%2F%2BjE%3D","updated":"2011-11-15 15:12:37.000000000","message":"Done","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"986abe297c62a9b62bfd5562a780fa0315952802","unresolved":false,"context_lines":[{"line_number":170,"context_line":"            else:"},{"line_number":171,"context_line":"                msg \u003d _(\"Problem reading file %(fname)s: %s\") % ex"},{"line_number":172,"context_line":"                LOG.error(msg)"},{"line_number":173,"context_line":"                raise exception.NoValidHost(msg)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2BjI%3D","line":173,"updated":"2011-11-14 19:40:31.000000000","message":"Should treat as file doesn\u0027t exist or more meaningful exception","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"27eb216f994673f16f0ffb71baa02443930e7f3a","unresolved":false,"context_lines":[{"line_number":170,"context_line":"            else:"},{"line_number":171,"context_line":"                msg \u003d _(\"Problem reading file %(fname)s: %s\") % ex"},{"line_number":172,"context_line":"                LOG.error(msg)"},{"line_number":173,"context_line":"                raise exception.NoValidHost(msg)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2BcU%3D","line":173,"in_reply_to":"AAAACn%2F%2F%2BjI%3D","updated":"2011-11-15 15:12:37.000000000","message":"created a subclass of NoValidHost for this particular case.","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"}],"nova/tests/scheduler/test_scheduler.py":[{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"986abe297c62a9b62bfd5562a780fa0315952802","unresolved":false,"context_lines":[{"line_number":39,"context_line":"from nova.scheduler import driver"},{"line_number":40,"context_line":"from nova.scheduler import manager"},{"line_number":41,"context_line":"from nova.scheduler.simple import SimpleScheduler"},{"line_number":42,"context_line":"from nova.scheduler import hostfile"},{"line_number":43,"context_line":"from nova.compute import power_state"},{"line_number":44,"context_line":"from nova.compute import vm_states"},{"line_number":45,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2Bjo%3D","line":42,"updated":"2011-11-14 19:40:31.000000000","message":"improper import ordering ... see HACKING","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"27eb216f994673f16f0ffb71baa02443930e7f3a","unresolved":false,"context_lines":[{"line_number":39,"context_line":"from nova.scheduler import driver"},{"line_number":40,"context_line":"from nova.scheduler import manager"},{"line_number":41,"context_line":"from nova.scheduler.simple import SimpleScheduler"},{"line_number":42,"context_line":"from nova.scheduler import hostfile"},{"line_number":43,"context_line":"from nova.compute import power_state"},{"line_number":44,"context_line":"from nova.compute import vm_states"},{"line_number":45,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2BcQ%3D","line":42,"in_reply_to":"AAAACn%2F%2F%2Bjo%3D","updated":"2011-11-15 15:12:37.000000000","message":"Done","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"986abe297c62a9b62bfd5562a780fa0315952802","unresolved":false,"context_lines":[{"line_number":1494,"context_line":"        super(HostFileTest, self).tearDown()"},{"line_number":1495,"context_line":""},{"line_number":1496,"context_line":"    def _create_scheduler_file(self, user, host):"},{"line_number":1497,"context_line":"        fname \u003d os.path.join(FLAGS.sch_hosts_path, user)"},{"line_number":1498,"context_line":"        f \u003d open(fname, \u0027w\u0027)"},{"line_number":1499,"context_line":"        f.write(host)"},{"line_number":1500,"context_line":"        f.close()"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2Bi4%3D","line":1497,"updated":"2011-11-14 19:40:31.000000000","message":"Implementation should have a method to read file and the test should override it to use a fixed value. We shouldn\u0027t have to actually write to the disk for a unit test.","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"27eb216f994673f16f0ffb71baa02443930e7f3a","unresolved":false,"context_lines":[{"line_number":1494,"context_line":"        super(HostFileTest, self).tearDown()"},{"line_number":1495,"context_line":""},{"line_number":1496,"context_line":"    def _create_scheduler_file(self, user, host):"},{"line_number":1497,"context_line":"        fname \u003d os.path.join(FLAGS.sch_hosts_path, user)"},{"line_number":1498,"context_line":"        f \u003d open(fname, \u0027w\u0027)"},{"line_number":1499,"context_line":"        f.write(host)"},{"line_number":1500,"context_line":"        f.close()"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2Bbw%3D","line":1497,"in_reply_to":"AAAACn%2F%2F%2Bi4%3D","updated":"2011-11-15 15:12:37.000000000","message":"I created a method that calls open(...), and a testing stub that instead of calling open returns a StringIO, so we no longer do real io operations in the unit test.","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"986abe297c62a9b62bfd5562a780fa0315952802","unresolved":false,"context_lines":[{"line_number":1499,"context_line":"        f.write(host)"},{"line_number":1500,"context_line":"        f.close()"},{"line_number":1501,"context_line":""},{"line_number":1502,"context_line":"    def _create_compute_service(self, **kwargs):"},{"line_number":1503,"context_line":"        \"\"\"Create a compute service.\"\"\""},{"line_number":1504,"context_line":""},{"line_number":1505,"context_line":"        dic \u003d {\u0027binary\u0027: \u0027nova-compute\u0027, \u0027topic\u0027: \u0027compute\u0027,"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2Bjc%3D","line":1502,"updated":"2011-11-14 19:40:31.000000000","message":"Do we need this? Why not just stub out the code that checks?","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"27eb216f994673f16f0ffb71baa02443930e7f3a","unresolved":false,"context_lines":[{"line_number":1499,"context_line":"        f.write(host)"},{"line_number":1500,"context_line":"        f.close()"},{"line_number":1501,"context_line":""},{"line_number":1502,"context_line":"    def _create_compute_service(self, **kwargs):"},{"line_number":1503,"context_line":"        \"\"\"Create a compute service.\"\"\""},{"line_number":1504,"context_line":""},{"line_number":1505,"context_line":"        dic \u003d {\u0027binary\u0027: \u0027nova-compute\u0027, \u0027topic\u0027: \u0027compute\u0027,"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2Bbs%3D","line":1502,"in_reply_to":"AAAACn%2F%2F%2Bjc%3D","updated":"2011-11-15 15:12:37.000000000","message":"I know this is not related to the scheduler-file implementation, but guarantees a higher test coveage without incrementing the unit test time considerably.","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"986abe297c62a9b62bfd5562a780fa0315952802","unresolved":false,"context_lines":[{"line_number":1526,"context_line":"        db.compute_node_create(self.context.elevated(), dic)"},{"line_number":1527,"context_line":"        return db.service_get(self.context.elevated(), s_ref[\u0027id\u0027])"},{"line_number":1528,"context_line":""},{"line_number":1529,"context_line":"    def test_file_defind_host(self):"},{"line_number":1530,"context_line":"        \"\"\"Make sure the instance will be scheduled to the file defined host\"\"\""},{"line_number":1531,"context_line":"        self.flags(hostfile_cache_expire\u003d0)  # disable caching"},{"line_number":1532,"context_line":"        s_ref1 \u003d self._create_compute_service(host\u003d\u0027host1\u0027)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2Bjk%3D","line":1529,"updated":"2011-11-14 19:40:31.000000000","message":"defind?","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"27eb216f994673f16f0ffb71baa02443930e7f3a","unresolved":false,"context_lines":[{"line_number":1526,"context_line":"        db.compute_node_create(self.context.elevated(), dic)"},{"line_number":1527,"context_line":"        return db.service_get(self.context.elevated(), s_ref[\u0027id\u0027])"},{"line_number":1528,"context_line":""},{"line_number":1529,"context_line":"    def test_file_defind_host(self):"},{"line_number":1530,"context_line":"        \"\"\"Make sure the instance will be scheduled to the file defined host\"\"\""},{"line_number":1531,"context_line":"        self.flags(hostfile_cache_expire\u003d0)  # disable caching"},{"line_number":1532,"context_line":"        s_ref1 \u003d self._create_compute_service(host\u003d\u0027host1\u0027)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2BcM%3D","line":1529,"in_reply_to":"AAAACn%2F%2F%2Bjk%3D","updated":"2011-11-15 15:12:37.000000000","message":"Done","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"986abe297c62a9b62bfd5562a780fa0315952802","unresolved":false,"context_lines":[{"line_number":1541,"context_line":"                                                    request_spec)"},{"line_number":1542,"context_line":"        self.assertEqual(_picked_host, \u0027host1\u0027)"},{"line_number":1543,"context_line":""},{"line_number":1544,"context_line":"        #cleanup"},{"line_number":1545,"context_line":"        os.remove(os.path.join(FLAGS.sch_hosts_path, self.user_id))"},{"line_number":1546,"context_line":"        db.service_destroy(self.context.elevated(), s_ref1[\u0027id\u0027])"},{"line_number":1547,"context_line":"        db.service_destroy(self.context.elevated(), s_ref2[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2Bjg%3D","line":1544,"updated":"2011-11-14 19:40:31.000000000","message":"Bogus comment (and not pep8)\ncleanup should be done in teardown in the event the test fails","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"27eb216f994673f16f0ffb71baa02443930e7f3a","unresolved":false,"context_lines":[{"line_number":1541,"context_line":"                                                    request_spec)"},{"line_number":1542,"context_line":"        self.assertEqual(_picked_host, \u0027host1\u0027)"},{"line_number":1543,"context_line":""},{"line_number":1544,"context_line":"        #cleanup"},{"line_number":1545,"context_line":"        os.remove(os.path.join(FLAGS.sch_hosts_path, self.user_id))"},{"line_number":1546,"context_line":"        db.service_destroy(self.context.elevated(), s_ref1[\u0027id\u0027])"},{"line_number":1547,"context_line":"        db.service_destroy(self.context.elevated(), s_ref2[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2BbY%3D","line":1544,"in_reply_to":"AAAACn%2F%2F%2Bjg%3D","updated":"2011-11-15 15:12:37.000000000","message":"Done","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"986abe297c62a9b62bfd5562a780fa0315952802","unresolved":false,"context_lines":[{"line_number":1562,"context_line":"                         self.scheduler.driver.schedule_run_instance,"},{"line_number":1563,"context_line":"                         self.context, request_spec)"},{"line_number":1564,"context_line":""},{"line_number":1565,"context_line":"        #cleanup"},{"line_number":1566,"context_line":"        os.remove(os.path.join(FLAGS.sch_hosts_path, self.user_id))"},{"line_number":1567,"context_line":"        db.service_destroy(self.context.elevated(), s_ref[\u0027id\u0027])"},{"line_number":1568,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2Biw%3D","line":1565,"updated":"2011-11-14 19:40:31.000000000","message":"unnecessary (cleanup should be done in teardown in the event the test fails)","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"27eb216f994673f16f0ffb71baa02443930e7f3a","unresolved":false,"context_lines":[{"line_number":1562,"context_line":"                         self.scheduler.driver.schedule_run_instance,"},{"line_number":1563,"context_line":"                         self.context, request_spec)"},{"line_number":1564,"context_line":""},{"line_number":1565,"context_line":"        #cleanup"},{"line_number":1566,"context_line":"        os.remove(os.path.join(FLAGS.sch_hosts_path, self.user_id))"},{"line_number":1567,"context_line":"        db.service_destroy(self.context.elevated(), s_ref[\u0027id\u0027])"},{"line_number":1568,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2Bbc%3D","line":1565,"in_reply_to":"AAAACn%2F%2F%2Biw%3D","updated":"2011-11-15 15:12:37.000000000","message":"Done","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"986abe297c62a9b62bfd5562a780fa0315952802","unresolved":false,"context_lines":[{"line_number":1586,"context_line":"                         self.scheduler.driver.schedule_run_instance,"},{"line_number":1587,"context_line":"                         self.context, request_spec)"},{"line_number":1588,"context_line":""},{"line_number":1589,"context_line":"        #cleanup"},{"line_number":1590,"context_line":"        os.remove(os.path.join(FLAGS.sch_hosts_path, self.user_id))"},{"line_number":1591,"context_line":"        db.service_destroy(self.context.elevated(), s_ref1[\u0027id\u0027])"},{"line_number":1592,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2Bi0%3D","line":1589,"updated":"2011-11-14 19:40:31.000000000","message":"unnecessary (cleanup should be done in teardown in the event the test fails)","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"27eb216f994673f16f0ffb71baa02443930e7f3a","unresolved":false,"context_lines":[{"line_number":1586,"context_line":"                         self.scheduler.driver.schedule_run_instance,"},{"line_number":1587,"context_line":"                         self.context, request_spec)"},{"line_number":1588,"context_line":""},{"line_number":1589,"context_line":"        #cleanup"},{"line_number":1590,"context_line":"        os.remove(os.path.join(FLAGS.sch_hosts_path, self.user_id))"},{"line_number":1591,"context_line":"        db.service_destroy(self.context.elevated(), s_ref1[\u0027id\u0027])"},{"line_number":1592,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2BbU%3D","line":1589,"in_reply_to":"AAAACn%2F%2F%2Bi0%3D","updated":"2011-11-15 15:12:37.000000000","message":"Done","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"986abe297c62a9b62bfd5562a780fa0315952802","unresolved":false,"context_lines":[{"line_number":1606,"context_line":"        #cleanup"},{"line_number":1607,"context_line":"        db.service_destroy(self.context.elevated(), s_ref[\u0027id\u0027])"},{"line_number":1608,"context_line":""},{"line_number":1609,"context_line":"    def test_cache(self):"},{"line_number":1610,"context_line":"        \"\"\"Make sure the cached value is used until it expires\"\"\""},{"line_number":1611,"context_line":"        self.flags(hostfile_cache_expire\u003d30)"},{"line_number":1612,"context_line":"        s_ref1 \u003d self._create_compute_service(host\u003d\u0027host1\u0027)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2Bio%3D","line":1609,"updated":"2011-11-14 19:40:31.000000000","message":"Need test for working cache (before and after timeout)","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"27eb216f994673f16f0ffb71baa02443930e7f3a","unresolved":false,"context_lines":[{"line_number":1606,"context_line":"        #cleanup"},{"line_number":1607,"context_line":"        db.service_destroy(self.context.elevated(), s_ref[\u0027id\u0027])"},{"line_number":1608,"context_line":""},{"line_number":1609,"context_line":"    def test_cache(self):"},{"line_number":1610,"context_line":"        \"\"\"Make sure the cached value is used until it expires\"\"\""},{"line_number":1611,"context_line":"        self.flags(hostfile_cache_expire\u003d30)"},{"line_number":1612,"context_line":"        s_ref1 \u003d self._create_compute_service(host\u003d\u0027host1\u0027)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2BcI%3D","line":1609,"in_reply_to":"AAAACn%2F%2F%2Bio%3D","updated":"2011-11-15 15:12:37.000000000","message":"Actually this test case implements the whole cache testing:\n\n1- checks that after calling schedule_run_instance the value is saved in memory (user_host_mapipng dict)\n2-  deletes the host definition file and runs schedule_run_instance again, checking that the cached value is used\n3- change the \"cached-at\" of the cached value, so it is considered expired, and check that the random algorithm is applied (because the host definition file no longer exists and the cache has expired).\n\nNote that the \"disable cached\" scenario is tested in the other tests of this class.\nPlease, tell me if I miss any case!","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":688,"name":"Sandy Walsh","email":"sandy.walsh@rackspace.com","username":"sandy-walsh"},"change_message_id":"986abe297c62a9b62bfd5562a780fa0315952802","unresolved":false,"context_lines":[{"line_number":1634,"context_line":"        self.scheduler.driver.schedule_run_instance(self.context, request_spec)"},{"line_number":1635,"context_line":"        self.assertEqual(_picked_host, \u0027host2\u0027)"},{"line_number":1636,"context_line":""},{"line_number":1637,"context_line":"        #cleanup"},{"line_number":1638,"context_line":"        db.service_destroy(self.context.elevated(), s_ref1[\u0027id\u0027])"},{"line_number":1639,"context_line":"        db.service_destroy(self.context.elevated(), s_ref2[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2Bis%3D","line":1637,"updated":"2011-11-14 19:40:31.000000000","message":"unnecessary (cleanup should be done in teardown in the event the test fails)","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"},{"author":{"_account_id":1861,"name":"david-perez5","username":"david-perez5"},"change_message_id":"27eb216f994673f16f0ffb71baa02443930e7f3a","unresolved":false,"context_lines":[{"line_number":1634,"context_line":"        self.scheduler.driver.schedule_run_instance(self.context, request_spec)"},{"line_number":1635,"context_line":"        self.assertEqual(_picked_host, \u0027host2\u0027)"},{"line_number":1636,"context_line":""},{"line_number":1637,"context_line":"        #cleanup"},{"line_number":1638,"context_line":"        db.service_destroy(self.context.elevated(), s_ref1[\u0027id\u0027])"},{"line_number":1639,"context_line":"        db.service_destroy(self.context.elevated(), s_ref2[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAACn%2F%2F%2BbQ%3D","line":1637,"in_reply_to":"AAAACn%2F%2F%2Bis%3D","updated":"2011-11-15 15:12:37.000000000","message":"Done","commit_id":"43c93a695f2350af7fc3982c676ea5ff01fcd8b7"}]}
