)]}'
{"neutron/agent/linux/dhcp.py":[{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"4c7616a3cdb320a2d46c9acaded88cb1bbcc64ab","unresolved":false,"context_lines":[{"line_number":473,"context_line":"    def _output_init_lease_file(self):"},{"line_number":474,"context_line":"        \"\"\"Write a fake lease file if one does not already exist."},{"line_number":475,"context_line":""},{"line_number":476,"context_line":"        The generated file is passed to the --dhcp-leasefile option of dnsmasq."},{"line_number":477,"context_line":"        This is used as a bootstrapping mechanism to avoid NAKing active leases"},{"line_number":478,"context_line":"        when a dhcp server is scheduled to another agent."},{"line_number":479,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"7a016987_588778d7","line":476,"updated":"2015-05-27 07:51:17.000000000","message":"I wonder if with this mechanism we really need persistent leases... anyway it does not make any difference now i believe.","commit_id":"4aba83fd22c8880a2d24f27e43a32cc164abe3e0"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"ec7ba42107e3fe71c7d03914c48a9870275ef28e","unresolved":false,"context_lines":[{"line_number":473,"context_line":"    def _output_init_lease_file(self):"},{"line_number":474,"context_line":"        \"\"\"Write a fake lease file if one does not already exist."},{"line_number":475,"context_line":""},{"line_number":476,"context_line":"        The generated file is passed to the --dhcp-leasefile option of dnsmasq."},{"line_number":477,"context_line":"        This is used as a bootstrapping mechanism to avoid NAKing active leases"},{"line_number":478,"context_line":"        when a dhcp server is scheduled to another agent."},{"line_number":479,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"7a016987_d330e9ea","line":476,"in_reply_to":"7a016987_588778d7","updated":"2015-05-27 08:13:20.000000000","message":"well this mechanism generates the persistent lease file. If we disable persistent leases, it won\u0027t read this...\n\nIf we do want to go that route, I can use this same mechanism to generate a dhcp-script that will echo this stuff during init, which populates the in-memory lease db. But that\u0027s a little more complex and makes dnsmasq call a child script every time there is a renewal/etc.","commit_id":"4aba83fd22c8880a2d24f27e43a32cc164abe3e0"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"4c7616a3cdb320a2d46c9acaded88cb1bbcc64ab","unresolved":false,"context_lines":[{"line_number":482,"context_line":"        \"\"\""},{"line_number":483,"context_line":"        if self.conf.dhcp_lease_duration \u003d\u003d -1:"},{"line_number":484,"context_line":"            LOG.debug(\"Skipping initial lease file because lease duration is \""},{"line_number":485,"context_line":"                      \"infinite. Clients with leases won\u0027t renew.\")"},{"line_number":486,"context_line":"            return"},{"line_number":487,"context_line":"        filename \u003d self.get_conf_file_name(\u0027leases\u0027)"},{"line_number":488,"context_line":"        buf \u003d six.StringIO()"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a016987_5802d870","line":485,"updated":"2015-05-27 07:51:17.000000000","message":"if they reboot I believe they will try and rebind","commit_id":"4aba83fd22c8880a2d24f27e43a32cc164abe3e0"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"ec7ba42107e3fe71c7d03914c48a9870275ef28e","unresolved":false,"context_lines":[{"line_number":482,"context_line":"        \"\"\""},{"line_number":483,"context_line":"        if self.conf.dhcp_lease_duration \u003d\u003d -1:"},{"line_number":484,"context_line":"            LOG.debug(\"Skipping initial lease file because lease duration is \""},{"line_number":485,"context_line":"                      \"infinite. Clients with leases won\u0027t renew.\")"},{"line_number":486,"context_line":"            return"},{"line_number":487,"context_line":"        filename \u003d self.get_conf_file_name(\u0027leases\u0027)"},{"line_number":488,"context_line":"        buf \u003d six.StringIO()"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a016987_f361a5d4","line":485,"in_reply_to":"7a016987_5802d870","updated":"2015-05-27 08:13:20.000000000","message":"I assumed they would just do a discover, but if some clients try to renew their old lease, then I suppose I should generate the file anyway.","commit_id":"4aba83fd22c8880a2d24f27e43a32cc164abe3e0"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"4c7616a3cdb320a2d46c9acaded88cb1bbcc64ab","unresolved":false,"context_lines":[{"line_number":487,"context_line":"        filename \u003d self.get_conf_file_name(\u0027leases\u0027)"},{"line_number":488,"context_line":"        buf \u003d six.StringIO()"},{"line_number":489,"context_line":""},{"line_number":490,"context_line":"        LOG.debug(\u0027Building initial lease file: %s\u0027, filename)"},{"line_number":491,"context_line":"        # we make up a lease time for the database entry"},{"line_number":492,"context_line":"        timestamp \u003d int(time.time()) + self.conf.dhcp_lease_duration"},{"line_number":493,"context_line":"        dhcp_enabled_subnet_ids \u003d [s.id for s in self.network.subnets"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a016987_987df0e9","line":490,"updated":"2015-05-27 07:51:17.000000000","message":"the log reveal this file is being generated pretty much at every HUP, which, as already discussed, is the way to go.\nSo perhaps there\u0027s no need to use \"initial\"","commit_id":"4aba83fd22c8880a2d24f27e43a32cc164abe3e0"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"ec7ba42107e3fe71c7d03914c48a9870275ef28e","unresolved":false,"context_lines":[{"line_number":487,"context_line":"        filename \u003d self.get_conf_file_name(\u0027leases\u0027)"},{"line_number":488,"context_line":"        buf \u003d six.StringIO()"},{"line_number":489,"context_line":""},{"line_number":490,"context_line":"        LOG.debug(\u0027Building initial lease file: %s\u0027, filename)"},{"line_number":491,"context_line":"        # we make up a lease time for the database entry"},{"line_number":492,"context_line":"        timestamp \u003d int(time.time()) + self.conf.dhcp_lease_duration"},{"line_number":493,"context_line":"        dhcp_enabled_subnet_ids \u003d [s.id for s in self.network.subnets"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a016987_13f681d7","line":490,"in_reply_to":"7a016987_987df0e9","updated":"2015-05-27 08:13:20.000000000","message":"Makes sense, but actually I wonder if regenerating at every HUP is too much. Would it make more sense to move it into spawn_process so it\u0027s only called the first time it\u0027s started up?","commit_id":"4aba83fd22c8880a2d24f27e43a32cc164abe3e0"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"4c7616a3cdb320a2d46c9acaded88cb1bbcc64ab","unresolved":false,"context_lines":[{"line_number":502,"context_line":"                ip_address \u003d \u0027[%s]\u0027 % ip_address"},{"line_number":503,"context_line":"            # we need something for hostname, doesn\u0027t need to match client"},{"line_number":504,"context_line":"            hostname \u003d \u0027host-%s\u0027 % \u0027\u0027.join([c for c in ip_address"},{"line_number":505,"context_line":"                                            if c.isalnum()][-58:])"},{"line_number":506,"context_line":"            buf.write(\u0027%s %s %s %s *\\n\u0027 %"},{"line_number":507,"context_line":"                      (timestamp, port.mac_address, ip_address, hostname))"},{"line_number":508,"context_line":"        utils.replace_file(filename, buf.getvalue())"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a016987_f8daa416","line":505,"updated":"2015-05-27 07:51:17.000000000","message":"I wonder why the hostnames generated by _iter_hosts did not work for you\n\nalso the hosts file and the lease file have different hostnames:\nhttp://paste.openstack.org/show/239416/","commit_id":"4aba83fd22c8880a2d24f27e43a32cc164abe3e0"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"ec7ba42107e3fe71c7d03914c48a9870275ef28e","unresolved":false,"context_lines":[{"line_number":502,"context_line":"                ip_address \u003d \u0027[%s]\u0027 % ip_address"},{"line_number":503,"context_line":"            # we need something for hostname, doesn\u0027t need to match client"},{"line_number":504,"context_line":"            hostname \u003d \u0027host-%s\u0027 % \u0027\u0027.join([c for c in ip_address"},{"line_number":505,"context_line":"                                            if c.isalnum()][-58:])"},{"line_number":506,"context_line":"            buf.write(\u0027%s %s %s %s *\\n\u0027 %"},{"line_number":507,"context_line":"                      (timestamp, port.mac_address, ip_address, hostname))"},{"line_number":508,"context_line":"        utils.replace_file(filename, buf.getvalue())"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a016987_73dc9546","line":505,"in_reply_to":"7a016987_f8daa416","updated":"2015-05-27 08:13:20.000000000","message":"The hostname there doesn\u0027t matter too much. It will be overwritten on the next client renewal. After local testing, it looks like I can just put a * there.","commit_id":"4aba83fd22c8880a2d24f27e43a32cc164abe3e0"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"db33dce919798a46e099b0b47e7f063f0b4c8be8","unresolved":false,"context_lines":[{"line_number":504,"context_line":"            hostname \u003d \u0027host-%s\u0027 % \u0027\u0027.join([c for c in ip_address"},{"line_number":505,"context_line":"                                            if c.isalnum()][-58:])"},{"line_number":506,"context_line":"            buf.write(\u0027%s %s %s %s *\\n\u0027 %"},{"line_number":507,"context_line":"                      (timestamp, port.mac_address, ip_address, hostname))"},{"line_number":508,"context_line":"        utils.replace_file(filename, buf.getvalue())"},{"line_number":509,"context_line":"        LOG.debug(\u0027Done building initial lease file %s with contents:\\n%s\u0027,"},{"line_number":510,"context_line":"                  filename, buf.getvalue())"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a016987_781fd45b","line":507,"updated":"2015-05-27 07:29:24.000000000","message":"I recently added client id support to master  sso according to dnsmasq code is seem it should be \nclient_id \u003d self._get_client_id(port)\nif client_id:\n       buf.write(\u0027%s %s %s %s %s\\n\u0027 % (timestamp, port.mac_address, ip_address, hostname, client_id)\nelse: \n       buf.write(\u0027%s %s %s %s %s *\\n\u0027 % (timestamp, port.mac_address, ip_address, hostname)\n\n\nplease see Line 289 in http://thekelleys.org.uk/gitweb/?p\u003ddnsmasq.git;a\u003dblob;f\u003dsrc/lease.c;h\u003d8adb60588671324d9ddf00d7dab40474d40d4393;hb\u003dHEAD","commit_id":"4aba83fd22c8880a2d24f27e43a32cc164abe3e0"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"e73b401e422cf041b09265d2303e39907a3a25e3","unresolved":false,"context_lines":[{"line_number":504,"context_line":"            hostname \u003d \u0027host-%s\u0027 % \u0027\u0027.join([c for c in ip_address"},{"line_number":505,"context_line":"                                            if c.isalnum()][-58:])"},{"line_number":506,"context_line":"            buf.write(\u0027%s %s %s %s *\\n\u0027 %"},{"line_number":507,"context_line":"                      (timestamp, port.mac_address, ip_address, hostname))"},{"line_number":508,"context_line":"        utils.replace_file(filename, buf.getvalue())"},{"line_number":509,"context_line":"        LOG.debug(\u0027Done building initial lease file %s with contents:\\n%s\u0027,"},{"line_number":510,"context_line":"                  filename, buf.getvalue())"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a016987_f8750432","line":507,"in_reply_to":"7a016987_781fd45b","updated":"2015-05-27 07:40:53.000000000","message":"Does it matter? In my testing it will just replace it with the correct client ID on the next renewal.","commit_id":"4aba83fd22c8880a2d24f27e43a32cc164abe3e0"},{"author":{"_account_id":12171,"name":"Moshe Levi","email":"moshele@nvidia.com","username":"moshele"},"change_message_id":"e7bfe45d4d41b248bbe77de4d628275f452a2b37","unresolved":false,"context_lines":[{"line_number":504,"context_line":"            hostname \u003d \u0027host-%s\u0027 % \u0027\u0027.join([c for c in ip_address"},{"line_number":505,"context_line":"                                            if c.isalnum()][-58:])"},{"line_number":506,"context_line":"            buf.write(\u0027%s %s %s %s *\\n\u0027 %"},{"line_number":507,"context_line":"                      (timestamp, port.mac_address, ip_address, hostname))"},{"line_number":508,"context_line":"        utils.replace_file(filename, buf.getvalue())"},{"line_number":509,"context_line":"        LOG.debug(\u0027Done building initial lease file %s with contents:\\n%s\u0027,"},{"line_number":510,"context_line":"                  filename, buf.getvalue())"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a016987_133e81b8","line":507,"in_reply_to":"7a016987_d845a8b3","updated":"2015-05-27 08:00:14.000000000","message":"ok, so I guess it doesn\u0027t matter","commit_id":"4aba83fd22c8880a2d24f27e43a32cc164abe3e0"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"8f749dbc6d9e1f4c5cc27f345d2cc548914032a2","unresolved":false,"context_lines":[{"line_number":504,"context_line":"            hostname \u003d \u0027host-%s\u0027 % \u0027\u0027.join([c for c in ip_address"},{"line_number":505,"context_line":"                                            if c.isalnum()][-58:])"},{"line_number":506,"context_line":"            buf.write(\u0027%s %s %s %s *\\n\u0027 %"},{"line_number":507,"context_line":"                      (timestamp, port.mac_address, ip_address, hostname))"},{"line_number":508,"context_line":"        utils.replace_file(filename, buf.getvalue())"},{"line_number":509,"context_line":"        LOG.debug(\u0027Done building initial lease file %s with contents:\\n%s\u0027,"},{"line_number":510,"context_line":"                  filename, buf.getvalue())"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a016987_d845a8b3","line":507,"in_reply_to":"7a016987_f8750432","updated":"2015-05-27 07:46:06.000000000","message":"I ask because the intention here isn\u0027t to create the exact leases file, it\u0027s only to make sure that a client renewal isn\u0027t ignored or NAKed.","commit_id":"4aba83fd22c8880a2d24f27e43a32cc164abe3e0"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"16e3baf7efb15c42af72f7782eea1683bff0b076","unresolved":false,"context_lines":[{"line_number":382,"context_line":""},{"line_number":383,"context_line":"    def spawn_process(self):"},{"line_number":384,"context_line":"        \"\"\"Spawn the process, if it\u0027s not spawned already.\"\"\""},{"line_number":385,"context_line":"        # we only need to lease file the first time dnsmasq starts"},{"line_number":386,"context_line":"        self._output_init_lease_file()"},{"line_number":387,"context_line":"        self._spawn_or_reload_process(reload_with_HUP\u003dFalse)"},{"line_number":388,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"7a016987_d4d32cd4","line":385,"updated":"2015-05-27 11:52:11.000000000","message":"That is to handle reload_allocations case, right? btw you have a tiny typo (missing verb before \u0027lease\u0027).","commit_id":"568fb41268714f5bd71a5892fb902b425e1640ac"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"26eaad4d687f3711601943ea0cf84f790f84b350","unresolved":false,"context_lines":[{"line_number":382,"context_line":""},{"line_number":383,"context_line":"    def spawn_process(self):"},{"line_number":384,"context_line":"        \"\"\"Spawn the process, if it\u0027s not spawned already.\"\"\""},{"line_number":385,"context_line":"        # we only need to lease file the first time dnsmasq starts"},{"line_number":386,"context_line":"        self._output_init_lease_file()"},{"line_number":387,"context_line":"        self._spawn_or_reload_process(reload_with_HUP\u003dFalse)"},{"line_number":388,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"7a016987_d73af5e6","line":385,"in_reply_to":"7a016987_d4d32cd4","updated":"2015-05-27 20:58:20.000000000","message":"yes, i\u0027ll clarify","commit_id":"568fb41268714f5bd71a5892fb902b425e1640ac"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"16e3baf7efb15c42af72f7782eea1683bff0b076","unresolved":false,"context_lines":[{"line_number":472,"context_line":"        return getattr(port, edo_ext.EXTRADHCPOPTS, False)"},{"line_number":473,"context_line":""},{"line_number":474,"context_line":"    def _output_init_lease_file(self):"},{"line_number":475,"context_line":"        \"\"\"Write a fake lease file if one does not already exist."},{"line_number":476,"context_line":""},{"line_number":477,"context_line":"        The generated file is passed to the --dhcp-leasefile option of dnsmasq."},{"line_number":478,"context_line":"        This is used as a bootstrapping mechanism to avoid NAKing active leases"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a016987_b7ce7281","line":475,"updated":"2015-05-27 11:52:11.000000000","message":"Actually, it writes it unconditionally. And that\u0027s the proper behaviour since we want to update it with new leases.","commit_id":"568fb41268714f5bd71a5892fb902b425e1640ac"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"26eaad4d687f3711601943ea0cf84f790f84b350","unresolved":false,"context_lines":[{"line_number":472,"context_line":"        return getattr(port, edo_ext.EXTRADHCPOPTS, False)"},{"line_number":473,"context_line":""},{"line_number":474,"context_line":"    def _output_init_lease_file(self):"},{"line_number":475,"context_line":"        \"\"\"Write a fake lease file if one does not already exist."},{"line_number":476,"context_line":""},{"line_number":477,"context_line":"        The generated file is passed to the --dhcp-leasefile option of dnsmasq."},{"line_number":478,"context_line":"        This is used as a bootstrapping mechanism to avoid NAKing active leases"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a016987_97259dc3","line":475,"in_reply_to":"7a016987_b7ce7281","updated":"2015-05-27 20:58:20.000000000","message":"Done","commit_id":"568fb41268714f5bd71a5892fb902b425e1640ac"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"16e3baf7efb15c42af72f7782eea1683bff0b076","unresolved":false,"context_lines":[{"line_number":476,"context_line":""},{"line_number":477,"context_line":"        The generated file is passed to the --dhcp-leasefile option of dnsmasq."},{"line_number":478,"context_line":"        This is used as a bootstrapping mechanism to avoid NAKing active leases"},{"line_number":479,"context_line":"        when a dhcp server is scheduled to another agent."},{"line_number":480,"context_line":""},{"line_number":481,"context_line":"        Format is as follows:"},{"line_number":482,"context_line":"        epoch-timestamp mac_addr ip_addr hostname client-ID"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a016987_b7955241","line":479,"updated":"2015-05-27 11:52:11.000000000","message":"...or restarted (the original bug that introduced the regression).","commit_id":"568fb41268714f5bd71a5892fb902b425e1640ac"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"26eaad4d687f3711601943ea0cf84f790f84b350","unresolved":false,"context_lines":[{"line_number":476,"context_line":""},{"line_number":477,"context_line":"        The generated file is passed to the --dhcp-leasefile option of dnsmasq."},{"line_number":478,"context_line":"        This is used as a bootstrapping mechanism to avoid NAKing active leases"},{"line_number":479,"context_line":"        when a dhcp server is scheduled to another agent."},{"line_number":480,"context_line":""},{"line_number":481,"context_line":"        Format is as follows:"},{"line_number":482,"context_line":"        epoch-timestamp mac_addr ip_addr hostname client-ID"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a016987_37014907","line":479,"in_reply_to":"7a016987_b7955241","updated":"2015-05-27 20:58:20.000000000","message":"well just having dnsmasq write to a lease file will fix that. generating the file is only needed for the rescheduling case.","commit_id":"568fb41268714f5bd71a5892fb902b425e1640ac"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"16e3baf7efb15c42af72f7782eea1683bff0b076","unresolved":false,"context_lines":[{"line_number":490,"context_line":"            # Even with an infinite lease, a client may choose to renew a"},{"line_number":491,"context_line":"            # previous lease on reboot or interface bounce so we should have"},{"line_number":492,"context_line":"            # an entry for it."},{"line_number":493,"context_line":"            delta \u003d 3 * 365 * 86400"},{"line_number":494,"context_line":"        else:"},{"line_number":495,"context_line":"            delta \u003d self.conf.dhcp_lease_duration"},{"line_number":496,"context_line":"        timestamp \u003d int(time.time()) + delta"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a016987_972136ff","line":493,"updated":"2015-05-27 11:52:11.000000000","message":"Seems not that infinite. dnsmasq uses 0xffffffff as lease time value in case \u0027infinite\u0027 is passed to dhcp-range or dhcp-host. Any reason why we don\u0027t do the same for timestamp?","commit_id":"568fb41268714f5bd71a5892fb902b425e1640ac"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"26eaad4d687f3711601943ea0cf84f790f84b350","unresolved":false,"context_lines":[{"line_number":490,"context_line":"            # Even with an infinite lease, a client may choose to renew a"},{"line_number":491,"context_line":"            # previous lease on reboot or interface bounce so we should have"},{"line_number":492,"context_line":"            # an entry for it."},{"line_number":493,"context_line":"            delta \u003d 3 * 365 * 86400"},{"line_number":494,"context_line":"        else:"},{"line_number":495,"context_line":"            delta \u003d self.conf.dhcp_lease_duration"},{"line_number":496,"context_line":"        timestamp \u003d int(time.time()) + delta"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a016987_32183775","line":493,"in_reply_to":"7a016987_972136ff","updated":"2015-05-27 20:58:20.000000000","message":"i was being lazy. I just just tested and the lease database format for an infinite lease actually sets it to 0. Will update\n\n0 fa:16:3e:ee:cd:6b 42.42.42.11 host-42-42-42-11 01:fa:16:3e:ee:cd:6b","commit_id":"568fb41268714f5bd71a5892fb902b425e1640ac"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"16e3baf7efb15c42af72f7782eea1683bff0b076","unresolved":false,"context_lines":[{"line_number":501,"context_line":"            if not alloc or alloc.subnet_id not in dhcp_enabled_subnet_ids:"},{"line_number":502,"context_line":"                continue"},{"line_number":503,"context_line":""},{"line_number":504,"context_line":"            ip_address \u003d alloc.ip_address"},{"line_number":505,"context_line":"            if netaddr.valid_ipv6(ip_address):"},{"line_number":506,"context_line":"                ip_address \u003d \u0027[%s]\u0027 % ip_address"},{"line_number":507,"context_line":"            # all that matters is the mac address and IP. the hostname and"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a016987_b72552c3","line":504,"updated":"2015-05-27 11:52:11.000000000","message":"That [%s] converter is copy-pasted from _output_hosts_file. I suggest introducing a separate utility function just for that.","commit_id":"568fb41268714f5bd71a5892fb902b425e1640ac"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"26eaad4d687f3711601943ea0cf84f790f84b350","unresolved":false,"context_lines":[{"line_number":501,"context_line":"            if not alloc or alloc.subnet_id not in dhcp_enabled_subnet_ids:"},{"line_number":502,"context_line":"                continue"},{"line_number":503,"context_line":""},{"line_number":504,"context_line":"            ip_address \u003d alloc.ip_address"},{"line_number":505,"context_line":"            if netaddr.valid_ipv6(ip_address):"},{"line_number":506,"context_line":"                ip_address \u003d \u0027[%s]\u0027 % ip_address"},{"line_number":507,"context_line":"            # all that matters is the mac address and IP. the hostname and"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a016987_5234d3dc","line":504,"in_reply_to":"7a016987_b72552c3","updated":"2015-05-27 20:58:20.000000000","message":"ok","commit_id":"568fb41268714f5bd71a5892fb902b425e1640ac"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"16e3baf7efb15c42af72f7782eea1683bff0b076","unresolved":false,"context_lines":[{"line_number":510,"context_line":"                      (timestamp, port.mac_address, ip_address))"},{"line_number":511,"context_line":"        utils.replace_file(filename, buf.getvalue())"},{"line_number":512,"context_line":"        LOG.debug(\u0027Done building initial lease file %s with contents:\\n%s\u0027,"},{"line_number":513,"context_line":"                  filename, buf.getvalue())"},{"line_number":514,"context_line":"        return filename"},{"line_number":515,"context_line":""},{"line_number":516,"context_line":"    def _output_hosts_file(self):"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a016987_826c529d","line":513,"updated":"2015-05-27 11:52:11.000000000","message":"nit: calculating buf.getvalue() once would buy you 5 to 10% boost (that\u0027s what I see in my local venv).","commit_id":"568fb41268714f5bd71a5892fb902b425e1640ac"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"26eaad4d687f3711601943ea0cf84f790f84b350","unresolved":false,"context_lines":[{"line_number":510,"context_line":"                      (timestamp, port.mac_address, ip_address))"},{"line_number":511,"context_line":"        utils.replace_file(filename, buf.getvalue())"},{"line_number":512,"context_line":"        LOG.debug(\u0027Done building initial lease file %s with contents:\\n%s\u0027,"},{"line_number":513,"context_line":"                  filename, buf.getvalue())"},{"line_number":514,"context_line":"        return filename"},{"line_number":515,"context_line":""},{"line_number":516,"context_line":"    def _output_hosts_file(self):"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a016987_322f178a","line":513,"in_reply_to":"7a016987_826c529d","updated":"2015-05-27 20:58:20.000000000","message":"Done","commit_id":"568fb41268714f5bd71a5892fb902b425e1640ac"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"1794a9aecd396858a23712454ad3fcd1f6affe98","unresolved":false,"context_lines":[{"line_number":493,"context_line":"            # Even with an infinite lease, a client may choose to renew a"},{"line_number":494,"context_line":"            # previous lease on reboot or interface bounce so we should have"},{"line_number":495,"context_line":"            # an entry for it."},{"line_number":496,"context_line":"            # Dnsmasq timestamp format for an infinite lease is  is 0."},{"line_number":497,"context_line":"            timestamp \u003d 0"},{"line_number":498,"context_line":"        else:"},{"line_number":499,"context_line":"            timestamp \u003d int(time.time()) + self.conf.dhcp_lease_duration"}],"source_content_type":"text/x-python","patch_set":6,"id":"7a016987_4044e819","line":496,"updated":"2015-05-28 09:42:54.000000000","message":"nit: is is -\u003e is","commit_id":"98d8ad911d07a20af18edb0cac4bcf141a83d969"}],"neutron/tests/unit/agent/linux/test_dhcp.py":[{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"4c7616a3cdb320a2d46c9acaded88cb1bbcc64ab","unresolved":false,"context_lines":[{"line_number":997,"context_line":"                         network)"},{"line_number":998,"context_line":""},{"line_number":999,"context_line":"    @mock.patch(\u0027time.time\u0027)"},{"line_number":1000,"context_line":"    def test_output_init_lease_file(self, tmock):"},{"line_number":1001,"context_line":"        expected \u003d ["},{"line_number":1002,"context_line":"            \u002700:00:80:aa:bb:cc 192.168.0.2 host-19216802 *\u0027,"},{"line_number":1003,"context_line":"            \u002700:00:f3:aa:bb:cc [fdca:3ba5:a17a:4ba3::2] \u0027"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a016987_f8e4e4ac","line":1000,"updated":"2015-05-27 07:51:17.000000000","message":"technically you would need tests to cover the code paths for subnet too, but this is a pedant nit.","commit_id":"4aba83fd22c8880a2d24f27e43a32cc164abe3e0"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"ec7ba42107e3fe71c7d03914c48a9870275ef28e","unresolved":false,"context_lines":[{"line_number":997,"context_line":"                         network)"},{"line_number":998,"context_line":""},{"line_number":999,"context_line":"    @mock.patch(\u0027time.time\u0027)"},{"line_number":1000,"context_line":"    def test_output_init_lease_file(self, tmock):"},{"line_number":1001,"context_line":"        expected \u003d ["},{"line_number":1002,"context_line":"            \u002700:00:80:aa:bb:cc 192.168.0.2 host-19216802 *\u0027,"},{"line_number":1003,"context_line":"            \u002700:00:f3:aa:bb:cc [fdca:3ba5:a17a:4ba3::2] \u0027"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a016987_d39b4971","line":1000,"in_reply_to":"7a016987_f8e4e4ac","updated":"2015-05-27 08:13:20.000000000","message":"do you mean to test dhcp disabled subnets?","commit_id":"4aba83fd22c8880a2d24f27e43a32cc164abe3e0"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"16e3baf7efb15c42af72f7782eea1683bff0b076","unresolved":false,"context_lines":[{"line_number":1004,"context_line":"            \u002700:00:0f:aa:bb:cc [fdca:3ba5:a17a:4ba3::3] * *\u0027,"},{"line_number":1005,"context_line":"            \u002700:00:0f:rr:rr:rr 192.168.0.1 * *\\n\u0027]"},{"line_number":1006,"context_line":"        tmock.return_value \u003d 1000000"},{"line_number":1007,"context_line":"        timestamp \u003d 1000000 + self.conf.dhcp_lease_duration"},{"line_number":1008,"context_line":"        expected \u003d \"\\n\".join([\u0027%s %s\u0027 % (timestamp, l) for l in expected])"},{"line_number":1009,"context_line":"        with mock.patch.object(dhcp.Dnsmasq, \u0027get_conf_file_name\u0027) as conf_fn:"},{"line_number":1010,"context_line":"            conf_fn.return_value \u003d \u0027/foo/leases\u0027"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a016987_a21bce1b","line":1007,"updated":"2015-05-27 11:52:11.000000000","message":"I suggest also checking for infinite lease case.","commit_id":"568fb41268714f5bd71a5892fb902b425e1640ac"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"26eaad4d687f3711601943ea0cf84f790f84b350","unresolved":false,"context_lines":[{"line_number":1004,"context_line":"            \u002700:00:0f:aa:bb:cc [fdca:3ba5:a17a:4ba3::3] * *\u0027,"},{"line_number":1005,"context_line":"            \u002700:00:0f:rr:rr:rr 192.168.0.1 * *\\n\u0027]"},{"line_number":1006,"context_line":"        tmock.return_value \u003d 1000000"},{"line_number":1007,"context_line":"        timestamp \u003d 1000000 + self.conf.dhcp_lease_duration"},{"line_number":1008,"context_line":"        expected \u003d \"\\n\".join([\u0027%s %s\u0027 % (timestamp, l) for l in expected])"},{"line_number":1009,"context_line":"        with mock.patch.object(dhcp.Dnsmasq, \u0027get_conf_file_name\u0027) as conf_fn:"},{"line_number":1010,"context_line":"            conf_fn.return_value \u003d \u0027/foo/leases\u0027"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a016987_526293d9","line":1007,"in_reply_to":"7a016987_a21bce1b","updated":"2015-05-27 20:58:20.000000000","message":"Done","commit_id":"568fb41268714f5bd71a5892fb902b425e1640ac"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"16e3baf7efb15c42af72f7782eea1683bff0b076","unresolved":false,"context_lines":[{"line_number":1010,"context_line":"            conf_fn.return_value \u003d \u0027/foo/leases\u0027"},{"line_number":1011,"context_line":"            dm \u003d self._get_dnsmasq(FakeDualNetwork())"},{"line_number":1012,"context_line":"            dm._output_init_lease_file()"},{"line_number":1013,"context_line":"        self.safe.assert_called_once_with(\u0027/foo/leases\u0027, expected)"},{"line_number":1014,"context_line":""},{"line_number":1015,"context_line":"    def _test_output_opts_file(self, expected, network, ipm_retval\u003dNone):"},{"line_number":1016,"context_line":"        with mock.patch.object(dhcp.Dnsmasq, \u0027get_conf_file_name\u0027) as conf_fn:"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a016987_62a83678","line":1013,"updated":"2015-05-27 11:52:11.000000000","message":"It seems you don\u0027t really care about the first argument. In that case, you could just match against mock.ANY.","commit_id":"568fb41268714f5bd71a5892fb902b425e1640ac"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"26eaad4d687f3711601943ea0cf84f790f84b350","unresolved":false,"context_lines":[{"line_number":1010,"context_line":"            conf_fn.return_value \u003d \u0027/foo/leases\u0027"},{"line_number":1011,"context_line":"            dm \u003d self._get_dnsmasq(FakeDualNetwork())"},{"line_number":1012,"context_line":"            dm._output_init_lease_file()"},{"line_number":1013,"context_line":"        self.safe.assert_called_once_with(\u0027/foo/leases\u0027, expected)"},{"line_number":1014,"context_line":""},{"line_number":1015,"context_line":"    def _test_output_opts_file(self, expected, network, ipm_retval\u003dNone):"},{"line_number":1016,"context_line":"        with mock.patch.object(dhcp.Dnsmasq, \u0027get_conf_file_name\u0027) as conf_fn:"}],"source_content_type":"text/x-python","patch_set":5,"id":"7a016987_72634fde","line":1013,"in_reply_to":"7a016987_62a83678","updated":"2015-05-27 20:58:20.000000000","message":"well this one makes sure that it\u0027s actually being written to the expected file. It does have some value.","commit_id":"568fb41268714f5bd71a5892fb902b425e1640ac"}]}
