{"action":"created","comment":{"url":"https://api.github.com/repos/rancherio/cattle/pulls/comments/24216210","id":24216210,"diff_hunk":"@@ -0,0 +1,62 @@\n+package io.cattle.platform.lb.instance.process;\n+\n+import io.cattle.platform.core.constants.AgentConstants;\n+import io.cattle.platform.core.constants.InstanceConstants;\n+import io.cattle.platform.core.model.Agent;\n+import io.cattle.platform.core.model.Instance;\n+import io.cattle.platform.engine.handler.HandlerResult;\n+import io.cattle.platform.engine.handler.ProcessPostListener;\n+import io.cattle.platform.engine.process.ProcessInstance;\n+import io.cattle.platform.engine.process.ProcessState;\n+import io.cattle.platform.engine.process.impl.ProcessCancelException;\n+import io.cattle.platform.lb.instance.service.LoadBalancerInstanceManager;\n+import io.cattle.platform.object.process.StandardProcess;\n+import io.cattle.platform.process.common.handler.AbstractObjectProcessLogic;\n+import io.cattle.platform.util.type.CollectionUtils;\n+import io.cattle.platform.util.type.Priority;\n+\n+import javax.inject.Inject;\n+import javax.inject.Named;\n+\n+@Named\n+public class LoadBalancerInstanceRemovePostAction extends AbstractObjectProcessLogic implements ProcessPostListener,","path":"code/iaas/lb-instance/src/main/java/io/cattle/platform/lb/instance/process/LoadBalancerInstanceRemovePostAction.java","position":22,"original_position":22,"commit_id":"f2ef31f0fee6526658d704927175aa017dfcf6d9","original_commit_id":"f2ef31f0fee6526658d704927175aa017dfcf6d9","user":{"login":"ibuildthecloud","id":1754002,"avatar_url":"https://avatars.githubusercontent.com/u/1754002?v=3","gravatar_id":"","url":"https://api.github.com/users/ibuildthecloud","html_url":"https://github.com/ibuildthecloud","followers_url":"https://api.github.com/users/ibuildthecloud/followers","following_url":"https://api.github.com/users/ibuildthecloud/following{/other_user}","gists_url":"https://api.github.com/users/ibuildthecloud/gists{/gist_id}","starred_url":"https://api.github.com/users/ibuildthecloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibuildthecloud/subscriptions","organizations_url":"https://api.github.com/users/ibuildthecloud/orgs","repos_url":"https://api.github.com/users/ibuildthecloud/repos","events_url":"https://api.github.com/users/ibuildthecloud/events{/privacy}","received_events_url":"https://api.github.com/users/ibuildthecloud/received_events","type":"User","site_admin":false},"body":"Same comment on the name, something like \"*PostListener\"","created_at":"2015-02-06T01:15:30Z","updated_at":"2015-02-06T01:15:30Z","html_url":"https://github.com/rancherio/cattle/pull/213#discussion_r24216210","pull_request_url":"https://api.github.com/repos/rancherio/cattle/pulls/213","_links":{"self":{"href":"https://api.github.com/repos/rancherio/cattle/pulls/comments/24216210"},"html":{"href":"https://github.com/rancherio/cattle/pull/213#discussion_r24216210"},"pull_request":{"href":"https://api.github.com/repos/rancherio/cattle/pulls/213"}}},"pull_request":{"url":"https://api.github.com/repos/rancherio/cattle/pulls/213","id":28606286,"html_url":"https://github.com/rancherio/cattle/pull/213","diff_url":"https://github.com/rancherio/cattle/pull/213.diff","patch_url":"https://github.com/rancherio/cattle/pull/213.patch","issue_url":"https://api.github.com/repos/rancherio/cattle/issues/213","number":213,"state":"open","locked":false,"title":"LoadBalancerInstance","user":{"login":"alena1108","id":1562176,"avatar_url":"https://avatars.githubusercontent.com/u/1562176?v=3","gravatar_id":"","url":"https://api.github.com/users/alena1108","html_url":"https://github.com/alena1108","followers_url":"https://api.github.com/users/alena1108/followers","following_url":"https://api.github.com/users/alena1108/following{/other_user}","gists_url":"https://api.github.com/users/alena1108/gists{/gist_id}","starred_url":"https://api.github.com/users/alena1108/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alena1108/subscriptions","organizations_url":"https://api.github.com/users/alena1108/orgs","repos_url":"https://api.github.com/users/alena1108/repos","events_url":"https://api.github.com/users/alena1108/events{/privacy}","received_events_url":"https://api.github.com/users/alena1108/received_events","type":"User","site_admin":false},"body":"@ibuildthecloud PR for LB Instance Deployment logic. \r\n\r\n1) LB agent/instance get created as a part of PostAction (\"LoadBalancerAddHostPostAction\") for load_balancer_host_map.create process. The mapping creation  is invoked in the ProcessHander for LoadBalancer.addHost API (\"LoadBalancerAddRemoveHost\")\r\n \r\n2) LB agent/instance get scheduled for removal as a part of PostAction (\"LoadBalancerRemoveHostPostAction\") for load_balancer_host_map.remove process. The mapping removal is invoked in:\r\n\r\na) ProcessHandler for LoadBalancer.removeHost API (\"LoadBalancerAddRemoveHost\") \r\nb) ProcessHandler for LoadBalancer.remove(\"LoadBalancerRemove\")\r\nc) PreHandler for Host.remove(\"HostRemovePreAction\")\r\n\r\n3) LB agent/instance removal consists of:\r\n\r\na) LB instance gets scheduled for Stop with Removed as a chain process (in \"LoadBalancerRemoveHostPostAction\")\r\nb) LB agent gets scheduled for Deactivate with Remove as a chain action (in \"LoadBalancerInstanceRemovePostAction\") on LB instance removal process\r\n\r\n\r\nRemoval is more complicated than the creation as it can be triggered by more actions + it has to be scheduled instead of being executed directly. And as the removal consists of multiple steps, scheduling those required putting more logic in.\r\n\r\nCreation is called for execution directly, and we don't finish updating LoadBalancer object till LBAgent/Instance creation is completed. In the future, when Set API comes in (and we will be able to set multiple hosts with a single API), I will put implementation for executing for multiple hosts of the same LB, in parallel.","created_at":"2015-02-04T01:31:54Z","updated_at":"2015-02-06T01:15:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e3c3d2c2b006ea4d6cfee3f4f870b80ebdd4ef0a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rancherio/cattle/pulls/213/commits","review_comments_url":"https://api.github.com/repos/rancherio/cattle/pulls/213/comments","review_comment_url":"https://api.github.com/repos/rancherio/cattle/pulls/comments/{number}","comments_url":"https://api.github.com/repos/rancherio/cattle/issues/213/comments","statuses_url":"https://api.github.com/repos/rancherio/cattle/statuses/f2ef31f0fee6526658d704927175aa017dfcf6d9","head":{"label":"alena1108:lb_instance","ref":"lb_instance","sha":"f2ef31f0fee6526658d704927175aa017dfcf6d9","user":{"login":"alena1108","id":1562176,"avatar_url":"https://avatars.githubusercontent.com/u/1562176?v=3","gravatar_id":"","url":"https://api.github.com/users/alena1108","html_url":"https://github.com/alena1108","followers_url":"https://api.github.com/users/alena1108/followers","following_url":"https://api.github.com/users/alena1108/following{/other_user}","gists_url":"https://api.github.com/users/alena1108/gists{/gist_id}","starred_url":"https://api.github.com/users/alena1108/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alena1108/subscriptions","organizations_url":"https://api.github.com/users/alena1108/orgs","repos_url":"https://api.github.com/users/alena1108/repos","events_url":"https://api.github.com/users/alena1108/events{/privacy}","received_events_url":"https://api.github.com/users/alena1108/received_events","type":"User","site_admin":false},"repo":{"id":28929339,"name":"cattle","full_name":"alena1108/cattle","owner":{"login":"alena1108","id":1562176,"avatar_url":"https://avatars.githubusercontent.com/u/1562176?v=3","gravatar_id":"","url":"https://api.github.com/users/alena1108","html_url":"https://github.com/alena1108","followers_url":"https://api.github.com/users/alena1108/followers","following_url":"https://api.github.com/users/alena1108/following{/other_user}","gists_url":"https://api.github.com/users/alena1108/gists{/gist_id}","starred_url":"https://api.github.com/users/alena1108/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alena1108/subscriptions","organizations_url":"https://api.github.com/users/alena1108/orgs","repos_url":"https://api.github.com/users/alena1108/repos","events_url":"https://api.github.com/users/alena1108/events{/privacy}","received_events_url":"https://api.github.com/users/alena1108/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alena1108/cattle","description":"Infrastructure orchestration platform","fork":true,"url":"https://api.github.com/repos/alena1108/cattle","forks_url":"https://api.github.com/repos/alena1108/cattle/forks","keys_url":"https://api.github.com/repos/alena1108/cattle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alena1108/cattle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alena1108/cattle/teams","hooks_url":"https://api.github.com/repos/alena1108/cattle/hooks","issue_events_url":"https://api.github.com/repos/alena1108/cattle/issues/events{/number}","events_url":"https://api.github.com/repos/alena1108/cattle/events","assignees_url":"https://api.github.com/repos/alena1108/cattle/assignees{/user}","branches_url":"https://api.github.com/repos/alena1108/cattle/branches{/branch}","tags_url":"https://api.github.com/repos/alena1108/cattle/tags","blobs_url":"https://api.github.com/repos/alena1108/cattle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alena1108/cattle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alena1108/cattle/git/refs{/sha}","trees_url":"https://api.github.com/repos/alena1108/cattle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alena1108/cattle/statuses/{sha}","languages_url":"https://api.github.com/repos/alena1108/cattle/languages","stargazers_url":"https://api.github.com/repos/alena1108/cattle/stargazers","contributors_url":"https://api.github.com/repos/alena1108/cattle/contributors","subscribers_url":"https://api.github.com/repos/alena1108/cattle/subscribers","subscription_url":"https://api.github.com/repos/alena1108/cattle/subscription","commits_url":"https://api.github.com/repos/alena1108/cattle/commits{/sha}","git_commits_url":"https://api.github.com/repos/alena1108/cattle/git/commits{/sha}","comments_url":"https://api.github.com/repos/alena1108/cattle/comments{/number}","issue_comment_url":"https://api.github.com/repos/alena1108/cattle/issues/comments/{number}","contents_url":"https://api.github.com/repos/alena1108/cattle/contents/{+path}","compare_url":"https://api.github.com/repos/alena1108/cattle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alena1108/cattle/merges","archive_url":"https://api.github.com/repos/alena1108/cattle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alena1108/cattle/downloads","issues_url":"https://api.github.com/repos/alena1108/cattle/issues{/number}","pulls_url":"https://api.github.com/repos/alena1108/cattle/pulls{/number}","milestones_url":"https://api.github.com/repos/alena1108/cattle/milestones{/number}","notifications_url":"https://api.github.com/repos/alena1108/cattle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alena1108/cattle/labels{/name}","releases_url":"https://api.github.com/repos/alena1108/cattle/releases{/id}","created_at":"2015-01-07T19:10:53Z","updated_at":"2015-01-12T17:27:50Z","pushed_at":"2015-02-06T00:12:01Z","git_url":"git://github.com/alena1108/cattle.git","ssh_url":"git@github.com:alena1108/cattle.git","clone_url":"https://github.com/alena1108/cattle.git","svn_url":"https://github.com/alena1108/cattle","homepage":"","size":16438,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rancherio:master","ref":"master","sha":"33d503c348a1535c31961296456fe0fa99fe34a2","user":{"login":"rancherio","id":9343010,"avatar_url":"https://avatars.githubusercontent.com/u/9343010?v=3","gravatar_id":"","url":"https://api.github.com/users/rancherio","html_url":"https://github.com/rancherio","followers_url":"https://api.github.com/users/rancherio/followers","following_url":"https://api.github.com/users/rancherio/following{/other_user}","gists_url":"https://api.github.com/users/rancherio/gists{/gist_id}","starred_url":"https://api.github.com/users/rancherio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rancherio/subscriptions","organizations_url":"https://api.github.com/users/rancherio/orgs","repos_url":"https://api.github.com/users/rancherio/repos","events_url":"https://api.github.com/users/rancherio/events{/privacy}","received_events_url":"https://api.github.com/users/rancherio/received_events","type":"Organization","site_admin":false},"repo":{"id":18023059,"name":"cattle","full_name":"rancherio/cattle","owner":{"login":"rancherio","id":9343010,"avatar_url":"https://avatars.githubusercontent.com/u/9343010?v=3","gravatar_id":"","url":"https://api.github.com/users/rancherio","html_url":"https://github.com/rancherio","followers_url":"https://api.github.com/users/rancherio/followers","following_url":"https://api.github.com/users/rancherio/following{/other_user}","gists_url":"https://api.github.com/users/rancherio/gists{/gist_id}","starred_url":"https://api.github.com/users/rancherio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rancherio/subscriptions","organizations_url":"https://api.github.com/users/rancherio/orgs","repos_url":"https://api.github.com/users/rancherio/repos","events_url":"https://api.github.com/users/rancherio/events{/privacy}","received_events_url":"https://api.github.com/users/rancherio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rancherio/cattle","description":"Infrastructure orchestration platform","fork":false,"url":"https://api.github.com/repos/rancherio/cattle","forks_url":"https://api.github.com/repos/rancherio/cattle/forks","keys_url":"https://api.github.com/repos/rancherio/cattle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rancherio/cattle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rancherio/cattle/teams","hooks_url":"https://api.github.com/repos/rancherio/cattle/hooks","issue_events_url":"https://api.github.com/repos/rancherio/cattle/issues/events{/number}","events_url":"https://api.github.com/repos/rancherio/cattle/events","assignees_url":"https://api.github.com/repos/rancherio/cattle/assignees{/user}","branches_url":"https://api.github.com/repos/rancherio/cattle/branches{/branch}","tags_url":"https://api.github.com/repos/rancherio/cattle/tags","blobs_url":"https://api.github.com/repos/rancherio/cattle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rancherio/cattle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rancherio/cattle/git/refs{/sha}","trees_url":"https://api.github.com/repos/rancherio/cattle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rancherio/cattle/statuses/{sha}","languages_url":"https://api.github.com/repos/rancherio/cattle/languages","stargazers_url":"https://api.github.com/repos/rancherio/cattle/stargazers","contributors_url":"https://api.github.com/repos/rancherio/cattle/contributors","subscribers_url":"https://api.github.com/repos/rancherio/cattle/subscribers","subscription_url":"https://api.github.com/repos/rancherio/cattle/subscription","commits_url":"https://api.github.com/repos/rancherio/cattle/commits{/sha}","git_commits_url":"https://api.github.com/repos/rancherio/cattle/git/commits{/sha}","comments_url":"https://api.github.com/repos/rancherio/cattle/comments{/number}","issue_comment_url":"https://api.github.com/repos/rancherio/cattle/issues/comments/{number}","contents_url":"https://api.github.com/repos/rancherio/cattle/contents/{+path}","compare_url":"https://api.github.com/repos/rancherio/cattle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rancherio/cattle/merges","archive_url":"https://api.github.com/repos/rancherio/cattle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rancherio/cattle/downloads","issues_url":"https://api.github.com/repos/rancherio/cattle/issues{/number}","pulls_url":"https://api.github.com/repos/rancherio/cattle/pulls{/number}","milestones_url":"https://api.github.com/repos/rancherio/cattle/milestones{/number}","notifications_url":"https://api.github.com/repos/rancherio/cattle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rancherio/cattle/labels{/name}","releases_url":"https://api.github.com/repos/rancherio/cattle/releases{/id}","created_at":"2014-03-23T00:19:52Z","updated_at":"2015-02-06T00:55:32Z","pushed_at":"2015-02-06T00:55:32Z","git_url":"git://github.com/rancherio/cattle.git","ssh_url":"git@github.com:rancherio/cattle.git","clone_url":"https://github.com/rancherio/cattle.git","svn_url":"https://github.com/rancherio/cattle","homepage":"","size":18978,"stargazers_count":91,"watchers_count":91,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":76,"forks":17,"open_issues":76,"watchers":91,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rancherio/cattle/pulls/213"},"html":{"href":"https://github.com/rancherio/cattle/pull/213"},"issue":{"href":"https://api.github.com/repos/rancherio/cattle/issues/213"},"comments":{"href":"https://api.github.com/repos/rancherio/cattle/issues/213/comments"},"review_comments":{"href":"https://api.github.com/repos/rancherio/cattle/pulls/213/comments"},"review_comment":{"href":"https://api.github.com/repos/rancherio/cattle/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/rancherio/cattle/pulls/213/commits"},"statuses":{"href":"https://api.github.com/repos/rancherio/cattle/statuses/f2ef31f0fee6526658d704927175aa017dfcf6d9"}}}}