{"action":"created","issue":{"url":"https://api.github.com/repos/axsh/wakame-vdc/issues/781","repository_url":"https://api.github.com/repos/axsh/wakame-vdc","labels_url":"https://api.github.com/repos/axsh/wakame-vdc/issues/781/labels{/name}","comments_url":"https://api.github.com/repos/axsh/wakame-vdc/issues/781/comments","events_url":"https://api.github.com/repos/axsh/wakame-vdc/issues/781/events","html_url":"https://github.com/axsh/wakame-vdc/pull/781","id":141211526,"number":781,"title":"Fix dhcp range cleanup","user":{"login":"Metallion","id":629110,"avatar_url":"https://avatars.githubusercontent.com/u/629110?v=3","gravatar_id":"","url":"https://api.github.com/users/Metallion","html_url":"https://github.com/Metallion","followers_url":"https://api.github.com/users/Metallion/followers","following_url":"https://api.github.com/users/Metallion/following{/other_user}","gists_url":"https://api.github.com/users/Metallion/gists{/gist_id}","starred_url":"https://api.github.com/users/Metallion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Metallion/subscriptions","organizations_url":"https://api.github.com/users/Metallion/orgs","repos_url":"https://api.github.com/users/Metallion/repos","events_url":"https://api.github.com/users/Metallion/events{/privacy}","received_events_url":"https://api.github.com/users/Metallion/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-03-16T09:04:18Z","updated_at":"2016-03-16T10:36:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/axsh/wakame-vdc/pulls/781","html_url":"https://github.com/axsh/wakame-vdc/pull/781","diff_url":"https://github.com/axsh/wakame-vdc/pull/781.diff","patch_url":"https://github.com/axsh/wakame-vdc/pull/781.patch"},"body":"While working on terraform, I noticed that networks I created had different dhcp ranges than I expected. The problem was that dhcp ranges didn't get deleted along with the networks. Old dhcp ranges belonging to networks that didn't exist remained in the database, creating the following problem:\r\n\r\n1) Network *nw-xxx* is created and gets `id` (primary key) 1 in the database.\r\n\r\n2) A DHCP range *rangex* is created and assigned to *nw-xxx*, this it's `network_id` in the database is 1.\r\n\r\n3) Network *nw-xxx* is deleted. DHCP range *rangex* stays in the database.\r\n\r\n4) Network *nw-yyy* is created and reuses `id` 1.\r\n\r\n5) **Bug:** Network *nw-yyy* now owns *rangex* which stayed in the database with `network_id` 1."},"comment":{"url":"https://api.github.com/repos/axsh/wakame-vdc/issues/comments/197254349","html_url":"https://github.com/axsh/wakame-vdc/pull/781#issuecomment-197254349","issue_url":"https://api.github.com/repos/axsh/wakame-vdc/issues/781","id":197254349,"user":{"login":"axsh-bot","id":4980916,"avatar_url":"https://avatars.githubusercontent.com/u/4980916?v=3","gravatar_id":"","url":"https://api.github.com/users/axsh-bot","html_url":"https://github.com/axsh-bot","followers_url":"https://api.github.com/users/axsh-bot/followers","following_url":"https://api.github.com/users/axsh-bot/following{/other_user}","gists_url":"https://api.github.com/users/axsh-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/axsh-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/axsh-bot/subscriptions","organizations_url":"https://api.github.com/users/axsh-bot/orgs","repos_url":"https://api.github.com/users/axsh-bot/repos","events_url":"https://api.github.com/users/axsh-bot/events{/privacy}","received_events_url":"https://api.github.com/users/axsh-bot/received_events","type":"User","site_admin":false},"created_at":"2016-03-16T10:36:16Z","updated_at":"2016-03-16T10:36:16Z","body":":white_check_mark: 33c6e6a5 success - [wakame-ci/kvm.smoke.lb](http://ci.wakame.jp/job/kvm.smoke.trigger.lb/1913/)"}}