)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":1779,"name":"Daniel Berrange","email":"berrange@redhat.com","username":"berrange"},"change_message_id":"bc7c08bcb52e98fcfe062176db76fe8122f46205","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Dan Smith \u003cdansmith@redhat.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2014-01-09 16:20:14 -0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Run fewer things as root"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Every time we run something as root with rootwrap, it takes about"},{"line_number":10,"context_line":"ten times longer (setup-wise anyway). For things that don\u0027t need"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"AAAAUH%2F%2Fnsc%3D","line":7,"updated":"2014-01-10 12:11:13.000000000","message":"Better subject would be \n\n  \"Avoid uncessary use of rootwrap for some network commands\"","commit_id":"3d63d01c8aebb371dfebfa9ccf1e921ed63318c8"}],"nova/network/linux_net.py":[{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"e06b38a056cc693a5858194ba517e1dfdbf97dae","unresolved":false,"context_lines":[{"line_number":811,"context_line":""},{"line_number":812,"context_line":"def _enable_ipv4_forwarding():"},{"line_number":813,"context_line":"    sysctl_key \u003d \u0027net.ipv4.ip_forward\u0027"},{"line_number":814,"context_line":"    stdout, stderr \u003d _execute(\u0027sysctl\u0027, \u0027-n\u0027, sysctl_key)"},{"line_number":815,"context_line":"    if stdout.strip() is not \u00271\u0027:"},{"line_number":816,"context_line":"        _execute(\u0027sysctl\u0027, \u0027-w\u0027, \u0027%s\u003d1\u0027 % sysctl_key, run_as_root\u003dTrue)"},{"line_number":817,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAUH%2F%2FoVs%3D","line":814,"updated":"2014-01-10 10:07:57.000000000","message":"I think it is not necessary to check this key. if this key already exists sysctl will change nothing.","commit_id":"3d63d01c8aebb371dfebfa9ccf1e921ed63318c8"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"57152bf786b28907344b716a6c955d027d65d111","unresolved":false,"context_lines":[{"line_number":811,"context_line":""},{"line_number":812,"context_line":"def _enable_ipv4_forwarding():"},{"line_number":813,"context_line":"    sysctl_key \u003d \u0027net.ipv4.ip_forward\u0027"},{"line_number":814,"context_line":"    stdout, stderr \u003d _execute(\u0027sysctl\u0027, \u0027-n\u0027, sysctl_key)"},{"line_number":815,"context_line":"    if stdout.strip() is not \u00271\u0027:"},{"line_number":816,"context_line":"        _execute(\u0027sysctl\u0027, \u0027-w\u0027, \u0027%s\u003d1\u0027 % sysctl_key, run_as_root\u003dTrue)"},{"line_number":817,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAUH%2F%2FnjM%3D","line":814,"updated":"2014-01-10 12:46:18.000000000","message":"Thanks for your response, I did some tests, I don\u0027t know if they are completely correct for real life. It looks like you are right, but i\u0027m  not really sure to know if it is relevant to add this method. I remove my -1 and waiting for Dan.\n\n[root@edge ~]# time for i in `seq 1 10000`; do sysctl -n net.ipv4.ip_forward \u003e\u003e /dev/null; done;\nreal    0m5.162s\nuser    0m0.237s\nsys     0m0.833s\n\n[root@edge ~]# time for i in `seq 1 10000`; do sysctl -w net.ipv4.ip_forward\u003d1 \u003e\u003e /dev/null; done;\nreal    0m5.311s\nuser    0m0.213s\nsys     0m0.920s","commit_id":"3d63d01c8aebb371dfebfa9ccf1e921ed63318c8"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"2b45cdfd9eacd06b6f9b65974fbb7659f97b7371","unresolved":false,"context_lines":[{"line_number":811,"context_line":""},{"line_number":812,"context_line":"def _enable_ipv4_forwarding():"},{"line_number":813,"context_line":"    sysctl_key \u003d \u0027net.ipv4.ip_forward\u0027"},{"line_number":814,"context_line":"    stdout, stderr \u003d _execute(\u0027sysctl\u0027, \u0027-n\u0027, sysctl_key)"},{"line_number":815,"context_line":"    if stdout.strip() is not \u00271\u0027:"},{"line_number":816,"context_line":"        _execute(\u0027sysctl\u0027, \u0027-w\u0027, \u0027%s\u003d1\u0027 % sysctl_key, run_as_root\u003dTrue)"},{"line_number":817,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAUH%2F%2FnSA%3D","line":814,"in_reply_to":"AAAAUH%2F%2FnVk%3D","updated":"2014-01-10 13:40:40.000000000","message":"@dims ...sorry, it\u0027s my mistake. I did not read your first comment enough well, now I understand.","commit_id":"3d63d01c8aebb371dfebfa9ccf1e921ed63318c8"},{"author":{"_account_id":5638,"name":"Davanum Srinivas","email":"davanum@gmail.com","username":"dims-v"},"change_message_id":"3f0843e53239f3376f1bd7fc091ab4611b1ad00a","unresolved":false,"context_lines":[{"line_number":811,"context_line":""},{"line_number":812,"context_line":"def _enable_ipv4_forwarding():"},{"line_number":813,"context_line":"    sysctl_key \u003d \u0027net.ipv4.ip_forward\u0027"},{"line_number":814,"context_line":"    stdout, stderr \u003d _execute(\u0027sysctl\u0027, \u0027-n\u0027, sysctl_key)"},{"line_number":815,"context_line":"    if stdout.strip() is not \u00271\u0027:"},{"line_number":816,"context_line":"        _execute(\u0027sysctl\u0027, \u0027-w\u0027, \u0027%s\u003d1\u0027 % sysctl_key, run_as_root\u003dTrue)"},{"line_number":817,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAUH%2F%2FnVk%3D","line":814,"in_reply_to":"AAAAUH%2F%2FnjM%3D","updated":"2014-01-10 13:28:28.000000000","message":"@sahid, you need to time it running using rootwrap, not sysctl by itself. Correct comparion would be\n\n\"sudo nova-rootwrap /etc/nova/rootwrap.conf sysctl -w net.ipv4.ip_forward\u003d1\"\n\nversus\n\n\"sysctl -n net.ipv4.ip_forward\"","commit_id":"3d63d01c8aebb371dfebfa9ccf1e921ed63318c8"},{"author":{"_account_id":5638,"name":"Davanum Srinivas","email":"davanum@gmail.com","username":"dims-v"},"change_message_id":"78727880a716229e2abf7c5959e9016ec9a4d978","unresolved":false,"context_lines":[{"line_number":811,"context_line":""},{"line_number":812,"context_line":"def _enable_ipv4_forwarding():"},{"line_number":813,"context_line":"    sysctl_key \u003d \u0027net.ipv4.ip_forward\u0027"},{"line_number":814,"context_line":"    stdout, stderr \u003d _execute(\u0027sysctl\u0027, \u0027-n\u0027, sysctl_key)"},{"line_number":815,"context_line":"    if stdout.strip() is not \u00271\u0027:"},{"line_number":816,"context_line":"        _execute(\u0027sysctl\u0027, \u0027-w\u0027, \u0027%s\u003d1\u0027 % sysctl_key, run_as_root\u003dTrue)"},{"line_number":817,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAUH%2F%2FnuY%3D","line":814,"in_reply_to":"AAAAUH%2F%2FoVs%3D","updated":"2014-01-10 12:07:04.000000000","message":"@sahid, the call to check with -n is far cheaper in terms of time than the call to -w as the former is not running as root and the latter is. So the code tries the quicker check and runs the expensive operation only if needed.","commit_id":"3d63d01c8aebb371dfebfa9ccf1e921ed63318c8"},{"author":{"_account_id":7730,"name":"Sahid Orentino Ferdjaoui","email":"sahid.ferdjaoui@industrialdiscipline.com","username":"sahid"},"change_message_id":"e06b38a056cc693a5858194ba517e1dfdbf97dae","unresolved":false,"context_lines":[{"line_number":821,"context_line":"    if not network_ref:"},{"line_number":822,"context_line":"        return"},{"line_number":823,"context_line":""},{"line_number":824,"context_line":"    _enable_ipv4_forwarding()"},{"line_number":825,"context_line":""},{"line_number":826,"context_line":"    # NOTE(vish): The ip for dnsmasq has to be the first address on the"},{"line_number":827,"context_line":"    #             bridge for it to respond to reqests properly"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAUH%2F%2FoV8%3D","line":824,"updated":"2014-01-10 10:07:57.000000000","message":"I don\u0027t understand why you did it? This method is called only one time and your code add a lot of lines for doing same things","commit_id":"3d63d01c8aebb371dfebfa9ccf1e921ed63318c8"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"31e726820e0bc493812a57740fe59d85c9ba651b","unresolved":false,"context_lines":[{"line_number":821,"context_line":"    if not network_ref:"},{"line_number":822,"context_line":"        return"},{"line_number":823,"context_line":""},{"line_number":824,"context_line":"    _enable_ipv4_forwarding()"},{"line_number":825,"context_line":""},{"line_number":826,"context_line":"    # NOTE(vish): The ip for dnsmasq has to be the first address on the"},{"line_number":827,"context_line":"    #             bridge for it to respond to reqests properly"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAUH%2F%2FnAs%3D","line":824,"in_reply_to":"AAAAUH%2F%2FoV8%3D","updated":"2014-01-10 14:32:58.000000000","message":"This is called many times not just once. Grep any nova-network log for \"sysctl\" and you\u0027ll see.","commit_id":"3d63d01c8aebb371dfebfa9ccf1e921ed63318c8"},{"author":{"_account_id":1779,"name":"Daniel Berrange","email":"berrange@redhat.com","username":"berrange"},"change_message_id":"bc7c08bcb52e98fcfe062176db76fe8122f46205","unresolved":false,"context_lines":[{"line_number":1203,"context_line":""},{"line_number":1204,"context_line":"def device_exists(device):"},{"line_number":1205,"context_line":"    \"\"\"Check if ethernet device exists.\"\"\""},{"line_number":1206,"context_line":"    return os.path.exists(\u0027/proc/sys/net/ipv4/conf/%s\u0027 % device)"},{"line_number":1207,"context_line":""},{"line_number":1208,"context_line":""},{"line_number":1209,"context_line":"def _dhcp_file(dev, kind):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAUH%2F%2Fns0%3D","line":1206,"updated":"2014-01-10 12:11:13.000000000","message":"A bit of a nit-pick, but I\u0027d suggest \u0027/sys/class/net/%s\u0027 as being a better path.","commit_id":"3d63d01c8aebb371dfebfa9ccf1e921ed63318c8"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"31e726820e0bc493812a57740fe59d85c9ba651b","unresolved":false,"context_lines":[{"line_number":1203,"context_line":""},{"line_number":1204,"context_line":"def device_exists(device):"},{"line_number":1205,"context_line":"    \"\"\"Check if ethernet device exists.\"\"\""},{"line_number":1206,"context_line":"    return os.path.exists(\u0027/proc/sys/net/ipv4/conf/%s\u0027 % device)"},{"line_number":1207,"context_line":""},{"line_number":1208,"context_line":""},{"line_number":1209,"context_line":"def _dhcp_file(dev, kind):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAUH%2F%2FnAY%3D","line":1206,"in_reply_to":"AAAAUH%2F%2Fns0%3D","updated":"2014-01-10 14:32:58.000000000","message":"But I come from an old school where /sys doesn\u0027t exist!\n\ner, yeah, sounds better, thanks :)","commit_id":"3d63d01c8aebb371dfebfa9ccf1e921ed63318c8"}]}
